The MongoDB MCP Server has various options that you can enable or disable. For example: read-only mode, specific MCP tools, telemetry about system use, and database index checks.
Enabling MCP Server Read-Only Mode
You can limit the MCP Server to perform only read operations using read-only mode.
Default is to allow cluster write operations. Typically, always enable read-only mode.
To enable read-only mode with a command line option, use:
--readOnly
To enable read-only mode using an environment variable, set the MDB_MCP_READ_ONLY environment variable to true:
export MDB_MCP_READ_ONLY=true
When you enable read-only mode, a message is added to the MCP Server log that indicates the tools that perform write operations are prevented from running.
Disabling MCP Server Tools
To restrict access to Atlas and database operations, you can disable specific MCP Server tools or categories of tools.
To disable tools, set the disabledTools MCP Server configuration option, which is an array of strings. Each string can be a tool name or tool category.
The following table shows the tool names that you can disable:
Tool Name | Description | Example Operations Disabled |
|---|---|---|
| Create resources |
|
| Update resources |
|
| Delete resources |
|
| Read resources |
|
| Read metadata |
|
The following table shows the tool categories that you can disable:
Tool Category | Description | Example Operations Disabled |
|---|---|---|
| Atlas tools |
|
| Database tools |
|
To disable tools with the disabledTools command line option, use a space-separated list. For example:
--disabledTools create update delete atlas
To disable tools with the MDB_MCP_DISABLED_TOOLS environment variable, use a comma-separated string. For example:
export MDB_MCP_DISABLED_TOOLS="create,update,delete,atlas"
Disabling MCP Server Telemetry
To prevent the MCP Server from collecting data about usage, you can disable telemetry.
To disable telemetry using an environment variable, set either of these:
export MDB_MCP_TELEMETRY=disabled export DO_NOT_TRACK=1
To disable telemetry using a command line option, use:
--telemetry disabled
Enabling Index Check
To ensure query operations use an index, enable the index check option. When enabled, the MCP Server rejects queries that perform a collection scan to improve performance and ensure queries are optimized.
To enable the index check with a command line option, use:
--indexCheck
To enable the index check with an environment variable, use:
export MDB_MCP_INDEX_CHECK=true
If you enable the index check, the MCP Server logs an error message if a query is rejected because it doesn't use an index.