Mongo MCP Server
The MongoDB MCP Server enables Claude Code to access and manage MongoDB databases through natural language commands. It provides:
Core Database Operations:
User Management: Find master users by platform ID, email, account ID, or user ID with case-insensitive search
Invoice Management: Search and retrieve invoices by account ID or invoice ID
Connection Health: Check MongoDB connection status and health
Key Features:
Flexible configuration via command-line arguments, environment variables, config files, or .mcp.json
Graceful error handling when database is unavailable
Cross-platform compatibility with local and remote MongoDB instances
Multiple installation options (mcp add, npm, GitHub, or local clone)
Provides basic connectivity and health check capabilities for MongoDB databases, allowing verification of database connection status, version, and uptime
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mongo MCP Serverfind master user by email john.doe@example.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MongoDB MCP Server
A Model Context Protocol (MCP) server that provides MongoDB database access for Claude Code. This server allows you to query MongoDB databases directly from Claude with configurable connection parameters.
Features
Master User Management: Find users by platform ID, email, account ID, or user ID
Invoice Management: Search and retrieve invoices by account ID or invoice ID
Connection Health: Check MongoDB connection status and health
Flexible Configuration: Support for command-line arguments, environment variables, and config files
Error Handling: Graceful fallback when database is unavailable
Installation
Option 1: Using mcp add (Recommended)
cd your-project-directory
mcp add https://github.com/sergei-tofu-fedorov/mongo_mcp.gitThen edit the generated .mcp.json to add your connection parameters:
{
"mcpServers": {
"mongo_mcp": {
"command": "npx",
"args": [
"mongo-mcp-server",
"--uri", "mongodb://your-host:27017",
"--db", "your-database-name"
]
}
}
}Option 2: Install from npm (coming soon)
npm install -g mongo-mcp-serverOption 3: Install from GitHub
npm install -g git+https://github.com/sergei-tofu-fedorov/mongo_mcp.gitOption 4: Clone and install locally
git clone https://github.com/sergei-tofu-fedorov/mongo_mcp.git
cd mongo_mcp
npm install
npm link # Make it available globallyUsage
Method 1: Configure via .mcp.json (Recommended)
Add the server to your .mcp.json file in any project directory:
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp-server",
"--mongo-uri", "mongodb://your-host:27017",
"--database", "your-database-name"
]
}
}
}Or with environment variables:
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": ["mongo-mcp-server"],
"env": {
"MONGODB_URI": "mongodb://your-host:27017",
"MONGODB_DATABASE": "your-database-name"
}
}
}
}Method 2: Install locally in project
Clone this repo into your project or install as dependency
Create a
settings.jsonfile in the project root:
{
"mongodb": {
"uri": "mongodb://your-host:27017",
"database": "your-database-name"
}
}Add to your
.mcp.json:
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": ["./path/to/mongo_mcp/server.js"]
}
}
}Configuration Priority
The server accepts configuration in the following priority order:
Command-line arguments (highest priority)
# Full format mongo-mcp-server --mongo-uri mongodb://localhost:27017 --database mydb # Short format mongo-mcp-server --uri mongodb://localhost:27017 --db mydb # Single URI format (with database in path) mongo-mcp-server mongodb://localhost:27017/mydbEnvironment variables
export MONGODB_URI="mongodb://localhost:27017" export MONGODB_DATABASE="mydb" mongo-mcp-serversettings.json file
{ "mongodb": { "uri": "mongodb://localhost:27017", "database": "mydb" } }Default values (lowest priority)
URI:
mongodb://localhost:27017Database:
mcpserver
Available Tools
Connection Management
check_connection: Check if MongoDB connection is active and healthy
Master User Tools
find-master-user-by-platform-id: Find master user by platform ID (case-insensitive search)Parameters:
platformId(string),limit(number, default: 10)
find-master-user-by-email: Find master user by email (case-insensitive search)Parameters:
email(string),limit(number, default: 10)
find-master-user-by-id: Find a specific master user by their IDParameters:
id(string)
find-master-user-by-account-id: Find master user by account ID (case-insensitive search)Parameters:
accountId(string),limit(number, default: 10)
Invoice Tools
find-invoices-by-account-id: Find invoices by account ID (case-insensitive search)Parameters:
accountId(string),limit(number, default: 10)
find-invoice-by-id: Find a specific invoice by its IDParameters:
id(string)
Quick Start with mcp add
Navigate to any directory where you want to use MongoDB tools:
cd C:\AI\mongo_testAdd the MongoDB MCP server:
mcp add https://github.com/sergei-tofu-fedorov/mongo_mcp.gitEdit the generated
.mcp.jsonfile to add your MongoDB connection:{ "mcpServers": { "mongo_mcp": { "command": "npx", "args": [ "mongo-mcp-server", "mongodb://your-host:27017/your-database" ] } } }Start Claude Code:
claude-codeUse MongoDB tools directly in Claude:
find master user by email john@example.com find invoices by account 2djcl2neh9-0f9f3bd0e check mongodb connection status
Example Usage in Claude Code
Once configured, you can use these tools directly in Claude Code:
find master user by email john@example.com
find invoices by account 2djcl2neh9-0f9f3bd0e
check mongodb connection statusDevelopment
Requirements
Node.js >= 18.0.0
MongoDB instance (local or remote)
Running in Development
git clone https://github.com/sergei-tofu-fedorov/mongo_mcp.git
cd mongo_mcp
npm install
npm run dev # Runs with --watch for auto-reloadTesting with Different Configurations
# Test with command line args
node server.js --mongo-uri mongodb://localhost:27017 --database testdb
# Test with environment variables
MONGODB_URI=mongodb://localhost:27017 MONGODB_DATABASE=testdb node server.js
# Test with settings.json (create the file first)
node server.jsTroubleshooting
Connection Issues
Verify MongoDB is running and accessible
Check firewall settings and network connectivity
Ensure the URI format is correct:
mongodb://host:portormongodb+srv://cluster.example.comValidate database name and permissions
Permission Issues
Ensure the MongoDB user has read permissions on the target database
Check that the user can access the required collections
MCP Server Issues
Verify Claude Code can find the server executable
Check the
.mcp.jsonconfiguration syntaxLook for error messages in Claude Code's output
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Available Tools
1 toolcheck_connectionB
Check if MongoDB connection is active and healthy
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. While it implies a read-only, non-destructive operation (checking connection status), it fails to specify what 'active and healthy' entails (e.g., latency thresholds, authentication status), the response format, or any side effects like logging. This leaves significant gaps in understanding the tool's behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without any fluff or redundancy. It is front-loaded with the core action and resource, making it easy to parse and understand immediately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (no parameters, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks details on behavioral traits, response format, or usage context. For a diagnostic tool, more information on what constitutes 'healthy' would enhance completeness, but the current description meets the basic requirement.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and schema description coverage is 100%, meaning there are no parameters to document. The description appropriately does not mention parameters, aligning with the schema. A baseline of 4 is applied since no parameter information is needed, though it doesn't add value beyond the schema's indication of no parameters.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Check if MongoDB connection is active and healthy.' It specifies the verb ('check') and the resource ('MongoDB connection'), making the intent unambiguous. However, with no sibling tools mentioned, there's no opportunity to distinguish from alternatives, preventing a perfect score.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives or in what context it should be invoked. It lacks any mention of prerequisites, timing, or scenarios where this check is appropriate, leaving the agent without operational context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v1.0.0- First observed
check_connection
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or overlap in purpose. The tool 'check_connection' has a single, clear function, making it impossible for an agent to confuse it with any other tool.
The single tool name follows a consistent verb_noun pattern ('check_connection'), and with only one tool, there is no inconsistency in naming conventions. The naming is straightforward and predictable.
A single tool is too few for a MongoDB server, which typically requires CRUD operations, querying, indexing, and other database management tasks. This minimal set severely limits the server's utility and scope, indicating a significant mismatch with the expected domain coverage.
The tool set is severely incomplete for a MongoDB server. It lacks essential operations like insert, find, update, delete, or any other database interactions, leaving major gaps that will cause agent failures in performing typical database tasks. The single tool only handles connection checking, which is insufficient for the stated purpose.
Related MCP Connectors
Model Context Protocol server for Studex tools, notifications, and profile integrations
Model Context Protocol server for todo.vu task management and time tracking.
A Model Context Protocol (MCP) server for Selise Blocks Cloud integration
A Model Context Protocol server for Wix AI tools