MCP MongoDB logo

MCP MongoDB

by nan-qin

MCP MongoDB is a configuration and toolset for interacting with MongoDB databases. It provides a structured way to execute commands, read resources, and perform multi-collection queries.

View on GitHub

Last updated: N/A

What is MCP MongoDB?

MCP MongoDB is a configuration-driven system that allows users to interact with MongoDB databases using predefined tools and schemas. It defines how to connect to and interact with MongoDB instances, providing tools for reading resources, executing commands, and performing complex queries like multi-collection joins.

How to use MCP MongoDB?

To use MCP MongoDB, you need to define the server configuration in the mcpServers section, specifying the command to execute (typically a Node.js script), arguments, and environment variables, including the MongoDB URI. Then, you can use the provided tools like read_resource and multi_collection_query by specifying the server_name and the tool name along with the required parameters in JSON format.

Key features of MCP MongoDB

  • Configuration-driven

  • Resource reading

  • Command execution

  • Multi-collection queries

  • Schema validation

Use cases of MCP MongoDB

  • Reading data from MongoDB collections

  • Performing complex queries with joins

  • Executing database commands

  • Managing MongoDB instances

  • Building data aggregation pipelines

FAQ from MCP MongoDB

What is CallToolRequestSchema used for?

CallToolRequestSchema is used for executing specific operations, such as running commands or processing data actively.

What is ReadResourceRequestSchema used for?

ReadResourceRequestSchema is used for reading resource content, providing read-only access to resources like collection documents or database status.

How do I perform a multi-collection query?

You can use the multi_collection_query tool and provide a JSON payload that includes the database name, collection name, and a MongoDB aggregation pipeline.

What parameters are required for the read_resource tool?

The read_resource tool requires a JSON payload with the uri parameter, which specifies the MongoDB connection URI.

Can I disable a server configuration?

Yes, you can disable a server configuration by setting the disabled property to true in the mcpServers configuration.