MongoDB has two official MCP servers. The Atlas MCP server is hosted by MongoDB and works as a plugin in Claude and ChatGPT. The local MCP server runs on your computer and works with any MongoDB, including self-managed. Connected, the AI can query collections, run aggregations, infer schemas, list and explain indexes, and, if you let it, change data. This guide covers both, what limits them, how to connect, and what changes when a backend team shares a database.
MCP (Model Context Protocol) is an open standard for plugging AI assistants into other apps. Claude and ChatGPT are a great fit for one person's questions. BlueNexus is for when the database is shared work.
For a developer or analyst asking about one database.
For someone who works in ChatGPT, on Atlas.
For a backend team sharing a database with data and on-call.
Two servers, and which to use
- Atlas MCP server, hosted. No install. An Organization Owner turns on AI access for the organization, sets it to Read or Read and write, and each person signs in with their own Atlas account. It works only with Atlas clusters.
- Local MCP server. Runs on your computer with a connection string, and works with Atlas, Community and Enterprise. You choose read-only, which tools to turn off, and whether to reject queries that scan a whole collection.
Three things are worth knowing:
- On Atlas, it acts as you. The AI gets the stricter of your Atlas role and the organization's access mode. There are no per-project or per-cluster limits for AI clients.
- Read tools can write. An aggregation pipeline with
$outor$mergewrites data, even though aggregation counts as a read. Read mode or a read-only role stops it. - Confirmations depend on the app. The local server asks before dropping or bulk-deleting, but only in AI apps that support those prompts.
What MongoDB's MCP servers let an AI do
- Atlas AI access is usually off until an owner turns it on
- On Atlas, the AI can't go beyond your Atlas role or the access mode
- Some pipelines write, even from read tools
- ChatGPT doesn't support self-managed MongoDB
Connect MongoDB to Claude or ChatGPT
On Atlas, both start with an owner turning on AI access.
Connect MongoDB to Claude
10 minA good fit if your database runs on Atlas.
- 1An Atlas Organization Owner turns on AI access under Org Settings, then App Connections, and picks Read as the access mode.
- 2In Claude, open Customize, then Connectors, and find MongoDB Atlas.
- 3Click Connect and sign in to Atlas.
- 4Ask a question first, like which fields the orders collection has.
For self-managed MongoDB, run MongoDB's local MCP server in Claude Desktop or Claude Code, with --readOnly and a read-only database user.
Connect MongoDB to ChatGPT
10 minA good fit if your database runs on Atlas.
- 1An Atlas Organization Owner turns on AI access, as for Claude.
- 2In ChatGPT, open Plugins, find MongoDB Atlas and install it.
- 3Sign in to Atlas.
- 4Ask which collections hold orders.
MongoDB's docs say ChatGPT doesn't support self-managed MongoDB. Use Atlas, or a tool that runs the local server.
For developers
The local server runs with npx on Node 22.13 or later. Put the connection string in MDB_MCP_CONNECTION_STRING, not in a prompt, so the model never sees it. --readOnly registers only read tools, --disabledTools removes tools or whole categories, and --indexCheck rejects queries that would scan a collection. Atlas tools need a service account, and MongoDB advises project roles, not Organization Owner.
Who can do what
- A user of its own. MongoDB recommends a dedicated database user with the built-in
readrole, and never credentials with write access, for production. - Read mode on Atlas. Set the organization's AI access mode to Read unless people need changes.
- Keep it off the primary. Send heavy AI reads to a secondary or an analytics node, and set time limits.
- Text in documents is untrusted. A support note or product description can contain instructions. Keep secrets out of reach.
When it doesn't work
- The plugin can't connect. AI access is off for the Atlas organization. An owner turns it on.
- ChatGPT can't reach your database. It's self-managed. Use Atlas, or the local server in another app.
- A query is rejected.
--indexCheckblocked a collection scan. Add an index, or narrow the query. - Atlas tools return errors. The service account doesn't have that permission. The server doesn't hide tools it can't use.
With a team: MongoDB in BlueNexus
In Claude or ChatGPT, each person connects with their own access. That suits one developer. In a growing company, backend engineers change the schema, analysts build dashboards on it, and on-call needs to know which queries will scan a collection before they ship.
BlueNexus is a shared AI workspace where people and AI agents work in the same projects, channels and tasks. The BlueNexus MongoDB connector, our own integration, has 18 tools, 12 that read and 6 that act, for searching collections, querying data and exploring schemas in any MongoDB database. Every change, and every post, waits for a person in Needs you.
Open Add a connector, search for MongoDB, click Connect and follow the steps.
- All
- AI
- Analytics
- Communication
- Finance
- Marketing
- Productivity
- Sales
- Social
Connect to any MongoDB database to search collections, query data, and explore schemas.
Illustration of the BlueNexus app with example data.
At Sparrowhawk, a 45-person grocery delivery app in Nashville, Drew, the data analyst, asks the schema agent how many orders this week used a promo code, by city. The plan waits in Needs you.
The agent noticed promo codes are stored under two field names, and counted both. Fixing the field stays with the backend team.
Drew asked the schema agent how many orders this week used a promo code, by city. From MongoDB, the orders collection. Nothing is posted until Drew approves it.
- Read the orders collection's fieldsPromo codes are stored as promoCode and promo_code
- Run one aggregation that counts both field namesWith a time limit
- Post the result in the data channel for DrewOrders with a promo code by city, with the pipeline
- Fix the field nameLeft unticked: Sasha's team decides in the next release
Illustration of the BlueNexus app with example data.
For schemas, see how to find schema drift in MongoDB. For releases, see a MongoDB index review before every release.
Which way fits you
If you're on Atlas, ask an owner to turn on AI access in Read mode, then add MongoDB Atlas to Claude or ChatGPT. If you run MongoDB yourself, use the local server with --readOnly and a read-only user.
If the database is shared work, across backend, data and on-call, you'll get more from one shared space than from several private chats. That's what BlueNexus is built for, and you can sign up for BlueNexus to bring your team in.