Skip to main content
The mongodb MCP adapter connects with a MongoDB URI (mongodb:// or mongodb+srv://) and a default database name. It provides document reads, writes, counts, and aggregation pipelines using Extended JSON filters. Use it for operational data sync, event enrichment, analytics pipelines, webhook ingestion, and document-backed agents — complementary to Firestore on Google Cloud or Postgres for relational reporting.

Prerequisites

  • A MongoDB deployment (self-hosted, Atlas, or compatible) reachable from AgentRuntime
  • A connection URI with credentials (mongodb:// or mongodb+srv://)
  • A default database name for collection operations
  • Database user with read for reporting; readWrite only on collections workflows must modify
  • Atlas IP allowlist or VPC peering configured if the cluster is network-restricted
  • project_contributor access

Connect in AgentRuntime

1

Create a connection

Go to Connections and click New custom connection to create a database connection with your MongoDB URI and default database:
Set URI to the connection string and Database to the default database name (e.g. production). Include authSource in the URI when credentials live in the admin database.
2

Add mongodb MCP instance

Go to MCP, click Add instance for mongodb, wire your connection on Instance config, set the profile active, and save.
3

Test with a document count

Add a workflow with mcp_callmongodb_count_documents on a known collection. Run it to confirm connectivity before production reads or writes.
4

Inspect a sample document (optional)

Run mcp_callmongodb_find_one with an empty filter_json on a test collection to verify collection access and field shapes.
See Authentication for binding connections to MCP instances.

What you can build

  • Lead enrichment — Webhook payload → mongodb_find_one existing contact → merge external API data → mongodb_update_one.
  • Usage analyticsmongodb_aggregate pipeline on events → LLM narrative → scheduled Resend digest.
  • Ticket triagemongodb_find open tickets → LLM priority scoring → mongodb_update_many to set status.
  • Approval-gated deleteshuman_task before mongodb_delete_many on production collections.

Tools

Example

Find recent signups for a welcome workflow:
Reference documents in a downstream step:

Configuration

Troubleshooting