MCP ServerSTDIO

MongoDB MCP Server

The official MongoDB MCP server, maintained by MongoDB, Inc., connects AI models directly to your MongoDB databases. Query documents, run aggregation pipelines, inspect collection schemas and manage indexes — all through plain English. Works with MongoDB Atlas, self-hosted clusters and local instances.

Hosted URL

Bring your own

Suggested model

Claude Sonnet 4.5

MCP Playground runs 30+ models on the same workflow: switch anytime, or use Compare mode to run several in parallel and balance quality vs. cost.

Auth

MongoDB connection URI (mongodb:// or mongodb+srv://). Supports Atlas, replica sets and local instances. Use a read-only user for safety.

What the MongoDB MCP server does

How models use it and what it is built for.

MongoDB MCP wraps the MongoDB Node.js driver as a set of MCP tools. Models can list databases and collections, query documents with filter expressions derived from natural language, run aggregation pipelines for analytics, insert or update documents (with confirmation), inspect indexes, and describe collection schemas by sampling documents. It runs as a local stdio process configured with your connection URI — no cloud account required beyond your existing MongoDB setup. The server is open source under the Apache 2.0 license and published on npm as @mongodb-js/mongodb-mcp-server.

Tools the MongoDB MCP server exposes

Typical tools an AI model can call. Exact names vary by version.

  • find — query documents by filter, projection and sort
  • aggregate — run multi-stage aggregation pipelines
  • insertOne / insertMany — insert documents with confirmation
  • updateOne / updateMany — update documents matching a filter
  • listCollections / listDatabases — enumerate databases and collections
  • createIndex / listIndexes — manage and inspect collection indexes

Example prompts to try

Copy any of these into MCP Agent Studio after connecting.

  • List all collections in the production database and their document counts.

  • Find the 10 most recent orders with status "pending" and total > $500.

  • Run an aggregation to show total revenue by product category for this month.

  • Show me the schema of the "users" collection by sampling 20 documents.

Models on MCP Playground

This is not a single-model product: you get the same MCP connection with 30+ models (Claude, GPT, Gemini, DeepSeek, open-weight, and more), you can switch mid-conversation, and you can open Compare mode to run the same prompt against multiple models at once. The card above is a suggested starting point for this server — not the only choice.

Default pick for MongoDB

Claude Sonnet 4.5

Claude Sonnet 4.5 generates correct aggregation pipelines and multi-step query logic reliably. Use Haiku for simple find queries to keep costs low.

Try the MongoDB MCP server in your browser

Open MCP Agent Studio with the connection pre-filled. Add your token, pick any of 30+ models, and start chatting — no install required.

Open Agent Studio

MongoDB MCP server — FAQ

Common questions about connecting, scoping and using it safely.

What is the MongoDB MCP server?

It is an official open-source MCP server from MongoDB, Inc. that lets AI models query and manage MongoDB databases through natural language. You give it a connection URI and it exposes find, aggregate, insert, update and schema-inspection tools to any MCP-compatible AI client.

Does it work with MongoDB Atlas?

Yes. Paste your Atlas connection string (mongodb+srv://...) as the connection URI. It also works with self-hosted replica sets, standalone instances and local development servers on mongodb://localhost:27017.

Is it safe to connect a production database?

Create a dedicated read-only MongoDB user and scope it to only the databases the agent needs. Never use an admin or atlas admin credential. For extra safety, point the agent at a staging replica during initial setup.

Can the AI agent modify my data?

Yes — insertOne, updateOne and deleteOne tools are available. The server asks for confirmation before writes, and you can restrict it to a read-only user at the database level to make mutation impossible.

How does MongoDB MCP compare to the Postgres MCP server?

MongoDB MCP speaks the MongoDB query language (BSON filters, aggregation pipelines) while Postgres MCP generates SQL. Both let AI models query your data in natural language — choose based on which database your application uses.

Other MCP servers

More on MCP Playground