The MCP Server has various options that you can set to connect to a MongoDB cluster and control MCP Server operations. You can set the options in a JSON configuration file, through a command line, or using operating system environment variables.
Options List
Use the following configuration options to configure the MCP Server.
Important
If you're a MongoDB Enterprise or MongoDB Atlas user and you require a specific authentication mechanism, see the MongoDB MCP Server Security section to learn about the configuration options for your authentication method.
CLI Option Name | OS Environment Variable Name | Type | Default | Description |
|---|---|---|---|---|
|
| boolean |
| Flag that indicates if users can override MCP Server configurations per-request with request headers and query parameters. For the specific override behavior of each configuration option, see the Override Behavior Table below. |
|
| string | Not set | Atlas API client ID for authentication. |
|
| string | Not set | Atlas API client secret for authentication. |
|
| string | Not set | Full path to the JSON configuration file. Using the
|
|
| string | Not set | Connection string for a direct database connection. Sets the connection string at runtime to allow the client to directly connect to a cluster. ImportantThe NoteTypically, avoid providing the connection string at runtime because you expose the connection credentials to the large language model. The connection string is used if the client has never connected before, or the client switches the connection to a new cluster if the client was previously connected. After the client calls the connect or switch connection tool, the client reuses the same connection for subsequent operations. Therefore, you only need to call the connect or switch connection tool once or if you need to switch to a different connection. |
|
| boolean |
| Use the dry-run option to examine your MCP Server configuration. When you enable the dry-run option, the MCP Server returns the MCP Server configuration settings and the list of enabled MongoDB MCP Server Tools. To enable the dry-run option, set For more information, see Enabling MCP Server Dry-Run Mode. |
|
| boolean |
| Enables clients to skip session initialization. When enabled, clients
can call tools directly with a self-generated session ID.
Those sessions are implicitly created on the server and kept alive until ImportantTo enhance session security, ensure that sessions IDs are unique and non-predictable. |
|
| string |
| Path where the MCP Server sends the logs. Set
For example, to set To set the For more information about the logging options, see Troubleshoot MongoDB MCP Server. |
|
| string | Depends on the operating system | Directory that stores the MCP Server logs. NoteLock down the directory so the user running the MCP server owns it with read/write permission. This prevents any other process from accessing the server directories or files. For more information about the log path and operating system specifics, see Troubleshoot MongoDB MCP Server. |
|
| array | Not set | Array of MCP tool names, operation types, or tool categories to disable. For more information, see Disabling MCP Server Tools. |
|
| boolean |
| Flag that determines if write operations are permitted.
To disable cluster write operations, set Default is to allow cluster write operations. Typically, always enable read-only mode. For more information, see Enabling MCP Server Read-Only Mode. |
|
| boolean |
| Flag that indicates if indexes are required for queries. If For more information, see Enabling Index Check. |
|
| string |
| Flag that indicates if usage data is collected by the MCP Server.
If For more information, see Disabling MCP Server Telemetry. |
|
| string |
| Transport protocol for communications with the MCP Server. Set
|
|
| integer |
| IP port number for HTTP communications with the MCP Server. |
|
| string |
| IP address for HTTP communications with the MCP Server. With Streamable HTTP, the MCP Server is bound to WarningBinding to To learn more, see Remote Connections. |
|
| integer |
| Maximum size of the HTTP request body in bytes. Only applies to HTTP transport. |
|
| string |
| Controls the response of the MCP server. Valid values are In cases where clients are unable to establish an |
|
| string | Not set | Host address for the separate healthCheck HTTP server. This is an HTTP endpoint that Kubernetes and Docker can use to check the health of the MCP process. Only applies to HTTP transport. If provided, setting |
|
| integer | Not set | Port number for the separate healthCheck HTTP server. This is an HTTP endpoint that Kubernetes and Docker can use to check the health of the MCP process. Only applies to HTTP transport. If provided, setting |
|
| integer |
| Idle timeout for a client to disconnect. Only applies to HTTP transport. |
|
| integer |
| Notification timeout for a client to be aware of disconnect. Only applies to HTTP transport. |
|
| string |
| Authentication mechanism to used when connecting to your MongoDB deployments with the MongoDB MCP Server. SCRAM is the default authentication mechanism for MongoDB. To connect using other authentication methods, see the following pages: |
|
| string | Depends on the operating system | Directory that stores exported data files. NoteLock down the directory so the user running the MCP server owns it with read/write permission. This prevents any other process from accessing the exported directories or files. For more information about the export path and operating system specifics, see Export Data from MongoDB MCP Server. |
|
| integer |
| Time in milliseconds after which exported data files are eligible for deletion by the MCP Server cleanup process. |
|
| integer |
| Time period in milliseconds between automatic executions of the MCP Server cleanup process that deletes expired export data files. The cleanup process is run automatically. |
|
| string | Not set | Voyage AI API key used to enable native autoembeddings in Atlas Vector Search. The Voyage AI API key is only used when creating an Atlas Local deployment. For details, see Voyage AI API Keys in Atlas. To learn more about Voyage AI, see the Voyage AI documentation. |
Configuration Option Override Behaviors
The following table describes the override behavior of each configuration
option. These override behaviors apply only if the allowRequestOverrides
configuration option is set to true. If a user attempts to override a
configuration option that prohibits overrides, the MCP server declines the
connection.
Config Key | Override behavior | Additional condition |
|---|---|---|
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Merge | Disables tools in addition to those in the existing configuration. |
| Merge | Requires confirmation for tools in addition to those in the existing configuration. |
| Conditional | Can only override an existing |
| Conditional | Can only override an existing |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Conditional | Can only override with a lower timeout than the existing configuration. |
| Conditional | Can only override with a lower timeout than the existing configuration. |
| Prohibited | |
| Prohibited | |
| Prohibited | |
| Conditional | Can only override with a lower timeout than the existing configuration. |
| Prohibited | |
| Conditional | Can only override with a lower lifetime than the existing configuration. |
| Prohibited | |
| Conditional | Can only override an existing |
| Override | |
| Override | |
| Conditional | Can only disable features in the existing configuration, not add additional features. |
Positional Arguments
The MCP Server accepts a positional argument that can be provided without specifying a CLI flag. The first positional argument is interpreted as the connection string for your MongoDB deployment.
As a security best practice, use the MDB_MCP_CONNECTION_STRING
environment variable to set the connection string. If environment variables
are not an option, use the first positional argument. For example:
"args": [ "-y", "mongodb-mcp-server", "mongodb+srv://<user-name>:<password>@<cluster-name>.mongodb.net/", "--readOnly" ]