# MongoDB MCP Server

> MongoDB's official MCP server for querying databases and managing Atlas clusters from AI agents.

## Facts
- **Category:** [MCP Servers](https://agentsearchengine.app/category/mcp-servers)
- **Type:** MCP server
- **Pricing:** Open source
- **GitHub stars:** 1,138
- **Language:** TypeScript
- **License:** Apache-2.0
- **Last repo activity:** today (Sep 22, 2026)
- **Official site:** https://github.com/mongodb-js/mongodb-mcp-server
- **Source code:** https://github.com/mongodb-js/mongodb-mcp-server
- **Listing on Agent Search Engine:** https://agentsearchengine.app/agents/mongodb-mcp-server
- **Data verified:** September 2026

## Best for
Exploring collections, writing queries and managing Atlas from an AI coding assistant.

## About MongoDB MCP Server
MongoDB's official MCP server connects AI agents to MongoDB databases and MongoDB Atlas. It runs locally against any self-managed deployment, optionally in read-only mode, and ships in official MongoDB plugins for Cursor, VS Code, Claude, Codex and GitHub Copilot CLI; MongoDB recommends its hosted Atlas MCP server over OAuth for Atlas users.

## Connect to an MCP client
Launch command from the project's README: `MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase npx -y mongodb-mcp-server@latest --readOnly`

### Claude Code (Run in your terminal)

```shell
claude mcp add mongodb-mcp-server -e MDB_MCP_CONNECTION_STRING=mongodb://localhost:27017/myDatabase -- npx -y mongodb-mcp-server@latest --readOnly
```

### Cursor (~/.cursor/mcp.json or .cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

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

### Claude Desktop (claude_desktop_config.json)

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

### Codex (~/.codex/config.toml)

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

## Alternatives
MongoDB MCP Server sits in mcp servers. Related tools indexed here:
- [MCP Reference Servers](https://agentsearchengine.app/agents/mcp-reference-servers) — The MCP steering group's reference servers: Everything, Fetch, Filesystem, Git, Memory, Sequential Thinking and Time. · Open source · MCP server · 91k★ · TypeScript · MIT AND Apache-2.0 · active today
- [context7](https://agentsearchengine.app/agents/context7) — Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors · Open source · MCP server · 62k★ · TypeScript · MIT · active today
- [chrome-devtools-mcp](https://agentsearchengine.app/agents/chrome-devtools-mcp) — Chrome DevTools for coding agents · Open source · MCP server · 53k★ · TypeScript · Apache-2.0 · active today
- [Playwright MCP](https://agentsearchengine.app/agents/playwright-mcp) — Expose Playwright browser tools to MCP clients using accessibility snapshots. · Open source · MCP server · 37k★ · TypeScript · Apache-2.0 · active 4 days ago
- [github-mcp-server](https://agentsearchengine.app/agents/github-mcp-server) — GitHub's official MCP Server · Open source · MCP server · 33k★ · Go · MIT · active today
- [serena](https://agentsearchengine.app/agents/serena) — A powerful MCP toolkit for coding, providing semantic retrieval and editing capabilities - the IDE for your agent · Open source · SDK / library · 30k★ · Python · MIT · active today
- [MCP for Blender (blender-mcp)](https://agentsearchengine.app/agents/blender-mcp) — Connect Blender to Claude or any LLM client for prompt-driven 3D modelling and scene editing. · Open source · MCP server · 29k★ · Python · MIT · active 2 days ago
- [fastmcp](https://agentsearchengine.app/agents/fastmcp) — The fast, Pythonic way to build MCP servers and clients. · Open source · SDK / library · 28k★ · Python · Apache-2.0 · active today

---
Source: [Agent Search Engine](https://agentsearchengine.app) — an independent, hand-curated index of AI agents, MCP servers, and frameworks. Rankings are never sold; sponsored placements are labeled and never numbered. Full directory: https://agentsearchengine.app/llms-full.txt
