- Home
- MCP servers
- MongoDB Model Context Protocol
MongoDB Model Context Protocol
- typescript
1
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": {
"nickiiitu-mongodb-model-context-protocol-mcp-": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}You can connect your MCP client to a MongoDB database and interact with collections, schemas, and documents through natural language. This MCP server lets you inspect collection schemas, query documents, manage indexes, and perform insert, update, and delete operations from your client prompts.
How to use
You connect using an MCP client such as Claude Desktop. Add an MCP server entry that points to either the local development runtime or the npm-based runtime, then start querying your MongoDB data through natural language prompts.
How to install
Prerequisites you need to have before running the MCP server:
-
Node.js 18+
-
npx
-
Docker and Docker Compose (for local sandbox testing only)
-
MCP Client (Claude Desktop App or another compatible client)
Local runtime configurations
{
"mcpServers": {
"mongodb": {
"command": "node",
"args": [
"dist/index.js",
"mongodb://root:example@localhost:27017/test?authSource=admin"
]
}
}
}
Remote (npm/npx) runtime configurations
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"mongo-mcp",
"mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin"
]
}
}
}
Test sandbox setup
If you want to run a local sandbox MongoDB instance, you can start it with Docker Compose and seed it with sample data.
Start the MongoDB sandbox:
docker-compose up -d
Seed the database with test data:
npm run seed
Available tools
find
Query documents with filtering and projection
listCollections
List available collections
insertOne
Insert a single document
updateOne
Update a single document
deleteOne
Delete a single document
createIndex
Create a new index
dropIndex
Remove an index
indexes
List indexes for a collection