integrations tools mongodb

    MongoDB MCP for your AI agent

    Cogny's MongoDB integration exposes 8 tools (8 read) to an AI agent over MCP. The same tools are available on every plan, from your own AI client or inside the Cogny app.

    • 8readonly reads data.
    • 0writecreates or changes something.
    • 0destructivedeletes, removes or replaces something.

    Over MCP your own AI client asks before it runs a write. To take a tool away from your agent, block it in Settings → Integrations. Plans, approvals and limits

    set it up.

    Add Cogny to your AI client once, then connect MongoDB in Cogny. Every MongoDB tool below appears in the client.

    • Claude CodeRun claude mcp add --transport http cogny https://app.cogny.com/mcp, then authorise in the browser.
    • Claude.aiSettings → Connectors → Add custom connector, URL https://app.cogny.com/mcp, then log in and pick your workspace.
    • ChatGPTSettings → Apps → Advanced settings → Developer mode → Create app, URL https://app.cogny.com/mcp, authentication OAuth.
    • CursorIn Cogny, Settings → Data & Integrations → Connect AI Clients shows the block to paste into .mcp.json, with an API key.
    • CodexRun codex mcp add cogny --url https://app.cogny.com/mcp.

    Full setup, and how to undo it

    Notes

    MongoDB connects with the connection string of a database user, for example mongodb+srv://cogny_reader:<password>@cluster0.abcde.mongodb.net/shop from Atlas → Connect → Drivers, or a mongodb:// string for a self-hosted server. The database after the host (/shop) is the default for every tool; each tool also takes a database argument. Characters like @, : and / in the password must be percent-encoded (%40, %3A, %2F).

    Create a user that can only read:

    • Atlas: Security → Database & Network Access → Database Users → Add New Database User, Password authentication, built-in role "Only read any database" (or the read role on just the databases Cogny should see, under Specific Privileges).
    • Self-hosted: db.createUser({user: "cogny_reader", pwd: "<strong password>", roles: [{role: "read", db: "<your database>"}]}).

    get_server_info lists the user's roles and warns when one of them can write.

    Every Cogny connection comes from 207.175.17.47. On Atlas, add it under Database & Network Access → IP Access List; on your own server, allow it in the firewall. The server must be reachable from the internet and use TLS with a certificate from a public certificate authority (Atlas does by default).

    Filters, projections, sorts and pipelines are JSON in MongoDB Extended JSON, so an ObjectId is {"$oid": "…"} and a date is {"$date": "2026-10-01T00:00:00Z"}. describe_collection infers the fields from a random sample of up to 500 documents: a field that only a few documents have may not show up.

    Every operation stops after 60 seconds. find_documents returns up to 1,000 documents per call (50 by default), run_aggregation up to 2,000 rows (200 by default) and get_distinct_values up to 5,000 values, and each says when a result was cut. Large documents are shortened: long strings, long arrays and deep nesting are trimmed, and a response stops at about 500,000 characters. Aggregate with run_aggregation rather than paging through raw documents.

    Known gaps

    • Read only. No tools insert, update or delete documents, or create collections, indexes or users.
    • $out and $merge (which write), $where, $function and $accumulator (server-side JavaScript) and $changeStream are refused.
    • Only username/password (SCRAM) users. X.509 certificates, AWS IAM, OIDC/workload identity and Kerberos/LDAP logins can't be connected.
    • Connection-string options that turn off certificate checks, point at local certificate files or route through a proxy are refused, and so is tls=false.
    • A MongoDB reachable only inside a private network (VPC peering, Private Endpoint, PrivateLink) can't be connected.
    • No Atlas administration: clusters, backups, alerts, Atlas Search index management and the Atlas Data API are not covered.
    • No change streams or live updates; each call reads the data as it is at that moment.

    what each tool does.

    Read 8 · only reads data

    • get_server_infoReadCheck the MongoDB connection: the database user, its roles, the server version and whether the user could write.
    • list_databasesReadList the databases the connected user can read, with their size on disk.
    • list_collectionsReadList the collections and views in a database, with approximate document counts.
    • describe_collectionReadShow a collection's fields and their types (inferred from a random sample), its indexes, document count and a few example documents.
    • find_documentsReadFind documents in a collection with a filter, projection and sort.
    • count_documentsReadCount the documents in a collection that match a filter.
    • run_aggregationReadRun a read-only aggregation pipeline on a collection and return the result rows.
    • get_distinct_valuesReadList the distinct values of one field in a collection, optionally within a filter.

    Exact input schemas come from tools/list once MongoDB is connected; the free plan is enough to check. Missing something? Your agent can ask for it with request_feature.