Updated April 2026

Install MongoDB MCP Server

Pick your client, copy the command, done.

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add -e "MDB_MCP_CONNECTION_STRING=${MDB_MCP_CONNECTION_STRING}" mongodb-mcp -- npx -y mongodb-mcp-server
Required:MDB_MCP_CONNECTION_STRING+ 1 optional

Environment Variables

Set these before running MongoDB MCP Server.

VariableDescriptionRequired
MDB_MCP_CONNECTION_STRINGThe MongoDB connection string for database accessYes
MDB_MCP_ATLAS_API_KEYAPI key for MongoDB Atlas managementNo

Available Tools (2)

Once configured, MongoDB MCP Server gives your AI agent access to:

mongodb_queryExecute queries against a MongoDB database
connection_stringdatabasecollectionfilterlimit
mongodb_atlas_list_clustersList MongoDB Atlas clusters
api_keyapi_secretproject_id

Try It Out

After setup, try these prompts with your AI agent:

Query the 'users' collection in the 'production' database to find all active accounts.
List all my MongoDB Atlas clusters and their current status.
Find the document in the 'logs' collection where the error code is 500.
Count the number of documents in the 'orders' collection created in the last 24 hours.
Prerequisites & system requirements
  • An MCP-compatible client (Claude Code, Cursor, Windsurf, Claude Desktop, or Codex)
  • Node.js 18+ with npm/npx installed
  • MDB_MCP_CONNECTION_STRING — The MongoDB connection string for database access

Keep this setup from going cold

Save the docs, env vars, and workflow around MongoDB MCP Server in Conare so Claude Code, Codex, and Cursor remember it next time.

Need the legacy visual installer? Open Conare IDE.
Remember this setup