MongoDB MCP
MongoDB MCP lets authorized agents explore and manage MongoDB Atlas resources, databases, collections, documents, indexes, performance data, and MongoDB knowledge sources.
Verdict
Common use cases
- Prototype aggregation pipelines before deploying to production
- Pull query performance insights during incident triage
- Spin up test clusters for QA environments
- Audit database user permissions across projects
- Generate schema documentation from live collections
Integration
- Vendor
- MongoDB MCP
- Category
- other
- Auth
- OAUTH2
- Tools
- 41
- Composio slug
mongodb_mcp
Tools
- Aggregate
Run an aggregation against a MongoDB collection
- Aggregate-db
Run an aggregation against a MongoDB database
- Atlas-create-access-list
Allow Ip/CIDR ranges to access your MongoDB Atlas clusters.
- Atlas-create-cluster
Create a MongoDB Atlas cluster (M10–M80, replica set or single shard, single or multi-region). Compute autoscaling is enabled by default: min instance size is set to the selected instance size, max is set two tiers above. Disk autoscaling i
- Atlas-create-db-user
Create an MongoDB Atlas database user
- Atlas-create-free-cluster
Create a free MongoDB Atlas cluster
- Atlas-create-project
Create a MongoDB Atlas project
- Atlas-get-performance-advisor
Get MongoDB Atlas performance advisor recommendations and suggestions, which includes the operations: suggested indexes, drop index suggestions, schema suggestions, and a sample of the most recent (max 50) slow query logs
- Atlas-inspect-access-list
Inspect Ip/CIDR ranges with access to your MongoDB Atlas clusters.
- Atlas-inspect-cluster
Inspect metadata of a MongoDB Atlas cluster
- Atlas-list-alerts
List triggered alerts for a MongoDB Atlas project. These are alerts Atlas has raised, not the alert configurations that define them. Defaults to OPEN alerts; set status to TRACKING or CLOSED to see others.
- Atlas-list-clusters
List MongoDB Atlas clusters
- Atlas-list-db-users
List MongoDB Atlas database users
- Atlas-list-orgs
List MongoDB Atlas organizations
- Atlas-list-projects
List MongoDB Atlas projects.
- Atlas-load-sample-dataset
Load a MongoDB sample dataset into an Atlas cluster, or check the status of a previously-initiated load. To start a new load, provide `clusterName` — the load runs asynchronously and the response includes a `jobId` and initial state. To che
- Atlas-pause-resume-cluster
Pause or resume a dedicated (M10+) MongoDB Atlas cluster (Free and Flex clusters cannot be paused). Pause: paused clusters are unavailable for connections and do not incur compute costs. If the cluster being paused is the current active con
- Atlas-streams-build
Create Atlas Stream Processing resources. Use this tool for 'set up a Kafka pipeline', 'create a workspace', 'add a connection', or 'deploy a processor'. Use resource='workspace' to create a new workspace (specify cloud provider, region, an
- Atlas-streams-discover
Discover and inspect Atlas Stream Processing resources. Also use for 'why is my processor failing', 'what workspaces do I have', 'show processor stats', or 'check processor health'. Use 'list-workspaces' to see all workspaces in a project.
- Atlas-streams-manage
Manage Atlas Stream Processing resources: start/stop processors, modify pipelines, update configurations. Also use for 'change the pipeline', 'scale up my processor', or 'update my workspace tier'. Common workflow: action='stop-processor' →
- Atlas-streams-teardown
Delete Atlas Stream Processing resources. Also use for 'remove my workspace', 'disconnect a source', 'delete all processors', or 'clean up my streams environment'. Performs basic safety checks before deletion: summarizes counts of processor
- Atlas-upgrade-cluster
Upgrade a MongoDB Atlas cluster tier. Upgrades Free (M0) clusters to Flex or M10 Dedicated, or Flex clusters to M10 Dedicated. The upgrade path is determined automatically from the current tier unless overridden with targetTier. Note to LLM
- Collection-indexes
Describe the indexes for a collection
- Collection-schema
Describe the schema for a collection
- Collection-storage-size
Gets the size of the collection
- Count
Gets the number of documents in a MongoDB collection using db.collection.count() and query as an optional filter parameter
- Create-collection
Creates a new collection in a database. If the database doesn't exist, it will be created automatically.
- Create-index
Create an index for a collection
- Db-stats
Returns statistics that reflect the use state of a single database
- Delete-manydestructive
Removes all documents that match the filter from a MongoDB collection
- Drop-collectiondestructive
Removes a collection or view from the database. The method also removes any indexes associated with the dropped collection.
- Drop-databasedestructive
Removes the specified database, deleting the associated data files
- Drop-indexdestructive
Drop an index for the provided database and collection.
- Explain
Returns statistics describing the execution of the winning plan chosen by the query optimizer for the evaluated method
- Find
Run a find query against a MongoDB collection
- 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.
- List-collections
List all collections for a given database
- List-databases
List all databases for a MongoDB connection
- Remote-atlas-connect
Connect to MongoDB Atlas cluster
- Rename-collection
Renames a collection in a MongoDB database
- 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.
Setup
Setup guide
- 11. In Switchy, open your workspace settings and navigate to the Integrations tab. 2. Click 'Add Integration', search for MongoDB MCP, and select it. 3. Click 'Connect' to start the OAuth flow — you'll authenticate with your MongoDB Atlas account and grant read/write access to your clusters, projects, and database users. 4. If you plan to create clusters or manage infrastructure, you'll also need to provide an Atlas API public key and private key (generate these in Atlas under Organization Access Manager). 5. Once connected, return to Switchy and open any Project. 6. Type '@MongoDB' in the chat to confirm the connection — you should see a list of available tools. 7. Test it by asking '@MongoDB list all collections in the analytics database' or '@MongoDB show me the schema for the users collection'. 8. If the response includes data, the integration is live and ready for your team.
What teammates see: by default, memories from MongoDB MCP are scoped to the Project (PROJECT visibility) - you can mark any memory PRIVATE or share it ORG-wide.
Works well with
Top models
Compatibility data appears once enough Projects have used this MCP together with a given model.
How Switchy teams use it
Starter prompts
Analyze Slow Queries
@MongoDB get performance advisor recommendations for the production cluster and summarize the top three suggested indexes with their impact estimates.
Provision Test Environment
@MongoDB create a new Atlas project called 'feature-branch-testing' and provision a free M0 cluster in us-east-1 with a database user named 'testuser'.
Aggregate User Metrics
@MongoDB run an aggregation on the events collection that groups by date and counts distinct user IDs, then returns the last 30 days of daily active users.
Document Collection Schema
@MongoDB sample 100 documents from the orders collection and describe the schema including field types, nested structures, and any optional fields you detect.
Audit Database Access
@MongoDB list all database users in the production project and show their roles, authentication methods, and last access timestamps if available.
Example outputs
Illustrative - representative of the model's voice and quality, not literal recordings.
@MongoDB show me the top 5 products by revenue in the last quarter, grouped by category
Running aggregation pipeline on the 'products' collection. Results show Electronics led with $2.4M (avg order $340), followed by Home & Garden at $1.8M (avg order $215). The pipeline matched 8,432 orders from Q4 2024, grouped by category, summed revenue, and sorted descending. Full breakdown includes Clothing ($1.2M), Sports ($890K), and Books ($670K). This example illustrates a typical read-heavy analytics query using MongoDB's aggregation framework.
This showcases MongoDB's aggregation pipeline for complex analytics. Requires read permissions on the target collection. Performance depends on index coverage—queries on unindexed fields may be slow on large datasets. The MCP translates natural language into pipeline stages ($match, $group, $sort), but you should verify the generated pipeline matches your schema.
@MongoDB create a new Atlas M10 cluster named 'staging-cluster' in US-EAST-1 with autoscaling enabled
Cluster creation initiated. 'staging-cluster' is provisioning as an M10 replica set in AWS us-east-1 with compute autoscaling (min M10, max M40). Estimated time to ready: 7-10 minutes. Once active, you'll need to create a database user and add your IP to the access list before connecting. This example demonstrates infrastructure provisioning—a write operation that modifies your Atlas organization.
This is a destructive action that incurs billing costs (M10 starts ~$0.08/hour). Requires Atlas organization admin permissions via OAuth2. The cluster won't be immediately accessible—you must separately configure network access and database users. Use Atlas-create-free-cluster for zero-cost experimentation. Always verify cluster tier and region before confirming.
@MongoDB analyze the performance advisor recommendations for my production database and summarize which indexes would have the biggest impact
Performance Advisor found 12 recommendations across 4 collections. Highest impact: adding a compound index on 'orders.{customerId, createdAt}' would improve 3 slow queries averaging 2.3s each (currently doing collection scans on 400K docs). Second priority: index 'users.email' to speed up login queries. The advisor also suggests dropping 2 unused indexes on 'logs' collection (saving 180MB). This synthesis pairs MongoDB's diagnostic tools with AI reasoning to prioritize optimization work.
This example combines MCP data retrieval with AI analysis—the LLM interprets raw performance metrics to surface actionable insights. Requires Atlas project-level read access. Performance Advisor data reflects the last 24 hours of query patterns, so recommendations may not capture weekly/monthly usage spikes. Always test index changes in staging before applying to production.
Frequently asked
What does the MongoDB MCP let me do in Switchy?
It connects your MongoDB Atlas clusters to Switchy's AI workspace so your team can query collections, run aggregations, and manage Atlas resources—clusters, users, IP access lists—without leaving the chat. You can also pull performance advisor recommendations and schema suggestions directly into conversations. It's useful when your team needs to inspect production data or provision infrastructure as part of a workflow.
Do I need MongoDB Atlas admin access to connect this MCP?
Yes. The OAuth2 flow requires permissions to create clusters, database users, and modify access lists, so you'll need an Atlas organization or project admin role. If you only want read access to collections, you can scope down the connection after initial setup, but the 41 available tools assume you're provisioning and managing Atlas resources, not just querying data.
Can this MCP create indexes or modify my MongoDB schema?
It can't directly create indexes, but it surfaces performance advisor suggestions that tell you which indexes to add. You'd still apply those recommendations through the Atlas UI or MongoDB shell. The MCP focuses on orchestration—spinning up clusters, running aggregations, managing users—not low-level DDL operations. For schema changes, use Atlas directly or script them outside Switchy.
Why use this instead of just querying MongoDB from my app's API?
Your app's API is purpose-built for production traffic; this MCP is for ad-hoc exploration and ops tasks your team does in Slack or a shared workspace. You can aggregate across collections, check cluster health, or provision a new environment without writing throwaway scripts. It's faster for one-off questions and keeps the context in the same place your team is already discussing the work.
Who on my team should connect the MongoDB MCP?
Whoever owns your Atlas organization or has project admin rights. Once connected, the whole workspace can use it, but the person who authenticates is responsible for the OAuth token and any Atlas resources the MCP provisions. If you're on a paid Switchy plan, this connection counts as one integration slot, so coordinate with your workspace admin before linking it.