- Home
- MCP servers
- MCP MongoDB Server
MCP MongoDB Server
- typescript
276
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"kiliczsh-mcp-mongo-server": {
"command": "npx",
"args": [
"-y",
"mcp-mongo-server",
"mongodb://localhost:27017/database"
],
"env": {
"MCP_MONGODB_URI": "mongodb://localhost:27017/database",
"MCP_MONGODB_READONLY": "true"
}
}
}
}You can run an MCP MongoDB Server to let large language models interact with your MongoDB data. It can inspect collection schemas, execute MongoDB operations, and offer read-only or full write capabilities through a standardized interface, making it easier to explore, query, and manage your data from LLM-powered tools.
How to use
Start the MCP MongoDB Server by providing the MongoDB connection URI to the server. You can run in normal mode or in read-only mode to prevent write operations. Use the server to perform schema inference, queries, aggregations, inserts, updates, and index creation through a consistent interface.
How to install
Prerequisites: ensure Node.js and npm are installed on your system. You should have network access to reach your MongoDB instance.
# Start the MCP MongoDB Server against a local MongoDB instance
npx -y mcp-mongo-server mongodb://localhost:27017/database
Additional notes
Environment variables supported by the server let you configure the connection behavior. You can enable read-only mode to protect data and rely on a read preference to read from secondaries if available.
If you want to run a read-only session, use the same start command with the read-only flag.
Available tools
smart_objectid_handling
Configurable auto/none/force modes for string-to-ObjectId conversion during operations.
read_only_mode
Protection against write operations with read-preference optimization.
schema_inference
Automatic detection of collection schemas from document samples.
query_and_aggregation
Full MongoDB query and aggregation pipeline support with optional explain plans.
write_operations
Support for insert, update, and index creation when not in read-only mode.
collection_completions
Auto-complete collection names to assist LLM integration.