Integrations
Provides a standardized protocol for interacting with MongoDB databases, supporting CRUD operations on documents, collection management, and index operations through async/await patterns.
MongoDB MCP Server
A powerful Model Context Protocol (MCP) server implementation that provides seamless interaction with MongoDB databases over a standardized protocol.
Author
Rastalion
outline
This MCP server implementation provides a powerful interface to interact with a MongoDB database via the Model Context Protocol. It reliably supports operations on the database, collections, and documents via the async/await pattern and error handling.
characteristic
- Full support for MongoDB CRUD operations
- Handling secure connections to MongoDB
- Async/await pattern for optimal performance
- Comprehensive error handling
- Docker support for easy deployment
- Executing queries with type hints
- Support for Server-Sent Events (SSE) for real-time updates
Quick Start
Use as a CLI tool
Run via UVX
Run Python directly
Using Docker
Using UVX
UVX is a tool that allows you to easily manage services in various environments.
For more information, see the UVX Guide .
Environment variables
Before running the server, set the following environment variables:
API endpoint
- Check health :
GET /health
- MCP API :
GET /mcp
- FastMCP endpoint (OpenAPI documentation) - SSE Connection :
GET /sse
- Server-Sent Events Endpoint - Message Processing :
POST /messages
- Message Processing Endpoint
IDE Integration
VS Code Settings
Add the following to your VS Code settings.json:
Claude or other AI assistant
Configure your MCP server for Claude or other AI assistants as follows:
Tools available
Tool name | explanation |
---|---|
listCollections | List all available collections in the database |
find | Retrieving documents in a collection using MongoDB query syntax |
insertOne | Insert a single document into a collection |
updateOne | Update a single document in a collection |
deleteOne | Delete a single document from a collection |
indexes | List all indexes in a collection |
createIndex | Create a new index in a collection |
dropIndex | Delete an existing index from a collection |
Advanced Usage
Add custom tools
- Create a new tool in
app/tools/documents/
orapp/tools/collection/
:
- Register the tool in
app/tools/registry.py
:
Installing and Deploying CLI Tools
You can make it available globally by registering it as a package on PyPI:
Troubleshooting
- If the server does not start : Check help with
mongo-mcp-server --help
- MongoDB connection issue : Verify that
--mongodb-url
parameter is correct - Tool execution error : Check tool implementation and input parameters
- Docker issue : Check logs with
docker-compose logs mongo-mcp
Docker configuration
Docker configuration includes:
- Python 3.12 base image
- Asia/Seoul Time Zone
- MongoDB 4.4 instance
- Persistent volumes for database storage
- Health check for both services
- Automated network configuration
License
This project is distributed under the MIT License - see the LICENSE file for details.
This server cannot be installed
A powerful Model Context Protocol (MCP) server implementation that provides standardized interaction with MongoDB databases, supporting complete CRUD operations, async patterns, and real-time updates via SSE.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases. Query collections, inspect schemas, and manage data seamlessly through natural language.Last updated -34075TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.Last updated -8885191TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that provides read-only access to MongoDB databases, enabling AI assistants to directly query and analyze MongoDB data while maintaining data safety.Last updated -1492JavaScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated -340TypeScriptMIT License