Skip to content
OwnlyPlans

MCP server

MongoDB MCP Server

Official server that lets your AI query MongoDB databases and Atlas clusters, inspect collections and indexes, with a read-only mode for safety.

Remix

Use it with Claude or any AI tool. Copy the prompt and paste it in. The link inside gives the AI the whole page as Markdown.

Markdown

Install

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

Adds the server to Claude Code. For other apps, copy the config below.

About

The official MongoDB server connects your AI tool to a database or an Atlas cluster. It can list collections, read schemas and indexes, run queries and aggregations, and help you design better queries.

Start with the –readOnly flag so the AI can look but not change anything. Use a connection string for a development database, not production, until you trust the setup.

Files and links

  • MongoDB MCP Server config MCP config Add this to your MCP client's config, or use the install line.

    Check it before you connect it. This server runs with your permissions: npx -y mongodb-mcp-server@latest --readOnly It needs MDB_MCP_CONNECTION_STRING. Use your own and never share them.

    Claude Code
    claude mcp add-json mongodb '{"command":"npx","args":["-y","mongodb-mcp-server@latest","--readOnly"],"env":{"MDB_MCP_CONNECTION_STRING":"mongodb://localhost:27017/myDatabase"}}'

Your AI tool
Starter prompt

		

Download the plan