mongodb-mcp-server
v3.4.0Official MongoDB MCP server: let AI agents search and manage databases and the Atlas data platform
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
aggregate-db
Run an aggregation against a MongoDB database
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
pipeline * | array | An array of aggregation stages to execute. The first stage must be a database-level aggregation stage (one of `$changeStream`, `$currentOp`, `$documents`, `$listLocalSessions`, `$queryStats`). https:/… |
responseBytesLimit | number | The maximum number of bytes to return in the response. This value is capped by the server's configured maximum and cannot be exceeded. |
aggregate
Run an aggregation against a MongoDB collection
collection-indexes
Describe the indexes for a collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
collection-schema
Describe the schema for a collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
responseBytesLimit | number | The maximum number of bytes to return in the response. This value is capped by the server's configured maximum and cannot be exceeded. Ignored when the schema comes from the validator. |
sampleSize | number | Number of documents to sample for schema inference. Ignored when the schema comes from the validator. |
schemaSource | string | Where to derive the schema from. 'auto' uses the collection's $jsonSchema validator when it rejects invalid writes (validationLevel 'strict' with validationAction 'error' or 'errorAndLog', or validati… |
collection-storage-size
Gets the size of the collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
connect
Connect to a MongoDB instance and get back a connectionId to pass to the other MongoDB tools. Each call establishes a new, independent connection — multiple connections can be active at the same time.
| Parameter | Type | Description |
|---|---|---|
connectionString * | string | MongoDB connection string (in the mongodb:// or mongodb+srv:// format) |
connectionName | string | Optional short label for the connection (stored slugified with a short suffix, e.g. "staging" becomes staging-<suffix>). Shown in connection listings; helpful for telling multiple connections apart. |
count
Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
query | object | A filter/query parameter. Allows users to filter the documents to count. Matches the syntax of the filter argument of db.collection.count(). |
create-collection
Creates a new collection in a database. If the database doesn't exist, it will be created automatically.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
create-index
Create an index for a collection
db-stats
Returns statistics that reflect the use state of a single database
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
delete-many
Removes all documents that match the filter from a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
filter | object | The query filter, specifying the deletion criteria. Matches the syntax of the filter argument of db.collection.deleteMany() |
disconnect
Close a MongoDB connection and revoke its connectionId.
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connectionId to disconnect. |
drop-collection
Removes a collection or view from the database. The method also removes any indexes associated with the dropped collection.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
drop-database
Removes the specified database, deleting the associated data files
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
drop-index
Drop an index for the provided database and collection.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
indexName * | string | The name of the index to be dropped. |
type * | string | The type of index to be deleted. Use 'classic' for standard indexes and 'search' for atlas search and vector search indexes. |
explain
Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method. Pipelines with $out or $merge stages are not accepted, because explain never writes.
export
Export a query or aggregation results in the specified EJSON format.
find
Run a find query against a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
filter | object | The query filter, matching the syntax of the query argument of db.collection.find() |
limit | number | The maximum number of documents to return |
projection | object | The projection, matching the syntax of the projection argument of db.collection.find() |
responseBytesLimit | number | The maximum number of bytes to return in the response. This value is capped by the server's configured maximum and cannot be exceeded. |
sort | object | A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for asce… |
insert-many
Insert an array of documents into a MongoDB collection. If the list of documents is above com.mongodb/maxRequestPayloadBytes, consider inserting them in batches.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
documents * | array | The array of documents to insert, matching the syntax of the document argument of db.collection.insertMany(). |
list-collections
List all collections for a given database
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
list-connections
List the active MongoDB connections and their connectionIds. Use this to find a connectionId established earlier.
list-databases
List all databases for a MongoDB connection
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
mongodb-logs
Returns the most recent logged mongod events
| Parameter | Type | Description |
|---|---|---|
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
limit | integer | The maximum number of log entries to return. |
type | string | The type of logs to return. Global returns all recent log entries, while startupWarnings returns only warnings and errors from when the process started. |
rename-collection
Renames a collection in a MongoDB database
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
newName * | string | The new name for the collection |
dropTarget | boolean | If true, drops the target collection if it exists |
update-many
Updates all documents that match the specified filter for a collection. If the list of documents is above com.mongodb/maxRequestPayloadBytes, consider updating them in batches.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name |
connectionId * | string | The connection to run the operation against. Use the id returned by one of the connect tools. |
database * | string | Database name |
update * | object | An update document describing the modifications to apply using update operator expressions |
filter | object | The selection criteria for the update, matching the syntax of the filter argument of db.collection.updateOne() |
upsert | boolean | Controls whether to insert a new document if no documents match the filter |
search-knowledge
Search for information in the MongoDB Assistant knowledge base. This includes official documentation, curated expert guidance, and other resources provided by MongoDB. Supports filtering by data source and version.
| Parameter | Type | Description |
|---|---|---|
query * | string | A natural language query to search for in the MongoDB Assistant knowledge base. This should be a single question or a topic that is relevant to the user's MongoDB use case. |
dataSources | array | A list of one or more data sources to limit the search to. You can specify a specific version of a data source by providing the version label. If not provided, the latest version of all data sources w… |
limit | number | The maximum number of results to return |
list-knowledge-sources
List available data sources in the MongoDB Assistant knowledge base. Use this to explore available data sources or to find search filter parameters to use in search-knowledge.