MongoDB integration that enables LLMs to interact directly with databases.
Connect your Large Language Models (LLMs) directly to your MongoDB database with the power of the Model Context Protocol (MCP). This server empowers LLMs to understand, query, and manipulate your data using natural language, opening up a new world of AI-driven applications.
Configure your MCP Client (e.g., Claude Desktop):
Locate the configuration file:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration, replacing the connection string with your MongoDB credentials:
{ "mcpServers": { "mongodb": { "command": "npx", "args": [ "mongo-mcp", "mongodb://<username>:<password>@<host>:<port>/<database>?authSource=admin" ] } } }
(Optional) Quick Sandbox Setup:
If you don't have a MongoDB instance, use Docker Compose to create a local sandbox:
docker-compose up -d npm run seed
This will start a MongoDB instance and populate it with sample data.
For local development, you can run the server directly:
{ "mcpServers": { "mongodb": { "command": "node", "args": [ "dist/index.js", "mongodb://root:example@localhost:27017/test?authSource=admin" ] } } }
Unleash the power of natural language with these example prompts:
"List all available collections in the database." "Describe the schema of the 'users' collection." "Find all users located in San Francisco."
"Find all 'electronics' products in stock with a price under $1000." "Show me all orders placed by the user with the email '[email protected]'." "List products with an average rating above 4.5 stars."
"What indexes are currently defined on the 'users' collection?" "Create an index on the 'products' collection for the 'category' field to improve search performance." "Show me a comprehensive list of all indexes across all collections in the database."
"Insert a new product named 'Gaming Laptop' into the 'products' collection." "Update the status of order with ID 'X' to 'shipped'." "Find and delete all products that are currently out of stock."
The MongoDB MCP Server exposes the following tools to your LLMs:
find
: Retrieve documents based on specified criteria (filtering and projection supported).listCollections
: Discover available collections within the database.insertOne
: Add a single document to a collection.updateOne
: Modify a single document within a collection.deleteOne
: Remove a single document from a collection.createIndex
: Create a new index on a collection to optimize query performance.dropIndex
: Remove an existing index from a collection.indexes
: List all indexes defined for a specific collection.The optional sandbox setup populates your MongoDB instance with three collections:
This sample data provides a realistic environment for testing and exploring the capabilities of the MongoDB MCP Server.
๐ โ๏ธ Biomedical research server providing access to PubMed, ClinicalTrials.gov, and MyVariant.info.
๐ MCP server that provides SQL analysis, linting, and dialect conversion using [SQLGlot](https://github.com/tobymao/sqlglot)
๐ ๐ All-in-one MCP server for Postgres development and operations, with tools for performance analysis, tuning, and health checks
Supabase MCP Server with support for SQL query execution and database exploration tools