Skip to main content
MCP server CX Codex

MongoDB — Claude Code MCP server: what it does, how to install

An MCP server that connects your coding agent to MongoDB databases and Atlas, so it can read schemas, run queries and open documents while you work.

Apache-2.0 ★ 1,163 updated 2026-10-23

Open on GitHub

What MongoDB does

Connect the agent to a deployment and it can read a collection's schema, run a query, look up a document. Tool sets cover Atlas and the database itself, and there are assistant tools alongside.

The fast path is npx -y mongodb-mcp-server@latest setup: it asks for the connection string or Atlas API credentials, then walks you through the rest. An agent can do the same job with the setup skill, added through npx skills add https://github.com/mongodb/agent-skills --skill mongodb-mcp-setup. Two official plugins split the cases. mongodb runs the server locally against your own deployment; mongodb-atlas talks to the hosted Atlas server over OAuth and starts nothing on your machine.

The connection string lives in MDB_MCP_CONNECTION_STRING. Add --readOnly before pointing this at a live database, because that mode turns writes off. Atlas tools also need Atlas API credentials.

What it helps with

  • inspect a collection's shape before touching the code
  • run a query without leaving the agent chat
  • track down a document a filter keeps missing
  • set up the server with the interactive wizard
  • reach Atlas from the agent with nothing running locally

Example prompts for the agent

  • Show me the schema of the orders collection and list documents missing status.
  • Run a read-only count of users created this month.
  • Install the mongodb-mcp-setup skill and wire up the local server for this project.

How to install MongoDB

Install

The MCP registry has no launch command for it: see the repository README

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about MongoDB

How do I install the MongoDB MCP server in Claude Code?

Run npx -y mongodb-mcp-server@latest setup. The wizard walks you through setup and asks for a MongoDB connection string or your Atlas API credentials.

What does the MongoDB MCP server do?

It gives your agent tools for schemas, queries and documents in a MongoDB deployment, with a separate set for Atlas and a group of assistant tools.

What is the difference between mongodb and mongodb-atlas?

mongodb-atlas uses OAuth against the hosted Atlas server, so nothing runs on your machine. mongodb starts the server locally for a self-managed deployment.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open