What you can do with MongoDB

Built for

App builders, operators, and agents working with document data in MongoDB

Example workflows

Explore an unfamiliar database

Uses list collections, inspect collection, and get documents.

Try this

List collections in my MongoDB database, inspect the largest collection, then show five sample documents and summarize the main fields.

Find widgets by store

Typical app-data read with query, sort, skip, and limit.

Try this

In the widgets collection, list documents where storeId matches a given id, sorted by updated date, with skip and limit for pagination.

Context to know first

What is MongoDB MCP?

It connects your AI assistant to a MongoDB database you already use — Atlas, DocumentDB, or a local instance via MCPBundles Desktop — so the agent can list collections, read documents, run aggregations, and apply inserts or updates with your permission.

Do I need separate username and password fields?

Not when you connect with a full mongodb:// or mongodb+srv:// connection string that already includes credentials. Add optional fields only if you build the URI from host and password separately.

AI Skill
SKILL.md

Domain knowledge for MongoDB — workflow patterns, data models, and gotchas for your AI agent.

MongoDB

MongoDB stores data in databases → collections → documents. Documents are JSON-like with _id. Works with Atlas, self-hosted, DocumentDB, Cosmos DB MongoDB API. Connection string format: mongodb+srv:// or mongodb://.

Operational order (unfamiliar database)

  1. List databases (when URI allows) and list collections — learn collection names.
  2. Inspect collection or get AI description — sample field shapes and indexes before filtering.
  3. Get documents — pass collection always; use query to list (with skip/limit) or document_id for one _id.
  4. Aggregate when you need $group, $lookup, or analytics — one collection, pipeline as JSON array.
  5. Export / import — export collection to JSON or JSONL; large exports return a presigned download_url. Re-import with mongodb_import_documents via file_url (export link), file_content_base64 (≤1 MB), or local_path with MCPBundles Desktop for files on this computer.
  6. Explain slow finds or pipelines before wide scans.
  7. Indexes — list indexes, create, or drop named indexes; create/drop collections only when the user intends schema changes.
  8. Insert / update / delete / replace only after you know the collection schema; update and delete filters cannot be empty {}.

Data Model

  • Databases — namespaces that contain one or more collections.
  • Collections — document containers; every read or write targets a collection name.
  • Documents — BSON keyed by _id; JSON responses expose ObjectIds as _id.$oid or string hex in descriptions.
  • Queries — filter JSON on get documents, search collections, update, and delete (Extended JSON $oid supported).

Two credential field setups

SetupFieldsRouting
Atlas / remote MongoDBconnection string (preferred) or host + database + optional user/passwordDirect MongoDB wire protocol
Local MongoDB on this machinedatabase, user, password, port (+ desktop tunnel)MCPBundles Desktop to localhost

Gotchas

  • Connection string: Username and password can live inside the URI — separate username/password fields are optional when the URI is set.
  • Single document by id: pass document_id on get documents (plain hex, Extended JSON $oid, not colon handles).
  • Cross-collection discovery: use search collections with a non-empty filter; prefer get documents when the collection is known.
  • Destructive filters: update documents and delete documents reject {} filters.
  • Large exports: mongodb_export_collection returns inline JSON/JSONL under ~512 KB; larger payloads spill to S3 with download_url — pass that URL to mongodb_import_documents as file_url.
  • Large imports: use file_url or Desktop local_path when the file exceeds the 1 MB inline base64 limit.
  • Local MongoDB: Use the Local MongoDB on this computer setup — not a connection string with localhost in it.
  • Atlas connection: Use mongodb+srv:// with credentials in the URI. Network access must allow MCPBundles egress.

Tools in this Server (20)

Mongodb Aggregate

Run a read-only aggregation pipeline on one collection ($match, $group, $lookup, etc.). Pass pipeline as a JSON array. Results are capped for safety.

Mongodb Create Collection

Create an empty collection in the current database.

Mongodb Create Index

Create an index on a collection. Pass keys as JSON with field names and 1 (asc) or -1 (desc).

Mongodb Delete Documents

