MongoDB
The official MongoDB MCP server connects AI agents to MongoDB Community, Atlas, and local deployments. Agents can run find and aggregation queries, insert, update, and delete documents, inspect collection schemas and indexes, manage databases and collections, and administer Atlas clusters, projects, and database users.
Install MongoDB
- Published by
- Official (vendor)
- Transport
- Local process (stdio)
- Authentication
- API key
- Package
- @mongodb-js/mongodb-mcp-server
Claude Desktop, Claude Code and Cursor
Add this to the mcpServers object in your client's
config file, then restart the client.
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"@mongodb-js/mongodb-mcp-server"
],
"env": {
"MONGODB_URI": "${MONGODB_URI}"
}
}
}
}
VS Code uses a different key — show that config
Identical entry, filed under servers rather than
mcpServers. Put it in
.vscode/mcp.json for one workspace.
{
"servers": {
"mongodb": {
"command": "npx",
"args": [
"@mongodb-js/mongodb-mcp-server"
],
"env": {
"MONGODB_URI": "${MONGODB_URI}"
}
}
}
}
Before it will answer
Authentication is the connection string itself, which means MONGODB_URI carries a username and password — keep it in your environment rather than pasting it into a config file that gets synced and shared. Point it at a read-only user unless you specifically want an agent able to write and drop.
Tools
aggregate
Run an aggregation pipeline against a MongoDB collection.
atlas-inspect-cluster
View the configuration details of an Atlas cluster.
atlas-list-clusters
List all of the clusters within a MongoDB Atlas project.
atlas-list-projects
Show all of the projects available in your MongoDB Atlas org.
collection-indexes
Display the index information defined on a collection.
collection-schema
Retrieve the inferred schema details for a collection.
connect
Establish a connection to a MongoDB instance or cluster.
count
Count the documents in a collection matching a filter.
create-collection
Create a new collection within a MongoDB database.
create-index
Create an index on a field or fields of a collection.
db-stats
Fetch usage and storage statistics about a database.
delete-many
Delete multiple documents matching a filter from a collection.
drop-collection
Drop a collection along with its indexes from a database.
explain
Analyze the execution plan for a given MongoDB query.
export
Export the results of a MongoDB query in EJSON format.
find
Execute a find query to read documents from a collection.
insert-many
Insert multiple documents into a MongoDB collection.
list-collections
Enumerate all collections within a MongoDB database.
list-databases
List all of the databases available on the MongoDB server.
mongodb-logs
Retrieve the most recent server log events from MongoDB.
search-knowledge
Query the MongoDB knowledge base and official documentation.
update-many
Update multiple documents that match a given filter.