Docs Menu
Docs Home
/ /

MongoDB MCP Server Tools

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.

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.

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

atlas-list-orgs

Returns a list of Atlas organizations.

atlas-list-projects

Returns a list of Atlas projects.

atlas-create-project

Creates a new Atlas project.

atlas-list-clusters

Returns list of Atlas clusters.

atlas-inspect-cluster

Returns information about a specific Atlas cluster.

atlas-create-free-cluster

Creates a free Atlas cluster.

atlas-connect-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.

atlas-inspect-access-list

Returns information about the IP and CIDR ranges that can access an Atlas cluster.

atlas-create-access-list

Configures the IP and CIDR access list for an Atlas cluster.

atlas-list-db-users

Returns a list of Atlas database users.

atlas-create-db-user

Creates an Atlas database user.

atlas-list-alerts

Returns a list of alerts for an Atlas project.

atlas-get-performance-advisor

Returns Performance Advisor recommendations for an Atlas cluster. Supports operations for suggested indexes, drop index suggestions, slow query logs, and schema suggestions. Requires Project Read Only access or higher.

To learn more, see Performance Advisor Tool.

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

atlas-local-list-deployments

Lists local Atlas deployments.

atlas-local-create-deployment

Creates a local Atlas deployment. To run this tool, you must disable read only mode.

atlas-local-connect-deployment

Connects to a local Atlas deployment.

atlas-local-delete-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.

The following table describes the database tools:

MCP Server Database Tool Name
Description

connect

Connects to a MongoDB cluster.

find

Runs a MongoDB database query.

aggregate

Runs a MongoDB aggregation pipeline.

count

Returns the number of documents in a collection.

explain

Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method.

insert-many

Adds documents to a collection.

If you specify a Voyage AI API key in your MCP configuration, the server can automatically generate vector embeddings from text and include them in the inserted documents.

create-index

Creates an index on a collection. This tool supports creating vector search indexes.

drop-index

Removes a vector search index from a collection.

update-one

Modifies a single document in a collection.

update-many

Modifies multiple documents in a collection.

rename-collection

Changes the name of a collection.

create-collection

Creates a new collection.

delete-many

Removes documents from a collection.

drop-collection

Deletes a collection from a database.

drop-database

Deletes a database.

drop-index

Drop an index for the provided database and collection.

list-databases

Returns a list of all databases available through the current connection.

list-collections

Returns a list of collections in a database.

collection-indexes

Returns information about collection indexes, including vector search indexes.

collection-schema

Returns collection schema information.

collection-storage-size

Returns collection size in megabytes.

db-stats

Returns database statistics.

export

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 exported-data resource in the AI client application.

mongodb-logs

Returns the most recent logged mongod events.

switch-connection

Switch to a different MongoDB connection.

For additional information about specific MCP tools, see the following sections.

Vector search support in MCP is available as a preview feature. To enable this feature, set the previewFeatures flag or MDB_MCP_PREVIEW_FEATURES environment variable to search in your MCP configuration. To learn more, see MongoDB MCP Server Configuration Options.

The MongoDB MCP Server supports MongoDB Vector Search. You can create and manage vector search indexes, generate embeddings, and run semantic search queries through natural language prompts. The following table summarizes key features.

Use Case
Example Prompts
Relevant Tools

Manage indexes

Create a vector search index on the sample_db database and products collection

Show me all vector search indexes on the products collection

Drop the vector search index named vector_index
create-index
collection-indexes
drop-index

Insert documents with automatic embeddings

Insert these documents into the products collection and embed their descriptions
insert-many

Vector search queries

Search for documents semantically similar to this description

Find me related products filtered by price range
aggregate

Use the following resources to learn more:

The following tools allow you to manage vector search indexes:

  • collection-indexes: Lists all indexes on a collection, including vector search indexes, and provides index status information.

  • create-index: Creates a new vector search index on a collection.

  • drop-index: Deletes a vector search index from a collection.

Note

To update a vector search index, drop the existing index and create a new one.

If you configure the MCP Server with a Voyage AI API key, the server can automatically generate embeddings in the following ways:

  • Generate embeddings for documents: Embeds text fields in documents when using the insert-many tool.

  • Generates embeddings for queries: Embeds the search query when running vector search queries with the aggregate tool. Specifically, the server generates embeddings for the queryVector parameter in $vectorSearch aggregation queries.

The MCP Server supports the following Voyage AI embedding models:

  • voyage-3-large

  • voyage-3.5

  • voyage-3.5-lite

  • voyage-code-3

To learn more about Voyage AI models, see the Voyage AI documentation.

Note

By default, the MongoDB MCP Server validates that fields with vector search indexes contain valid vector embeddings to prevent breaking vector search indexes. To disable this behavior, set the disableEmbeddingsValidation option to true. To learn more, see Vector Search Options.

The MongoDB MCP Server supports pre-filtering vector search queries. To learn more, see MongoDB Vector Search Pre-Filtering.

The MCP server does not support the quantization field for vector search indexes.

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 queries

What is slowing down my cluster?

Show me queries that are longer than 5 seconds

Show 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 cluster

Help me optimize my database schema

For detailed usage examples and sample outputs, see Performance Optimization.

If you configure 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:

Note

The MongoDB MCP Server stores user credentials in memory only and never returns or exposes the credentials in the LLM context.

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.

Back

Troubleshooting

On this page