Delete documents in a collection that match a filter. Query must not be empty {} — narrow the filter so you only remove intended records.

Mongodb Drop Collection

Drop a collection and all of its documents. Requires confirm=true.

Mongodb Drop Index

Drop a named index. Cannot drop the default _id index.

Mongodb Explain Operation

Return MongoDB explain output for a find filter or aggregation pipeline. Use to debug slow queries and index usage before running large reads.

Mongodb Export Collection

Export collection documents to JSON or JSONL. Small exports return inline data; larger exports spill to a presigned S3 download_url (over ~512 KB). Pa...

Mongodb Get AI Description

Get a compact, token-efficient schema description optimized for AI text-to-query generation

Mongodb Get Documents

Read documents from one MongoDB collection. Pass document_id for a single record by _id (use the _id string from a prior list result). Omit document_i...

Mongodb Get Server Info

Get MongoDB server version and build information

Mongodb Import Documents

Bulk-insert documents from a file. Use file_content_base64 for payloads up to 1 MB, file_url for larger HTTP(S) sources (including export spillover li...

Mongodb Insert Documents

Insert one or more documents into a MongoDB collection. Pass an array of JSON objects; _id may be omitted for server-generated ObjectIds. Use inspect ...

Mongodb Inspect Collection

Inspect one collection: estimated document count, index names, and a few sample documents to learn field shapes before writing filters for get documen...

Mongodb List Collections

List all collections in the current database

Mongodb List Databases

List all databases in the MongoDB instance with size information

Mongodb List Indexes

List index definitions for one collection (keys, uniqueness, TTL, partial filters). Use before create index or drop index.

Mongodb Replace Document

Replace one document by _id with a full new document body. Unlike update documents, this overwrites the entire document. Set upsert to create the docu...

Mongodb Search Collections

Find documents across multiple collections in one database. Applies the same filter to up to 20 collections (cap with max_collections). Each hit inclu...

Mongodb Update Documents

Update all documents in a collection that match a filter. Pass a non-empty query and an update JSON object with operators such as $set. Set upsert tru...

Frequently Asked Questions

What is MongoDB MCP?

It connects your AI assistant to a MongoDB database you already use — Atlas, DocumentDB, or a local instance via MCPBundles Desktop — so the agent can list collections, read documents, run aggregations, and apply inserts or updates with your permission.

Do I need separate username and password fields?

Not when you connect with a full mongodb:// or mongodb+srv:// connection string that already includes credentials. Add optional fields only if you build the URI from host and password separately.

How do I connect MongoDB to my AI agent?

Add the MCPBundles server URL to your MCP client configuration (Claude Desktop, Cursor, VS Code, etc.). The URL format is: https://mcp.mcpbundles.com/bundle/mongodb. Authentication is handled automatically.

How many tools does MongoDB provide?

MongoDB provides 20 tools that can be called by AI agents, along with a SKILL.md that gives your AI agent domain knowledge about when and how to use them.

What authentication does MongoDB require?

MongoDB uses API Key. MongoDB requires credentials. Connect via MCPBundles and authentication is handled automatically.

Setup Instructions

Connect MongoDB to any MCP client in minutes

MCP URL
https://mcp.mcpbundles.com/bundle/mongodb

One-click install:

The link prefills the Add custom connector dialog — you still review the values and click Add, then Connect to complete OAuth.

Or add manually

  1. Open claude.ai → Settings → Connectors.
  2. Click the + button and choose Add custom connector.
  3. Set Name to MongoDB and paste the MCP URL into Remote MCP server URL.
  4. Click Add. MongoDB will appear under Not connected — select it and click Connect to complete OAuth.
Name: MongoDB
Remote MCP server URL: https://mcp.mcpbundles.com/bundle/mongodb
Authentication: OAuth

Custom connectors at claude.ai require a paid Claude plan (Pro, Max, Team, or Enterprise).

Ready to use MongoDB?

Sign in to connect your credentials and start running tools from the chat.

MongoDB MCP Server for Atlas & Self-Hosted