> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Enable or Disable MongoDB MCP Server Features

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:

```bash
--readOnly
```

To enable read-only mode using an environment variable, set the `MDB_MCP_READ_ONLY` environment variable to `true`:

```bash
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` | Create resources | Create cluster; Insert document |
| `update` | Update resources | Update document; Rename collection; Pause or resume cluster |
| `delete` | Delete resources | Delete document; Drop collection |
| `read` | Read resources | Find; Aggregate; List clusters |
| `metadata` | Read metadata | List databases; List collections; Read collection schema |

The following table shows the tool categories that you can disable:

| Tool Category | Description | Example Operations Disabled |
| --- | --- | --- |
| `atlas` | Atlas tools | List clusters; Create cluster |
| `mongodb` | Database tools | Find; Aggregate |

To disable tools with the `disabledTools` command line option, use a comma-separated list. For example:

```bash
--disabledTools create,update,delete,atlas
```

To disable tools with the `MDB_MCP_DISABLED_TOOLS` environment variable, use a comma-separated string. For example:

```bash
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:

```bash
export MDB_MCP_TELEMETRY=disabled
export DO_NOT_TRACK=1
```

To disable telemetry using a command line option, use:

```bash
--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:

```bash
--indexCheck
```

To enable the index check with an environment variable, use:

```bash
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.

## Enabling Server-Side JavaScript Functions

The MCP Server disables server-side JavaScript functions (`$where`, `$function`, and `$accumulator`) by default to prevent unintended behavior. These functions are deprecated in MongoDB 8.0 and later. To learn more, see [Server-Side JavaScript.](https://www.mongodb.com/docs/manual/core/server-side-javascript/)

To enable server-side JavaScript functions with a command line option, use:

```bash
--disableServerSideJs false
```

To enable server-side JavaScript functions using an environment variable, set the `MDB_MCP_DISABLE_SERVER_SIDE_JS` environment variable to `false`:

```bash
export MDB_MCP_DISABLE_SERVER_SIDE_JS=false
```

## Enabling MCP Server Dry-Run Mode

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.](https://www.mongodb.com/docs/mcp-server/tools.md#std-label-mcp-server-tools)

To enable dry-run mode with a command line option, use:

```bash
--dryRun
```

To enable dry-run mode using an environment variable, set the `MDB_MCP_DRY_RUN` environment variable to `true`:

```bash
export MDB_MCP_DRY_RUN=true
```

The MCP Server returns the configuration and enabled tools in the command line output.

## Learn More

- [MongoDB MCP Server Configuration Options](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/options.md#std-label-mcp-server-configuration-options)

- [MongoDB MCP Server Configuration Methods](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/methods.md#std-label-mcp-server-configuration-methods)

- [Export Data from MongoDB MCP Server](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/export-data.md#std-label-mcp-server-configuration-export-data)

- [Start MongoDB MCP Server as a Standalone Service](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/standalone-service.md#std-label-mcp-server-configuration-standalone-service)

- [MongoDB MCP Server Memory Overflow](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/memory-overflow.md#std-label-mcp-server-configuration-memory-overflow)

- [Troubleshoot the Local MCP Server](https://www.mongodb.com/docs/mcp-server/local-mcp/configuration/troubleshooting.md#std-label-mcp-server-configuration-troubleshooting)
