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
+65-14Lines changed: 65 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -225,6 +225,27 @@ With Atlas API credentials:
225
225
}
226
226
```
227
227
228
+
#### Option 6: Running as an HTTP Server
229
+
230
+
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.
231
+
232
+
To start the server with HTTP transport, use the `--transport http` option:
233
+
234
+
```shell
235
+
npx -y mongodb-mcp-server --transport http
236
+
```
237
+
238
+
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.
245
+
-`--httpPort` (default: 3000): The port number for the HTTP server.
246
+
247
+
> **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.
248
+
228
249
## 🛠️ Supported Tools
229
250
230
251
### Tool List
@@ -278,23 +299,53 @@ 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. |
284
-
|`apiClientSecret`| Atlas API client secret for authentication. Required for running Atlas tools. |
285
-
|`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. |
286
-
|`logPath`| Folder to store logs. |
287
-
|`disabledTools`| An array of tool names, operation types, and/or categories of tools that will be disabled. |
288
-
|`readOnly`| When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations. |
289
-
|`indexCheck`| When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan. |
290
-
|`telemetry`| When set to disabled, disables telemetry collection. |
|`apiClientId`| <notset> | Atlas API client ID for authentication. Required for running Atlas tools. |
305
+
|`apiClientSecret`| <notset> | Atlas API client secret for authentication. Required for running Atlas tools. |
306
+
|`connectionString`| <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. |
307
+
|`loggers`| disk,mcp | Comma separated values, possible values are `mcp`, `disk` and `stderr`. See [Logger Options](#logger-options) for details. |
308
+
|`logPath`| see note\*| Folder to store logs. |
309
+
|`disabledTools`| <notset> | An array of tool names, operation types, and/or categories of tools that will be disabled. |
310
+
|`readOnly`| false | When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations. |
311
+
|`indexCheck`| false | When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan. |
312
+
|`telemetry`| enabled | When set to disabled, disables telemetry collection. |
313
+
|`transport`| stdio | Either 'stdio' or 'http'. |
314
+
|`httpPort`| 3000 | Port number. |
315
+
|`httpHost`| 127.0.0.1 | Host to bind the http server. |
316
+
317
+
#### Logger Options
318
+
319
+
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:
320
+
321
+
-`mcp`: Sends logs to the MCP client (if supported by the client/transport).
322
+
-`disk`: Writes logs to disk files. Log files are stored in the log path (see `logPath` above).
323
+
-`stderr`: Outputs logs to standard error (stderr), useful for debugging or when running in containers.
324
+
325
+
**Default:**`disk,mcp` (logs are written to disk and sent to the MCP client).
326
+
327
+
You can combine multiple loggers, e.g. `--loggers disk,stderr` or `export MDB_MCP_LOGGERS="mcp,stderr"`.
328
+
329
+
##### Example: Set logger via environment variable
330
+
331
+
```shell
332
+
export MDB_MCP_LOGGERS="disk,stderr"
333
+
```
334
+
335
+
##### Example: Set logger via command-line argument
336
+
337
+
```shell
338
+
npx -y mongodb-mcp-server --loggers mcp,stderr
339
+
```
340
+
341
+
##### Log File Location
291
342
292
-
#### Log Path
343
+
When using the `disk` logger, log files are stored in:
0 commit comments