AITeamGuide

AITeamGuide Hub · MCP server

MongoDB MCP Server

MongoDB's official MCP server for querying and managing MongoDB databases and Atlas clusters.

MCP server★ 1.2k starsApache-2.0Software developmentOps & IT

View on GitHub

Short answer: how to install MongoDB MCP Server

MongoDB MCP Server is an Apache-2.0-licensed, open-source MCP server on GitHub (mongodb-js/mongodb-mcp-server) with 1,168 stars as of December 2, 2026. Its last push was on December 2, 2026. To install it in Claude Code, run claude mcp add --transport stdio mongodb --env MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly. Replace the placeholder API keys or tokens with your own. It works with Any MCP client, Claude Code, Cursor, VS Code; steps for each are below.

Key facts

Type
MCP server
Jobs it fits
Query and manage a database
Fields
Software development, Ops & IT
Works with
Any MCP client, Claude Code, Cursor, VS Code
GitHub
mongodb-js/mongodb-mcp-server
Licence
Apache-2.0
Stars
1,168 as of December 2, 2026
Last updated
December 2, 2026 (last push to GitHub)
Author
@mongodb-js
Submitted by
@aiteamguide
Added to the Hub
October 21, 2026

Install / Use it

Apache-2.0Local MCP server

Download ZIP View source

Cursor

Add to Cursor

Replace the placeholder values (API keys, tokens) with your own after adding it.

Or paste into ~/.cursor/mcp.json

{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}

Claude Code

Run in your terminal

claude mcp add --transport stdio mongodb --env MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly

Replace the placeholder values (API keys, tokens) with your own after adding it.

Claude Desktop

Add to claude_desktop_config.json (Settings → Developer → Edit Config), then restart Claude

{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mongodb-mcp-server@latest",
        "--readOnly"
      ],
      "env": {
        "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase"
      }
    }
  }
}

Replace the placeholder values (API keys, tokens) with your own after adding it.

VS Code

Add to VS Code

Replace the placeholder values (API keys, tokens) with your own after adding it.

Or from the command line

code --add-mcp '{"name":"mongodb","type":"stdio","command":"npx","args":["-y","mongodb-mcp-server@latest","--readOnly"],"env":{"MDB_MCP_CONNECTION_STRING":"mongodb://localhost:27017/myDatabase"}}'

Codex

Run in your terminal

codex mcp add mongodb --env MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly

Replace the placeholder values (API keys, tokens) with your own after adding it.

Safety: Runs code from a third-party repo. Review the source and the permissions before installing.

Commands and configs are taken from the project's README and re-wrapped in each app's documented format. If they differ, the README wins.

How to add MCP servers in your app, step by step: Claude Code · Cursor · VS Code · Claude Desktop · Codex · Gemini CLI · Copilot CLI · OpenCode · Cline · Roo Code · Kilo Code · Zed · LM Studio · Antigravity · Windsurf · Hermes Agent · ChatGPT.

FAQ

How do I add MongoDB MCP Server to Claude Code?

Run claude mcp add --transport stdio mongodb --env MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly in your terminal.

How do I add MongoDB MCP Server to Codex?

Run codex mcp add mongodb --env MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly in your terminal.

How do I add MongoDB MCP Server to Cursor?

Use the Add to Cursor button in the install panel on this page, or paste this entry under mcpServers in ~/.cursor/mcp.json: {"mongodb":{"command":"npx","args":["-y","mongodb-mcp-server@latest","--readOnly"],"env":{"MDB_MCP_CONNECTION_STRING":"mongodb://localhost:27017/myDatabase"}}}.

Does MongoDB MCP Server need an API key?

Yes. The README's setup passes MDB_MCP_CONNECTION_STRING as environment variable; replace the placeholder value with your own.

Is MongoDB MCP Server free?

The code is open source under the Apache-2.0 licence, so it's free to use. Any account or API key the connected service needs is billed by that service, not by the project; see the README.

Is MongoDB MCP Server still maintained?

Its last push to GitHub was on December 2, 2026, and it had 1,168 stars as of December 2, 2026. We re-check GitHub daily.

Prefer a ready-made product?

Commercial agents for the same job, with real prices: all coding agents.

Get new open-source AI tools like MongoDB MCP Server in one weekly email

One email a week: new open-source agents, skills, MCP servers and playbooks from the Hub, plus AI agent price changes and new free plans. Free; unsubscribe anytime.

Free, no signup needed: the AI agent pricing cheat sheet, the cheapest listed plan for every job on one printable page.

The pricing cheat sheet is a free page on this site (no signup needed). Not sure yet? Read the latest issue first.

More from the Hub

Summary written by AITeamGuide in our own words. GitHub numbers come from the public GitHub API and refresh daily. Maintainer and want a correction or removal? Tell us. Got something similar? Submit it to the Hub.

Featured in our guide: Best MCP servers for coding.