You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+67-14Lines changed: 67 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -228,6 +228,27 @@ With Atlas API credentials:
228
228
}
229
229
```
230
230
231
+
#### Option 6: Running as an HTTP Server
232
+
233
+
You can run the MongoDB MCP Server as an HTTP server instead of the default stdio transport. This is useful if you want to interact with the server over HTTP, for example from a web client or to expose the server on a specific port.
234
+
235
+
To start the server with HTTP transport, use the `--transport http` option:
236
+
237
+
```shell
238
+
npx -y mongodb-mcp-server --transport http
239
+
```
240
+
241
+
By default, the server will listen on `http://127.0.0.1:3000`. You can customize the host and port using the `--httpHost` and `--httpPort` options:
-`--httpHost` (default: 127.0.0.1): The host to bind the HTTP server.
248
+
-`--httpPort` (default: 3000): The port number for the HTTP server.
249
+
250
+
> **Note:** The default transport is `stdio`, which is suitable for integration with most MCP clients. Use `http` transport if you need to interact with the server over HTTP.
251
+
231
252
## 🛠️ Supported Tools
232
253
233
254
### Tool List
@@ -281,23 +302,55 @@ The MongoDB MCP Server can be configured using multiple methods, with the follow
|`apiClientId`| Atlas API client ID for authentication. Required for running Atlas tools. |
287
-
|`apiClientSecret`| Atlas API client secret for authentication. Required for running Atlas tools. |
288
-
|`connectionString`| MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the `connect` tool before interacting with MongoDB data. |
289
-
|`logPath`| Folder to store logs. |
290
-
|`disabledTools`| An array of tool names, operation types, and/or categories of tools that will be disabled. |
291
-
|`readOnly`| When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations. |
292
-
|`indexCheck`| When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan. |
293
-
|`telemetry`| When set to disabled, disables telemetry collection. |
|`apiClientId`|`MDB_MCP_API_CLIENT_ID`| <notset> | Atlas API client ID for authentication. Required for running Atlas tools. |
308
+
|`apiClientSecret`|`MDB_MCP_API_CLIENT_SECRET`| <notset> | Atlas API client secret for authentication. Required for running Atlas tools. |
309
+
|`connectionString`|`MDB_MCP_CONNECTION_STRING`| <notset> | MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the `connect` tool before interacting with MongoDB data. |
310
+
|`loggers`|`MDB_MCP_LOGGERS`| disk,mcp | Comma separated values, possible values are `mcp`, `disk` and `stderr`. See [Logger Options](#logger-options) for details. |
311
+
|`logPath`|`MDB_MCP_LOG_PATH`| see note\*| Folder to store logs. |
312
+
|`disabledTools`|`MDB_MCP_DISABLED_TOOLS`| <notset> | An array of tool names, operation types, and/or categories of tools that will be disabled. |
313
+
|`readOnly`|`MDB_MCP_READ_ONLY`| false | When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations. |
314
+
|`indexCheck`|`MDB_MCP_INDEX_CHECK`| false | When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan. |
315
+
|`telemetry`|`MDB_MCP_TELEMETRY`| enabled | When set to disabled, disables telemetry collection. |
316
+
|`transport`|`MDB_MCP_TRANSPORT`| stdio | Either 'stdio' or 'http'. |
317
+
|`httpPort`|`MDB_MCP_HTTP_PORT`| 3000 | Port number. |
318
+
|`httpHost`|`MDB_MCP_HTTP_HOST`| 127.0.0.1 | Host to bind the http server. |
319
+
|`idleTimeoutMs`|`MDB_MCP_IDLE_TIMEOUT_MS`| 600000 | Idle timeout for a client to disconnect (only applies to http transport). |
320
+
|`notificationTimeoutMs`|`MDB_MCP_NOTIFICATION_TIMEOUT_MS`| 540000 | Notification timeout for a client to be aware of diconnect (only applies to http transport). |
321
+
322
+
#### Logger Options
323
+
324
+
The `loggers` configuration option controls where logs are sent. You can specify one or more logger types as a comma-separated list. The available options are:
325
+
326
+
-`mcp`: Sends logs to the MCP client (if supported by the client/transport).
327
+
-`disk`: Writes logs to disk files. Log files are stored in the log path (see `logPath` above).
328
+
-`stderr`: Outputs logs to standard error (stderr), useful for debugging or when running in containers.
329
+
330
+
**Default:**`disk,mcp` (logs are written to disk and sent to the MCP client).
331
+
332
+
You can combine multiple loggers, e.g. `--loggers disk stderr` or `export MDB_MCP_LOGGERS="mcp,stderr"`.
333
+
334
+
##### Example: Set logger via environment variable
335
+
336
+
```shell
337
+
export MDB_MCP_LOGGERS="disk,stderr"
338
+
```
339
+
340
+
##### Example: Set logger via command-line argument
341
+
342
+
```shell
343
+
npx -y mongodb-mcp-server --loggers mcp stderr
344
+
```
345
+
346
+
##### Log File Location
294
347
295
-
#### Log Path
348
+
When using the `disk` logger, log files are stored in:
0 commit comments