The MongoDB MCP Server allows you to interact with MongoDB clusters using natural language queries from AI clients that support MCP. This page describes the MCP Server tools.
Overview
The MongoDB MCP server provides the following tools categories:
Atlas tools, which perform operations on Atlas system resources, like organizations, projects, clusters, database user accounts, and retrieving performance recommendations.
Local Atlas tools, which allow you to list, connect to, create, and delete local Atlas deployments.
Database tools, which perform operations such as inserting, updating, and deleting documents, and running queries and aggregation pipelines.
MCP Server Atlas Tools
The Atlas tools are only available if you have set up Atlas API credentials as shown in MongoDB MCP Server Configuration.
The following table describes the Atlas tools:
MCP Server Atlas Tool Name | Description |
|---|---|
| Returns a list of Atlas organizations. |
| Returns a list of Atlas projects. |
| Creates a new Atlas project. |
| Returns list of Atlas clusters. |
| Returns information about a specific Atlas cluster. |
| Creates a free Atlas cluster. |
| Connects to an Atlas cluster using the configured service account. If you configured the MCP server without specifying a connection string, this tool creates a temporary database user with a random password to establish the connection. For details, see Tool Details. |
| Returns information about the IP and CIDR ranges that can access an Atlas cluster. |
| Configures the IP and CIDR access list for an Atlas cluster. |
| Returns a list of Atlas database users. |
| Creates an Atlas database user. |
| Returns a list of alerts for an Atlas project. |
| Returns Performance Advisor recommendations
for an Atlas cluster. Supports operations for suggested indexes, drop index suggestions,
slow query logs, and schema suggestions. Requires To learn more, see Performance Advisor Tool. |
MCP Server Local Atlas Tools
You can use the MCP Server with local Atlas deployments. To use the MCP Server tools with local Atlas deployments, you must install Docker. For an introduction to local Atlas deployments, see Create a Local Atlas Deployment.
The following table describes the local Atlas tools:
MCP Server Local Atlas Tool Name | Description |
|---|---|
| Lists local Atlas deployments. |
| Creates a local Atlas deployment. To run this tool, you must disable read only mode. |
| Connects to a local Atlas deployment. |
| Deletes a local Atlas deployment. To run this tool, you must disable read only mode. |
For examples that run the local Atlas tools, see Local Atlas Deployments.
MCP Server Database Tools
The following table describes the database tools:
MCP Server Database Tool Name | Description |
|---|---|
| Connects to a cluster. |
| Runs a database query. |
| Runs an aggregation pipeline. |
| Returns the number of documents in a collection. |
| Adds a single document to a collection. |
| Adds multiple documents to a collection. |
| Adds an index to a collection. |
| Modifies a single document in a collection. |
| Modifies multiple documents in a collection. |
| Changes the name of a collection. |
| Removes a single document from a collection. |
| Removes multiple documents from a collection. |
| Deletes a collection from a database. |
| Deletes a database. |
| Returns a list of all databases available through the current connection. |
| Returns a list of collections in a database. |
| Returns information about collection indexes. |
| Returns collection schema information. |
| Returns collection size in megabytes. |
| Returns database statistics. |
| Saves the results of a query or aggregation pipeline in JSON
format to a file on the computer that runs the MCP Server.
The results are also accessible through the |
Tool Details
For additional information about specific MCP tools, see the following sections.
Connecting without Atlas Connection String
If you configured the MCP server without specifying a connection string
to an Atlas cluster, the atlas-connect-cluster tool
creates a temporary database user
to establish connection to the cluster
by using the configured Atlas API service account credentials.
The temporary database user has the following characteristics:
Randomly generated username and password.
Automatically expires after 12 hours.
Role assigned based on how you configured the MCP Server:
readAnyDatabaseif you enabled read-only mode or disabled thecreate,delete, andupdatetool categories.readWriteAnyDatabaseif the server has full permissions.
Note
User credentials are stored only in the MCP Server's memory and are never returned to or exposed in the LLM context.
Performance Advisor Tool
The atlas-get-performance-advisor tool allows you to access
Performance Advisor recommendations
through natural language queries. This tool helps you identify performance
optimization opportunities by analyzing slow queries and suggesting improvements.
When performing slow query analysis, the MongoDB MCP Server retrieves a sample of slow queries, capped at 50 queries. The sample includes up to 50 most recent slow queries that match any specified conditions in your prompt to ensure optimal performance and response times.
Note
This tool requires Project Read Only access or higher and an M10+ cluster.
It is available with the --readonly flag.
Use Case | Example Prompts | Performance Advisor Operation |
|---|---|---|
Analyze Slow Queries | Show me my slow queriesWhat is slowing down my cluster?Show me queries that are longer than 5 secondsShow me slow writes in the website.users namespace | |
Index Suggestions | Are there any indexes I should create to improve performance?What indexes do you recommend I drop? | |
Schema Advice | Show schema recommendations for my clusterHelp me optimize my database schema |
For detailed usage examples and sample outputs, see Performance Optimization.
Learn More
To disable specific tools and restrict the MCP Server to read-only mode, see MongoDB MCP Server Configuration.
To see some MCP Server example natural language prompts, see MongoDB MCP Server Usage Examples.