MongoDB MCP Server
MCP MongoDB Server
This server implements a Model Context Protocol (MCP) interface for MongoDB, allowing interaction with MongoDB collections and documents through standardized MCP requests.
Features
Resource Management
List Collections: Lists all MongoDB collections as MCP resources
Each collection is represented with a
mongodb://URI schemeReturns collection names and metadata in MCP resource format
Document Operations
Read Documents: Retrieve documents from MongoDB collections
Access collections using
mongodb://collection-nameURI formatSupports filtering and projection of documents
Default limit of 100 documents per request
Tools
Query Builder: Structured querying of MongoDB collections
Specify collection name
Apply filters and projections
Configure result limits
Security & Logging
Secure MongoDB connection handling
Detailed operation logging to
logs/server.logConnection error handling and reporting
Input validation for collection names and queries
Configuration
MongoDB connection via environment variables (
MONGODB_URI)Configurable client options for performance and security
Logging system with timestamp and error tracking
Technical Details
Built with
@modelcontextprotocol/sdkversion 1.10.2Uses MongoDB Node.js driver version 6.16.0
Implements MCP server capabilities for resources and tools
Components
Tools
query
Execute MongoDB queries with filtering and projection
Input parameters:
collection: Name of collection to queryfilter: MongoDB query filter (optional)projection: Fields to include/exclude (optional)limit: Maximum number of documents to return (default 100)
Resources
The server provides access to MongoDB collections as resources:
Collections (
mongodb://<collection-name>)Each collection is exposed as a resource
Documents are returned in JSON format
Supports filtering and projection via query tool
Configuration
Usage with Claude Desktop
To use this server with Claude Desktop, add the following to your claude_desktop_config.json:
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rtcface/first_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server