🗄️ MongoDB MCP Server for LLMS
MCP server that provide tools to LLMs such as claude in cursor to interact with MongoDB
Overview
MongoDB MCP Server is a Model Context Protocol (MCP) server that connects to MongoDB and provides tools for interacting with MongoDB collections through Large Language Models like Claude in Cursor.
To use the MongoDB MCP Server, clone the repository, install dependencies, configure your MongoDB connection, and run the server script. Then, set it up in Cursor to start using MongoDB tools.
- Collection Schema Resources: View the schema of any MongoDB collection. - Aggregation Query Tool: Run read-only aggregation queries on MongoDB collections. - Data Analysis Prompts: Pre-built prompts for common data analysis tasks.
- Analyzing data trends in MongoDB collections.
- Running aggregation queries to summarize data.
- Accessing MongoDB collection schemas for better understanding of data structure.
Add to your AI client
Use these steps to connect 🗄️ MongoDB MCP Server for LLMS in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"mongo-mcp-1rb": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"mongo-mcp-1rb": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mongo-mcp-1rb": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mongo-mcp-1rb": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mongo-mcp-1rb": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mongo-mcp-1rb": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mongo-mcp-1rb"
]
}
}
}FAQ
Can I use MongoDB MCP Server with any MongoDB database?
Yes! It works with both local and MongoDB Atlas databases.
Is there a specific version of Node.js required?
Yes, Node.js v14+ is required, with v16+ recommended.
What kind of queries can I run?
You can run read-only aggregation queries and analyze data using pre-built prompts.