
mcp-mongo-server
by kiliczsh·★ 278·Score 50
An MCP server for MongoDB interaction with schema inference, query capabilities, and configurable read-only mode.
Overview
The MCP MongoDB Server provides a standardized interface for LLMs to interact with MongoDB databases. It offers smart ObjectId handling, read-only mode protection, automatic collection schema detection, and full MongoDB query and aggregation pipeline support. The server allows both read and write operations (when not in read-only mode) and provides collection completions for better LLM integration.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose this when you need an MCP interface for MongoDB and want fine-grained control over read/write access, especially with its unique ObjectId handling capabilities.
When NOT to choose this
Avoid if you need authentication beyond basic URI connection or require support for non-MongoDB databases.
Tools this server exposes
12 tools extracted from the READMEqueryExecute MongoDB queries against collections
aggregateRun MongoDB aggregation pipelines
insertInsert documents into MongoDB collections
updateUpdate documents in MongoDB collections
list_collectionsList all collections in the database
schema_inferenceInfer collection schema from sample documents
create_indexCreate indexes on collection fields
explain_planGet query execution plan for MongoDB queries
count_documentsCount documents matching a query filter
distinctGet distinct values from a field in a collection
drop_collectionRemove a collection from the database
list_databasesList all available databases
Comparable tools
Installation
Installation
npx -y mcp-mongo-server mongodb://localhost:27017/databaseUsage
# Start server with MongoDB URI
npx -y mcp-mongo-server mongodb://user:password@localhost:27017/database
# Connect in read-only mode
npx -y mcp-mongo-server mongodb://user:password@localhost:27017/database --read-onlyClaude Desktop Integration
Add to Claude Desktop config:
{
"mcpServers": {
"mongo": {
"command": "npx",
"args": ["-y", "mcp-mongo-server", "mongodb://localhost:27017/database"]
}
}
}FAQ
- Is write operation support available?
- Yes, the server supports insert, update, and index creation operations unless it's running in read-only mode.
- How does the schema inference work?
- The server automatically detects collection schemas by analyzing document samples in the collection.
On Hacker News
Recent discussion from the developer community.
- Story by kilic · 2025-03-29
Compare mcp-mongo-server with
Last updated · Auto-generated from public README + GitHub signals.