{
  "markdown": "[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?logo=data:image/svg%2bxml;base64,PHN2ZyBmaWxsPSIjRkZGRkZGIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciICB2aWV3Qm94PSIwIDAgNDggNDgiIHdpZHRoPSIyNHB4IiBoZWlnaHQ9IjI0cHgiPjxwYXRoIGQ9Ik00NC45OTkgMTAuODd2MjYuMjFjMCAxLjAzLS41OSAxLjk3LTEuNTEgMi40Mi0yLjY4IDEuMjktOCAzLjg1LTguMzUgNC4wMS0uMTMuMDctLjM4LjItLjY3LjMxLjM1LS42LjUzLTEuMy41My0yLjAyVjYuMmMwLS43NS0uMi0xLjQ1LS41Ni0yLjA2LjA5LjA0LjE3LjA4LjI0LjExLjIuMSA1Ljk4IDIuODYgOC44IDQuMkM0NC40MDkgOC45IDQ0Ljk5OSA5Ljg0IDQ0Ljk5OSAxMC44N3pNNy40OTkgMjYuMDNjMS42IDEuNDYgMy40MyAzLjEzIDUuMzQgNC44NmwtNC42IDMuNWMtLjc3LjU3LTEuNzguNS0yLjU2LS4wNS0uNS0uMzYtMS44OS0xLjY1LTEuODktMS42NS0xLjAxLS44MS0xLjA2LTIuMzItLjExLTMuMTlDMy42NzkgMjkuNSA1LjE3OSAyOC4xMyA3LjQ5OSAyNi4wM3pNMzEuOTk5IDYuMnYxMC4xMWwtNy42MyA1LjgtNi44NS01LjIxYzQuOTgtNC41MyAxMC4wMS05LjExIDEyLjY1LTExLjUyQzMwLjg2OSA0Ljc0IDMxLjk5OSA1LjI1IDMxLjk5OSA2LjJ6TTMyIDQxLjc5OFYzMS42OUw4LjI0IDEzLjYxYy0uNzctLjU3LTEuNzgtLjUtMi41Ni4wNS0uNS4zNi0xLjg5IDEuNjUtMS44OSAxLjY1LTEuMDEuODEtMS4wNiAyLjMyLS4xMSAzLjE5IDAgMCAyMC4xNDUgMTguMzM4IDI2LjQ4NSAyNC4xMTZDMzAuODcxIDQzLjI2IDMyIDQyLjc1MyAzMiA0MS43OTh6Ii8+PC9zdmc+)](https://insiders.vscode.dev/redirect/mcp/install?name=mongodb&inputs=%5B%7B%22id%22%3A%22connection_string%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22MongoDB%20connection%20string%22%7D%5D&config=%7B%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22mongodb-mcp-server%22%2C%22--readOnly%22%5D%2C%22env%22%3A%7B%22MDB_MCP_CONNECTION_STRING%22%3A%22%24%7Binput%3Aconnection_string%7D%22%7D%7D)\n[![Install in Cursor](https://img.shields.io/badge/Cursor-Install_Server-1e1e1e?logo=data:image/svg%2bxml;base64,PHN2ZyBoZWlnaHQ9IjFlbSIgc3R5bGU9ImZsZXg6bm9uZTtsaW5lLWhlaWdodDoxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIxZW0iCiAgICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogICAgPHRpdGxlPkN1cnNvcjwvdGl0bGU+CiAgICA8cGF0aCBkPSJNMTEuOTI1IDI0bDEwLjQyNS02LTEwLjQyNS02TDEuNSAxOGwxMC40MjUgNnoiCiAgICAgICAgZmlsbD0idXJsKCNsb2JlLWljb25zLWN1cnNvcnVuZGVmaW5lZC1maWxsLTApIj48L3BhdGg+CiAgICA8cGF0aCBkPSJNMjIuMzUgMThWNkwxMS45MjUgMHYxMmwxMC40MjUgNnoiIGZpbGw9InVybCgjbG9iZS1pY29ucy1jdXJzb3J1bmRlZmluZWQtZmlsbC0xKSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTExLjkyNSAwTDEuNSA2djEybDEwLjQyNS02VjB6IiBmaWxsPSJ1cmwoI2xvYmUtaWNvbnMtY3Vyc29ydW5kZWZpbmVkLWZpbGwtMikiPjwvcGF0aD4KICAgIDxwYXRoIGQ9Ik0yMi4zNSA2TDExLjkyNSAyNFYxMkwyMi4zNSA2eiIgZmlsbD0iIzU1NSI+PC9wYXRoPgogICAgPHBhdGggZD0iTTIyLjM1IDZsLTEwLjQyNSA2TDEuNSA2aDIwLjg1eiIgZmlsbD0iI2ZmZiI+PC9wYXRoPgogICAgPGRlZnM+CiAgICAgICAgPGxpbmVhckdyYWRpZW50IGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiBpZD0ibG9iZS1pY29ucy1jdXJzb3J1bmRlZmluZWQtZmlsbC0wIgogICAgICAgICAgICB4MT0iMTEuOTI1IiB4Mj0iMTEuOTI1IiB5MT0iMTIiIHkyPSIyNCI+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iLjE2IiBzdG9wLWNvbG9yPSIjZmZmIiBzdG9wLW9wYWNpdHk9Ii4zOSI+PC9zdG9wPgogICAgICAgICAgICA8c3RvcCBvZmZzZXQ9Ii42NTgiIHN0b3AtY29sb3I9IiNmZmYiIHN0b3Atb3BhY2l0eT0iLjgiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImxvYmUtaWNvbnMtY3Vyc29ydW5kZWZpbmVkLWZpbGwtMSIKICAgICAgICAgICAgeDE9IjIyLjM1IiB4Mj0iMTEuOTI1IiB5MT0iNi4wMzciIHkyPSIxMi4xNSI+CiAgICAgICAgICAgIDxzdG9wIG9mZnNldD0iLjE4MiIgc3RvcC1jb2xvcj0iI2ZmZiIgc3RvcC1vcGFjaXR5PSIuMzEiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIuNzE1IiBzdG9wLWNvbG9yPSIjZmZmIiBzdG9wLW9wYWNpdHk9IjAiPjwvc3RvcD4KICAgICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgICAgIDxsaW5lYXJHcmFkaWVudCBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgaWQ9ImxvYmUtaWNvbnMtY3Vyc29ydW5kZWZpbmVkLWZpbGwtMiIKICAgICAgICAgICAgeDE9IjExLjkyNSIgeDI9IjEuNSIgeTE9IjAiIHkyPSIxOCI+CiAgICAgICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNmZmYiIHN0b3Atb3BhY2l0eT0iLjYiPjwvc3RvcD4KICAgICAgICAgICAgPHN0b3Agb2Zmc2V0PSIuNjY3IiBzdG9wLWNvbG9yPSIjZmZmIiBzdG9wLW9wYWNpdHk9Ii4yMiI+PC9zdG9wPgogICAgICAgIDwvbGluZWFyR3JhZGllbnQ+CiAgICA8L2RlZnM+Cjwvc3ZnPgo=)](https://cursor.com/en-US/install-mcp?name=MongoDB&config=eyJjb21tYW5kIjoibnB4IC15IG1vbmdvZGItbWNwLXNlcnZlciAtLXJlYWRPbmx5In0%3D)\n\n# MongoDB MCP Server\n\nA Model Context Protocol server for interacting with MongoDB Databases and MongoDB Atlas.\n\n### Quick Start\n\n#### Using the official MongoDB plugins for AI agents\n\nMongoDB MCP Server comes bundled with the official MongoDB plugins for AI agents. The following plugins are available:\n\n**`mongodb-atlas`** — connects to the MongoDB-hosted Atlas MCP server over OAuth. This does not require you to run anything locally, and is the recommended way to connect to MongoDB Atlas from your AI agent:\n\n- Cursor: [marketplace](https://cursor.com/marketplace/mongodb/mongodb-atlas)\n- VSCode: Open the Extensions view (`⇧⌘X` / `Ctrl+Shift+X`), search for `@agentPlugins`, and install `mongodb-atlas`.\n- Claude: [marketplace](https://claude.com/plugins/mongodb-atlas)\n- Codex: Open `/plugins` and install `mongodb-atlas`.\n- GitHub Copilot CLI: Run `copilot plugin install mongodb-atlas`.\n- Grok: Open `/marketplace` in Grok Build and install `mongodb-atlas`.\n\n**`mongodb`** — runs the MongoDB MCP server locally and connects to any self-managed deployment:\n\n- Cursor: [marketplace](https://cursor.com/marketplace/mongodb/mongodb)\n- Claude: [marketplace](https://claude.com/plugins/mongodb)\n- Gemini: [marketplace](https://geminicli.com/extensions/?name=mongodbagent-skills)\n- Codex: Run `codex plugin marketplace add mongodb/agent-skills`, then open `/plugins` and install `mongodb`.\n- GitHub Copilot CLI: Run `copilot plugin install mongodb`.\n- Grok: Open `/marketplace` in Grok Build and install `mongodb`.\n\n#### Using the setup script\n\nYou can manually set up the local MCP server by running the following command:\n\n```bash\nnpx -y mongodb-mcp-server@latest setup\n```\n\nThis will guide you through an interactive setup process, including configuring your MongoDB connection string or Atlas API credentials.\n\nFor more advanced setup options, see the [Manual Setup](#manual-setup) section below.\n\n#### Using the MongoDB MCP Server setup skill\n\nYou can add and use the MongoDB MCP Server setup skill to configure your local MCP server using an AI agent.\n\n```bash\nnpx skills add https://github.com/mongodb/agent-skills --skill mongodb-mcp-setup\n```\n\n#### Using manual configuration\n\nSee [Manual Setup](#manual-setup) for instructions on how to manually configure the MongoDB MCP Server.\n\n## 📚 Table of Contents\n\n- [🚀 Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Manual Setup](#manual-setup)\n- [🛠️ Supported Tools](#supported-tools)\n  - [MongoDB Atlas Tools](#mongodb-atlas-tools)\n  - [MongoDB Database Tools](#mongodb-database-tools)\n  - [MongoDB Assistant Tools](#mongodb-assistant-tools)\n- [📄 Supported Resources](#supported-resources)\n- [⚙️ Configuration](#configuration)\n  - [Configuration Options](#configuration-options)\n  - [Atlas API Access](#atlas-api-access)\n  - [Configuration Methods](#configuration-methods)\n    - [Environment Variables](#environment-variables)\n    - [Command-Line Arguments](#command-line-arguments)\n    - [MCP Client Configuration](#mcp-configuration-file-examples)\n    - [Proxy Support](#proxy-support)\n- [🚀 Deploy on Public Clouds](#deploy-on-public-clouds)\n  - [Azure Cloud](#azure)\n- [🤝 Contributing](#contributing)\n\n<a name=\"getting-started\"></a>\n\n## Prerequisites\n\n> [!NOTE]\n> Node 20.x support is deprecated and will be removed in a future release. Please upgrade to Node 22.13 or later. See https://nodejs.org/en/blog/migrations/v20-to-v22 for migration details.\n\n- Node.js\n  - At least v22.13.0. Check with `node -v`.\n\n- A MongoDB connection string or Atlas API credentials.\n  - **_Service Accounts Atlas API credentials_** are required to use the Atlas tools. You can create a service account in MongoDB Atlas and use its credentials for authentication. See [Atlas API Access](#atlas-api-access) for more details.\n  - If you have a MongoDB connection string, you can use it directly to connect to your MongoDB instance.\n\n## Manual Setup\n\n> **🔒 Security Recommendation 1:** When using Atlas API credentials, be sure to assign only the minimum required permissions to your service account. See [Atlas API Permissions](#atlas-api-permissions) for details.\n\n> **🔒 Security Recommendation 2:** For enhanced security, we strongly recommend using environment variables to pass sensitive configuration such as connection strings and API credentials instead of command line arguments. Command line arguments can be visible in process lists and logged in various system locations, potentially exposing your secrets. Environment variables provide a more secure way to handle sensitive information.\n\nMost MCP clients require a configuration file to be created or modified to add the MCP server.\n\nNote: The configuration file syntax can be different across clients. Please refer to the following links for the latest expected syntax:\n\n- [Devin AI](https://www.mongodb.com/docs/mcp-server/get-started/?ai-client=devin)\n- [Claude Desktop & Web](https://www.mongodb.com/docs/mcp-server/get-started/?ai-client=claude-desktop-web)\n- [Cursor](https://www.mongodb.com/docs/mcp-server/get-started/?ai-client=cursor)\n- [Codex](https://www.mongodb.com/docs/mcp-server/get-started/?ai-client=codex)\n- [Other AI clients](https://www.mongodb.com/docs/mcp-server/get-started/?ai-client=other)\n\n> **Default Safety Notice:** All examples below include `--readOnly` by default to ensure safe, read-only access to your data. Remove `--readOnly` if you need to enable write operations.\n\n#### Option 1: Connection String\n\nYou can pass your connection string via environment variables, make sure to use a valid username and password.\n\n```json\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongodb-mcp-server@latest\", \"--readOnly\"],\n      \"env\": {\n        \"MDB_MCP_CONNECTION_STRING\": \"mongodb://localhost:27017/myDatabase\"\n      }\n    }\n  }\n}\n```\n\nNOTE: The connection string can be configured to connect to any MongoDB cluster, whether it's a local instance or an Atlas cluster.\n\n#### Option 2: Connect to the MongoDB Atlas-Managed MCP Server\n\nWhen working with MongoDB Atlas, the recommended approach is to install the [`mongodb-atlas` plugin](#using-the-official-mongodb-plugins-for-ai-agents) for your AI agent, which handles OAuth authentication automatically.\n\nFor manual configuration, see the [client-specific instructions](https://www.mongodb.com/docs/mcp-server/get-started/) for setting up the Atlas Remote MCP server with OAuth. Alternatively, you can connect using the [`mongodb-atlas-mcp-remote`](packages/mongodb-atlas-mcp-remote/README.md) package with Service Account credentials — see the [package README](packages/mongodb-atlas-mcp-remote/README.md) for setup instructions.\n\n> **Note:** You cannot authenticate to the remote MongoDB MCP server using a static API key over HTTP. You must either:\n>\n> - Use a client that supports the OAuth flow.\n> - Use the [`mongodb-atlas-mcp-remote`](packages/mongodb-atlas-mcp-remote/README.md) stdio server, which you can authenticate into using the static `MDB_MCP_API_CLIENT_ID` and `MDB_MCP_API_CLIENT_SECRET` environment variables.\n\nTo connect with the `mongodb-atlas-mcp-remote` stdio server using Service Account credentials, add it to your client's MCP configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"mongodb-atlas-mcp-remote\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongodb-atlas-mcp-remote@latest\"],\n      \"env\": {\n        \"MDB_MCP_API_CLIENT_ID\": \"$CLIENT_ID\",\n        \"MDB_MCP_API_CLIENT_SECRET\": \"$SECRET\"\n      }\n    }\n  }\n}\n```\n\n#### Option 3: Atlas API Credentials\n\nUse your Atlas API Service Accounts credentials. Must follow all the steps in [Atlas API Access](#atlas-api-access) section.\n\n```json\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongodb-mcp-server@latest\", \"--readOnly\"],\n      \"env\": {\n        \"MDB_MCP_API_CLIENT_ID\": \"your-atlas-service-accounts-client-id\",\n        \"MDB_MCP_API_CLIENT_SECRET\": \"your-atlas-service-accounts-client-secret\"\n      }\n    }\n  }\n}\n```\n\n#### Option 4: Standalone Service using environment variables and command line arguments\n\nYou can source environment variables defined in a config file or explicitly set them like we do in the example below and run the server via npx.\n\n```shell\n# Set your credentials as environment variables first\nexport MDB_MCP_API_CLIENT_ID=\"your-atlas-service-accounts-client-id\"\nexport MDB_MCP_API_CLIENT_SECRET=\"your-atlas-service-accounts-client-secret\"\n\n# Then start the server\nnpx -y mongodb-mcp-server@latest --readOnly\n```\n\n> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.\n\n- For a complete list of configuration options see [Configuration Options](#configuration-options)\n- To configure your Atlas Service Accounts credentials please refer to [Atlas API Access](#atlas-api-access)\n- Connection String via environment variables in the MCP file [example](#connection-string-with-environment-variables)\n- Atlas API credentials via environment variables in the MCP file [example](#atlas-api-credentials-with-environment-variables)\n\n#### Option 5: Using Docker\n\nYou can run the MongoDB MCP Server in a Docker container, which provides isolation and doesn't require a local Node.js installation.\n\n#### Run with Environment Variables\n\nYou may provide either a MongoDB connection string OR Atlas API credentials:\n\n##### Option A: No configuration\n\n```shell\ndocker run --rm -i \\\n  mongodb/mongodb-mcp-server:latest\n```\n\n##### Option B: With MongoDB connection string\n\n```shell\n# Set your credentials as environment variables first\nexport MDB_MCP_CONNECTION_STRING=\"mongodb+srv://username:password@cluster.mongodb.net/myDatabase\"\n\n# Then start the docker container\ndocker run --rm -i \\\n  -e MDB_MCP_CONNECTION_STRING \\\n  -e MDB_MCP_READ_ONLY=\"true\" \\\n  mongodb/mongodb-mcp-server:latest\n```\n\n> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.\n\n##### Option C: With Atlas API credentials\n\n```shell\n# Set your credentials as environment variables first\nexport MDB_MCP_API_CLIENT_ID=\"your-atlas-service-accounts-client-id\"\nexport MDB_MCP_API_CLIENT_SECRET=\"your-atlas-service-accounts-client-secret\"\n\n# Then start the docker container\ndocker run --rm -i \\\n  -e MDB_MCP_API_CLIENT_ID \\\n  -e MDB_MCP_API_CLIENT_SECRET \\\n  -e MDB_MCP_READ_ONLY=\"true\" \\\n  mongodb/mongodb-mcp-server:latest\n```\n\n> **💡 Platform Note:** The examples above use Unix/Linux/macOS syntax. For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.\n\n##### Docker in MCP Configuration File\n\nWithout options:\n\n```json\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--rm\",\n        \"-e\",\n        \"MDB_MCP_READ_ONLY=true\",\n        \"-i\",\n        \"mongodb/mongodb-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nWith connection string:\n\n```json\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--rm\",\n        \"-i\",\n        \"-e\",\n        \"MDB_MCP_CONNECTION_STRING\",\n        \"-e\",\n        \"MDB_MCP_READ_ONLY=true\",\n        \"mongodb/mongodb-mcp-server:latest\"\n      ],\n      \"env\": {\n        \"MDB_MCP_CONNECTION_STRING\": \"mongodb+srv://username:password@cluster.mongodb.net/myDatabase\"\n      }\n    }\n  }\n}\n```\n\nWith Atlas API credentials:\n\n```json\n{\n  \"mcpServers\": {\n    \"MongoDB\": {\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\",\n        \"--rm\",\n        \"-i\",\n        \"-e\",\n        \"MDB_MCP_READ_ONLY=true\",\n        \"-e\",\n        \"MDB_MCP_API_CLIENT_ID\",\n        \"-e\",\n        \"MDB_MCP_API_CLIENT_SECRET\",\n        \"mongodb/mongodb-mcp-server:latest\"\n      ],\n      \"env\": {\n        \"MDB_MCP_API_CLIENT_ID\": \"your-atlas-service-accounts-client-id\",\n        \"MDB_MCP_API_CLIENT_SECRET\": \"your-atlas-service-accounts-client-secret\"\n      }\n    }\n  }\n}\n```\n\n## 🛠️ Supported Tools\n\n### Tool List\n\n#### MongoDB Database Tools\n\n- `aggregate` - Run an aggregation against a MongoDB collection\n- `aggregate-db` - Run an aggregation against a MongoDB database\n- `collection-indexes` - Describe the indexes for a collection\n- `collection-schema` - Describe the schema for a collection\n- `collection-storage-size` - Gets the size of the collection\n- `connect` - Connect to a MongoDB instance\n- `count` - Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter\n- `create-collection` - Creates a new collection in a database. If the database doesn't exist, it will be created automatically.\n- `create-index` - Create an index for a collection\n- `db-stats` - Returns statistics that reflect the use state of a single database\n- `delete-many` - Removes all documents that match the filter from a MongoDB collection\n- `disconnect` - Close a MongoDB connection and revoke its connectionId.\n- `drop-collection` - Removes a collection or view from the database. The method also removes any indexes associated with the dropped collection.\n- `drop-database` - Removes the specified database, deleting the associated data files\n- `drop-index` - Drop an index for the provided database and collection.\n- `explain` - Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method\n- `export` - Export a query or aggregation results in the specified EJSON format.\n- `find` - Run a find query against a MongoDB collection\n- `insert-many` - Insert an array of documents into a MongoDB collection. If the list of documents is above com.mongodb/maxRequestPayloadBytes, consider inserting them in batches.\n- `list-collections` - List all collections for a given database\n- `list-connections` - List the active MongoDB connections and their connectionIds. Use this to find a connectionId established earlier.\n- `list-databases` - List all databases for a MongoDB connection\n- `mongodb-logs` - Returns the most recent logged mongod events\n- `rename-collection` - Renames a collection in a MongoDB database\n- `update-many` - Updates all documents that match the specified filter for a collection. If the list of documents is above com.mongodb/maxRequestPayloadBytes, consider updating them in batches.\n\n#### MongoDB Atlas Tools\n\n- `atlas-connect-cluster` - Connect to MongoDB Atlas cluster and get back a connectionId to pass to the other MongoDB tools. Each call establishes a new, independent connection — multiple connections can be active at the same time.\n- `atlas-create-access-list` - Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.\n- `atlas-create-cluster` - Create a MongoDB Atlas cluster (M10–M80, replica set or single shard). Compute autoscaling is enabled by default: min instance size is set to the selected instance size, max is set two tiers above. Disk autoscaling is always enabled. Encryption at rest with customer-managed keys (CMK) is supported, the CMK provider must already have a valid encryption at rest configuration in the project. The tool returns immediately, use the atlas-inspect-cluster tool to poll the cluster state for readiness (state: IDLE). Connection strings are unavailable until the cluster reaches IDLE state.\n- `atlas-create-db-user` - Create an MongoDB Atlas database user\n- `atlas-create-free-cluster` - Create a free MongoDB Atlas cluster\n- `atlas-create-project` - Create a MongoDB Atlas project\n- `atlas-get-performance-advisor` - Get MongoDB Atlas performance advisor recommendations and suggestions, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max 50) slow query logs\n- `atlas-get-regions` - List supported MongoDB Atlas regions for a cloud provider.\n- `atlas-inspect-access-list` - Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.\n- `atlas-inspect-cluster` - Inspect metadata of a MongoDB Atlas cluster\n- `atlas-list-alerts` - List triggered alerts for a MongoDB Atlas project. These are alerts Atlas has raised, not the alert configurations that define them. Defaults to OPEN alerts; set status to TRACKING or CLOSED to see others.\n- `atlas-list-clusters` - List MongoDB Atlas clusters\n- `atlas-list-db-users` - List MongoDB Atlas database users\n- `atlas-list-orgs` - List MongoDB Atlas organizations\n- `atlas-list-projects` - List MongoDB Atlas projects.\n- `atlas-load-sample-dataset` - Load a MongoDB sample dataset into an Atlas cluster, or check the status of a previously-initiated load. To start a new load, provide `clusterName` — the load runs asynchronously and the response includes a `jobId` and initial state. To check progress, call this tool again with `jobId` (sample dataset loads typically take 1–5 minutes). State can be WORKING, COMPLETED, or FAILED.\n- `atlas-pause-resume-cluster` - Pause or resume a dedicated (M10+) MongoDB Atlas cluster.\n- `atlas-streams-build` - Create Atlas Stream Processing resources. Use this tool for 'set up a Kafka pipeline', 'create a workspace', 'add a connection', or 'deploy a processor'. Use resource='workspace' to create a new workspace (specify cloud provider, region, and tier). Use resource='connection' to add a data source or sink to an existing workspace. Use resource='processor' to deploy a stream processor with a pipeline. Use resource='privatelink' to set up private networking. Typical workflow: create workspace → add connections → deploy processor.\n- `atlas-streams-discover` - Discover and inspect Atlas Stream Processing resources. Also use for 'why is my processor failing', 'what workspaces do I have', 'show processor stats', or 'check processor health'. Use 'list-workspaces' to see all workspaces in a project. Use inspect actions for details on a specific resource. Use 'diagnose-processor' for a combined health report including state, stats, connection health, and recent errors. Use 'get-networking' for PrivateLink and account details.\n- `atlas-streams-manage` - Manage Atlas Stream Processing resources: start/stop processors, modify pipelines, update configurations. Also use for 'change the pipeline', 'scale up my processor', or 'update my workspace tier'. Common workflow: action='stop-processor' → action='modify-processor' → action='start-processor'. Use `atlas-streams-discover` with action 'inspect-processor' to check state before managing.\n- `atlas-streams-teardown` - Delete Atlas Stream Processing resources. Also use for 'remove my workspace', 'disconnect a source', 'delete all processors', or 'clean up my streams environment'. Performs basic safety checks before deletion: summarizes counts of processors and connections, highlights connections referenced by processors where possible, and surfaces API errors if processors are still running when deletion is attempted. Use `atlas-streams-discover` to review resources before deleting.\n- `atlas-upgrade-cluster` - Upgrade or scale a MongoDB Atlas cluster. Free and Flex clusters can be upgraded to Flex or M10 Dedicated. Dedicated clusters can be scaled to a different instance size, and compute autoscaling settings can be updated. When scaling a Dedicated cluster, at least one of targetTier, computeAutoScaling, minInstanceSize, or maxInstanceSize must be provided. Compute autoscaling defaults to enabled when upgrading to M10 Dedicated: min instance size is set to the selected instance size, max is set two tiers above, unless overridden. Note to LLM: If provider and region are not already known, ask for both together in a single question before calling this tool. Use atlas-get-regions to resolve natural-language locations or uncertain region codes before calling this tool.\n\nNOTE: atlas tools are only available when you set credentials on [configuration](#configuration) section.\n\n#### MongoDB Atlas Local Tools\n\n- `atlas-local-connect-deployment` - Connect to a MongoDB Atlas Local deployment and get back a connectionId to pass to the other MongoDB tools\n- `atlas-local-create-deployment` - Create a MongoDB Atlas local deployment. Default image is preview. When the user does not specify an image tag, inform them that preview is used by default and provide this link for more information: https://hub.docker.com/r/mongodb/mongodb-atlas-local\n- `atlas-local-delete-deployment` - Delete a MongoDB Atlas local deployment\n- `atlas-local-list-deployments` - List MongoDB Atlas local deployments\n\n#### MongoDB Assistant Tools\n\n- `list-knowledge-sources` - List available data sources in the MongoDB Assistant knowledge base. Use this to explore available data sources or to find search filter parameters to use in search-knowledge.\n- `search-knowledge` - Search for information in the MongoDB Assistant knowledge base. This includes official documentation, curated expert guidance, and other resources provided by MongoDB. Supports filtering by data source and version.\n\n## 📄 Supported Resources\n\n- `config` - Server configuration, supplied by the user either as environment variables or as startup arguments with sensitive parameters redacted. The resource can be accessed under URI `config://config`.\n- `debug` - Debugging information for MongoDB connectivity issues. Tracks the last connectivity attempt and error information. The resource can be accessed under URI `debug://mongodb`.\n- `exported-data` - A resource template to access the data exported using the export tool. The template can be accessed under URI `exported-data://{exportName}` where `exportName` is the unique name for an export generated by the export tool.\n\n## Configuration\n\n> **🔒 Security Best Practice:** We strongly recommend using environment variables for sensitive configuration such as API credentials (`MDB_MCP_API_CLIENT_ID`, `MDB_MCP_API_CLIENT_SECRET`) and connection strings (`MDB_MCP_CONNECTION_STRING`) instead of command-line arguments. Environment variables are not visible in process lists and provide better security for your sensitive data.\n\nThe MongoDB MCP Server can be configured using multiple methods, with the following precedence (highest to lowest):\n\n1. Command-line arguments\n2. Environment variables\n3. Configuration File\n\n### Configuration Options\n\n| Environment Variable / CLI Option                                                              | Default                                                                                                                                            | Description                                                                                                                                                                                                                                                                                                                                                                                                           |\n| ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `MDB_MCP_AGGREGATION_COUNT_MAX_TIME_MS_CAP` / `--aggregationCountMaxTimeMsCap`                 | `60000`                                                                                                                                            | The maximum time in milliseconds for the count phase of aggregation operations. This is used to limit the time spent counting documents when determining if results were capped.                                                                                                                                                                                                                                      |\n| `MDB_MCP_ALLOW_REQUEST_OVERRIDES` / `--allowRequestOverrides`                                  | `false`                                                                                                                                            | When set to true, allows configuration values to be overridden via request headers and query parameters.                                                                                                                                                                                                                                                                                                              |\n| `MDB_MCP_API_CLIENT_ID` / `--apiClientId`                                                      | `<not set>`                                                                                                                                        | Atlas API client ID for authentication. Required for running Atlas tools.                                                                                                                                                                                                                                                                                                                                             |\n| `MDB_MCP_API_CLIENT_SECRET` / `--apiClientSecret`                                              | `<not set>`                                                                                                                                        | Atlas API client secret for authentication. Required for running Atlas tools.                                                                                                                                                                                                                                                                                                                                         |\n| `MDB_MCP_ASSISTANT_BASE_URL` / `--assistantBaseUrl`                                            | `\"https://knowledge.mongodb.com/api/v1/\"`                                                                                                          | Base URL for the MongoDB Assistant API.                                                                                                                                                                                                                                                                                                                                                                               |\n| `MDB_MCP_ATLAS_TEMPORARY_DATABASE_USER_LIFETIME_MS` / `--atlasTemporaryDatabaseUserLifetimeMs` | `14400000`                                                                                                                                         | Time in milliseconds that temporary database users created when connecting to MongoDB Atlas clusters will remain active before being automatically deleted.                                                                                                                                                                                                                                                           |\n| `MDB_MCP_CONFIRMATION_REQUIRED_TOOLS` / `--confirmationRequiredTools`                          | `\"atlas-create-access-list,atlas-create-db-user,drop-database,drop-collection,delete-many,drop-index,atlas-streams-manage,atlas-streams-teardown\"` | Comma separated values of tool names that require user confirmation before execution. Requires the client to support elicitation.                                                                                                                                                                                                                                                                                     |\n| `MDB_MCP_CONNECTION_SCOPE` / `--connectionScope`                                               | `\"session\"`                                                                                                                                        | Visibility scope for MongoDB connections created at runtime. With 'session' (the default), each MCP session only sees the connections it created (plus the shared 'preconfigured' one) and they are closed when the session ends — recommended when the HTTP transport is exposed to multiple clients without authentication. With 'global', connections are shared across all sessions and survive session rotation. |\n| `MDB_MCP_CONNECTION_STRING` / `--connectionString`                                             | `<not set>`                                                                                                                                        | MongoDB connection string for direct database connections. Optional, if not set, you'll need to call the connect tool before interacting with MongoDB data.                                                                                                                                                                                                                                                           |\n| `MDB_MCP_DISABLE_SERVER_SIDE_JS` / `--disableServerSideJs`                                     | `true`                                                                                                                                             | When set to true, disallows the use of server-side JavaScript operators (such as $where, $function, and $accumulator) in query filters and aggregation pipelines.                                                                                                                                                                                                                                                     |\n| `MDB_MCP_DISABLED_TOOLS` / `--disabledTools`                                                   | `\"\"`                                                                                                                                               | Comma separated values of tool names, operation types, and/or categories of tools that will be disabled.                                                                                                                                                                                                                                                                                                              |\n| `MDB_MCP_DRY_RUN` / `--dryRun`                                                                 | `false`                                                                                                                                            | When true, runs the server in dry mode: dumps configuration and enabled tools, then exits without starting the server.                                                                                                                                                                                                                                                                                                |\n| `MDB_MCP_ELICITATION_TIMEOUT_MS` / `--elicitationTimeoutMs`                                    | `300000`                                                                                                                                           | Time in milliseconds the user has to respond to an elicitation request (such as a tool confirmation prompt) before it fails.                                                                                                                                                                                                                                                                                          |\n| `MDB_MCP_EXPORT_CLEANUP_INTERVAL_MS` / `--exportCleanupIntervalMs`                             | `120000`                                                                                                                                           | Time in milliseconds between export cleanup cycles that remove expired export files.                                                                                                                                                                                                                                                                                                                                  |\n| `MDB_MCP_EXPORT_TIMEOUT_MS` / `--exportTimeoutMs`                                              | `300000`                                                                                                                                           | Time in milliseconds after which an export is considered expired and eligible for cleanup.                                                                                                                                                                                                                                                                                                                            |\n| `MDB_MCP_EXPORTS_PATH` / `--exportsPath`                                                       | see below\\*                                                                                                                                        | Folder to store exported data files.                                                                                                                                                                                                                                                                                                                                                                                  |\n| `MDB_MCP_EXTERNALLY_MANAGED_SESSIONS` / `--externallyManagedSessions`                          | `false`                                                                                                                                            | When true, the HTTP transport allows requests with a session ID supplied externally through the 'mcp-session-id' header. When an external ID is supplied, the initialization request is optional.                                                                                                                                                                                                                     |\n| `MDB_MCP_HEALTH_CHECK_HOST` / `--healthCheckHost`                                              | `<not set>`                                                                                                                                        | Deprecated. Use `monitoringServerHost` instead. Host address to bind the healthCheck HTTP server to (only used when transport is 'http'). If provided, `healthCheckPort` must also be set.                                                                                                                                                                                                                            |\n| `MDB_MCP_HEALTH_CHECK_PORT` / `--healthCheckPort`                                              | `<not set>`                                                                                                                                        | Deprecated. Use `monitoringServerPort` instead. Port number for the healthCheck HTTP server (only used when transport is 'http'). If provided, `healthCheckHost` must also be set.                                                                                                                                                                                                                                    |\n| `MDB_MCP_HTTP_BODY_LIMIT` / `--httpBodyLimit`                                                  | `102400`                                                                                                                                           | Maximum size of the HTTP request body in bytes (only used when transport is 'http'). This value is passed as the optional limit parameter to the Express.js json() middleware.                                                                                                                                                                                                                                        |\n| `MDB_MCP_HTTP_HEADERS` / `--httpHeaders`                                                       | `\"{}\"`                                                                                                                                             | Header that the HTTP server will validate when making requests (only used when transport is 'http').                                                                                                                                                                                                                                                                                                                  |\n| `MDB_MCP_HTTP_HOST` / `--httpHost`                                                             | `\"127.0.0.1\"`                                                                                                                                      | Host address to bind the HTTP server to (only used when transport is 'http').                                                                                                                                                                                                                                                                                                                                         |\n| `MDB_MCP_HTTP_PORT` / `--httpPort`                                                             | `3000`                                                                                                                                             | Port number for the HTTP server (only used when transport is 'http'). Use 0 for a random port.                                                                                                                                                                                                                                                                                                                        |\n| `MDB_MCP_HTTP_RESPONSE_TYPE` / `--httpResponseType`                                            | `\"sse\"`                                                                                                                                            | The HTTP response type for tool responses: 'sse' for Server-Sent Events, 'json' for standard JSON responses.                                                                                                                                                                                                                                                                                                          |\n| `MDB_MCP_IDLE_TIMEOUT_MS` / `--idleTimeoutMs`                                                  | `600000`                                                                                                                                           | Idle timeout for a client to disconnect (only applies to http transport).                                                                                                                                                                                                                                                                                                                                             |\n| `MDB_MCP_INDEX_CHECK` / `--indexCheck`                                                         | `false`                                                                                                                                            | When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan.                                                                                                                                                                                                                                                                                                 |\n| `MDB_MCP_LOG_PATH` / `--logPath`                                                               | see below\\*                                                                                                                                        | Folder to store logs.                                                                                                                                                                                                                                                                                                                                                                                                 |\n| `MDB_MCP_LOGGERS` / `--loggers`                                                                | `\"disk,mcp\"` see below\\*                                                                                                                           | Comma separated values of logger types.                                                                                                                                                                                                                                                                                                                                                                               |\n| `MDB_MCP_MAX_ACTIVE_CONNECTIONS` / `--maxActiveConnections`                                    | `10`                                                                                                                                               | Maximum number of MongoDB connections a single scope (an MCP session by default, see connectionScope) can hold open. When exceeded, the scope's least-recently-used connection is closed and its connectionId revoked. The preconfigured connection does not count towards the limit.                                                                                                                                 |\n| `MDB_MCP_MAX_BYTES_PER_QUERY` / `--maxBytesPerQuery`                                           | `16777216`                                                                                                                                         | The maximum size in bytes for results from a find or aggregate tool call. This serves as an upper bound for the responseBytesLimit parameter in those tools.                                                                                                                                                                                                                                                          |\n| `MDB_MCP_MAX_DOCUMENTS_PER_QUERY` / `--maxDocumentsPerQuery`                                   | `100`                                                                                                                                              | The maximum number of documents that can be returned by a find or aggregate tool call. For the find tool, the effective limit will be the smaller of this value and the tool's limit parameter.                                                                                                                                                                                                                       |\n| `MDB_MCP_MAX_SESSIONS` / `--maxSessions`                                                       | `1000`                                                                                                                                             | Maximum number of concurrent sessions the HTTP transport will hold in memory (only used when transport is 'http'). Each session holds a full server instance, transport, and timers, so choose a value based on your deployment's available memory; the default is a conservative safety net rather than a recommended production value.                                                                              |\n| `MDB_MCP_MAX_TIME_M_S` / `--maxTimeMS`                                                         | `<not set>`                                                                                                                                        | The maximum time in milliseconds that operations are allowed to run on the MongoDB server. When set, this value is passed as the maxTimeMS option to read operations such as find, aggregate, and count.                                                                                                                                                                                                              |\n| `MDB_MCP_MCP_CLIENT_LOG_LEVEL` / `--mcpClientLogLevel`                                         | `\"debug\"`                                                                                                                                          | Minimum severity level for log messages forwarded to the MCP client.                                                                                                                                                                                                                                                                                                                                                  |\n| `MDB_MCP_MONITORING_SERVER_FEATURES` / `--monitoringServerFeatures`                            | `\"health-check\"`                                                                                                                                   | Features to expose on the monitoring server (only used when transport is 'http' and monitoringServerHost/monitoringServerPort are set).                                                                                                                                                                                                                                                                               |\n| `MDB_MCP_MONITORING_SERVER_HOST` / `--monitoringServerHost`                                    | `<not set>`                                                                                                                                        | Host address to bind the monitoring HTTP server to (only used when transport is 'http'). If provided, `monitoringServerPort` must also be set.                                                                                                                                                                                                                                                                        |\n| `MDB_MCP_MONITORING_SERVER_PORT` / `--monitoringServerPort`                                    | `<not set>`                                                                                                                                        | Port number for the monitoring HTTP server (only used when transport is 'http'). If provided, `monitoringServerHost` must also be set.                                                                                                                                                                                                                                                                                |\n| `MDB_MCP_NOTIFICATION_TIMEOUT_MS` / `--notificationTimeoutMs`                                  | `540000`                                                                                                                                           | Notification timeout for a client to be aware of disconnect (only applies to http transport).                                                                                                                                                                                                                                                                                                                         |\n| `MDB_MCP_PREVIEW_FEATURES` / `--previewFeatures`                                               | `\"\"`                                                                                                                                               | Comma separated values of preview features that are enabled.                                                                                                                                                                                                                                                                                                                                                          |\n| `MDB_MCP_QUERY_COUNT_MAX_TIME_MS_CAP` / `--queryCountMaxTimeMsCap`                             | `10000`                                                                                                                                            | The maximum time in milliseconds for the count phase of find operations. This is used to limit the time spent counting documents when determining if results were capped.                                                                                                                                                                                                                                             |\n| `MDB_MCP_READ_ONLY` / `--readOnly`                                                             | `false`                                                                                                                                            | When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations.                                                                                                                                                                                                                                                                                                 |\n| `MDB_MCP_TELEMETRY` / `--telemetry`                                                            | `\"enabled\"`                                                                                                                                        | When set to disabled, disables telemetry collection.                                                                                                                                                                                                                                                                                                                                                                  |\n| `MDB_MCP_TRANSPORT` / `--transport`                                                            | `\"stdio\"`                                                                                                                                          | Either 'stdio' or 'http'.                                                                                                                                                                                                                                                                                                                                                                                             |\n| `MDB_MCP_VOYAGE_API_KEY` / `--voyageApiKey`                                                    | `\"\"`                                                                                                                                               | API key for Voyage AI embeddings service (required for creating Atlas Local deployments with auto-embed vector search capabilities).                                                                                                                                                                                                                                                                                  |\n\n#### Logger Options\n\nThe `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:\n\n- `mcp`: Sends logs to the MCP client (if supported by the client/transport).\n- `disk`: Writes logs to disk files. Log files are stored in the log path (see `logPath` above).\n- `stderr`: Outputs logs to standard error (stderr), useful for debugging or when running in containers.\n\n**Default:** `disk,mcp` (logs are written to disk and sent to the MCP client).\n\nYou can combine multiple loggers, e.g. `--loggers disk stderr` or `export MDB_MCP_LOGGERS=\"mcp,stderr\"`.\n\n##### Example: Set logger via environment variable\n\n```shell\nexport MDB_MCP_LOGGERS=\"disk,stderr\"\n```\n\n> **💡 Platform Note:** For Windows users, see [Environment Variables](#environment-variables) for platform-specific instructions.\n\n##### Example: Set logger via command-line argument\n\n```shell\nnpx -y mongodb-mcp-server@latest --loggers mcp stderr\n```\n\n##### Log File Location\n\nWhen using the `disk` logger, log files are stored in:\n\n- **Windows:** `%LOCALAPPDATA%\\mongodb\\mongodb-mcp\\.app-logs`\n- **macOS/Linux:** `~/.mongodb/mongodb-mcp/.app-logs`\n\nYou can override the log directory with the `logPath` option.\n\n> **🔒 Security Guideline:** The user account running the MCP server must have both read and write permissions to the `logPath` directory. Ensure this directory is properly secured with appropriate file system permissions to prevent unauthorized access to log files.\n\n#### Disabled Tools\n\nYou can disable specific tools or categories of tools by using the `disabledTools` option. This option accepts an array of strings,\nwhere each string can be a tool name, operation type, or category.\n\nThe way the array is constructed depends on the type of configuration method you use:\n\n- For **environment variable** configuration, use a comma-separated string: `export MDB_MCP_DISABLED_TOOLS=\"create,update,delete,atlas,collectionSchema\"`.\n- For **command-line argument** configuration, use a space-separated string: `--disabledTools create update delete atlas collectionSchema`.\n\nCategories of tools:\n\n- `atlas` - MongoDB Atlas tools, such as list clusters, create cluster, etc.\n- `mongodb` - MongoDB database tools, such as find, aggregate, etc.\n\nOperation types:\n\n- `create` - Tools that create resources, such as create cluster, insert document, etc.\n- `update` - Tools that update resources, such as update document, rename collection, etc.\n- `delete` - Tools that delete resources, such as delete document, drop collection, etc.\n- `read` - Tools that read resources, such as find, aggregate, list clusters, etc.\n- `metadata` - Tools that read metadata, such as list databases/collections/indexes, infer collection schema, etc.\n- `connect` - Tools that allow you to connect or switch the connection to a MongoDB instance. If this is disabled, you will need to provide a connection string through the config when starting the server.\n\n#### Require Confirmation\n\nIf your client supports [elicitation](https://modelcontextprotocol.io/specification/draft/client/elicitation), you can set the MongoDB MCP server to request user confirmation before executing certain tools.\n\nWhen a tool is marked as requiring confirmation, the server will send an elicitation request to the client. The client with elicitation support will then prompt the user for confirmation and send the response back to the server. If the client does not support elicitation, the tool will execute without confirmation.\n\nYou can set the `confirmationRequiredTools` configuration option",
  "bytes": 60000,
  "sha": "536b4717a8ffd4c9892325c0c3ba8a43d7d4ed4add38f13f0379b37beaecb878",
  "repo_slug": "mongodb-js/mongodb-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_mongodb_js_mongodb_mcp_server_4aa0a6a0/readme"
}