- Home
- MCP servers
- MongoDB
MongoDB
- javascript
27
GitHub Stars
javascript
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": {
"mongodb-developer-mongodb-mcp-server": {
"command": "npx",
"args": [
"-y",
"@pash1986/mcp-server-mongodb"
],
"env": {
"MONGODB_URI": "mongodb+srv://<yourcluster>"
}
}
}
}You can query MongoDB data with a dedicated MCP server that gives read-only access to schemas and allows safe aggregation testing for language models. This server runs locally via a standard MCP client workflow and connects to your MongoDB instance through a configurable URI.
How to use
Connect to the MongoDB MCP Server from your MCP client by configuring a stdio-based MCP entry. This server is designed for read-only access, providing schema information for each collection and the ability to run aggregation pipelines against your connected MongoDB instance.
How to install
Prerequisites you need before running the MCP server:
Configure your MCP client to start the server using the provided npm/npx command snippet. The following configuration example is designed for Claude Desktop, but you can adapt it to your MCP client if needed.
Configuration example for Claude Desktop
"mongodb": {
"command": "npx",
"args": [
"-y" ,
"@pash1986/mcp-server-mongodb"
],
"env" : {
"MONGODB_URI" : "mongodb+srv://<yourcluster>" // 'mongodb://localhost:27017'
}
}
Start and connect
Once you have the configuration in place, start the MCP server through your MCP client. The suggested runtime uses npx to invoke the MongoDB MCP Server package, ensuring you always run the latest version without a global install.
Additional content
Tools exposed by this server include the ability to perform aggregation and to obtain explain plans for those pipelines. You can inspect collection schemas via a schema endpoint that provides inferred JSON schema information based on sampled documents.
License
This MCP server is provided under the MIT License. It can be freely used, modified, and distributed in accordance with MIT terms.
Available tools
aggregate
Execute MongoDB aggregation pipelines against the connected database. Inputs: collection (string), pipeline (array), options (object). Defaults: 1000 documents and 30s timeout.
explain
Get execution plans for aggregation pipelines. Inputs: collection (string), pipeline (array), verbosity (string). Default: queryPlanner.