How to connect MongoDB to Grok Bot

Connect Grok Bot to MongoDB MCP. List collections in your production database, query top slow queries from cluster, and more using natural language, with authentication handled for you.

MongoDB MCP logoMongoDB MCP
S2s Oauth2

MongoDB MCP is MongoDB's managed interface for accessing Atlas resources and data. Use it for secure, centralized access to clusters, databases, and collections.

41 Tools

Introduction

Grok is xAI's assistant, and its bot builder lets you create a personal agent that holds context, runs skills, and connects to the apps you already use through plugins.

This guide explains how to connect MongoDB to a Grok bot using Composio Connect, which handles OAuth, token refresh, and reliability so you do not have to. You add Composio as a plugin, authenticate once, then ask your bot to work with MongoDB in plain language.

For exact tool slugs and parameter tables, see the tool catalog in the Composio docs.

Also integrate MongoDB MCP with

Why use Composio?

Composio exposes 2,000+ apps to your Grok bot through a single connection, so you get:

  • Connect to 2,000+ apps with on-demand tool loading, so you do not fill your context window with unnecessary tool definitions.
  • Use programmatic tool calling through a remote workbench, letting the model write its own code to handle complex tool chaining. This reduces back-and-forth for frequent tool calls.
  • Handle large tool responses outside the model context to keep conversations lean.

Connecting MongoDB to Grok Bot

Once Grok Bot is set up, you connect MongoDB entirely from its interface, and the whole flow takes under a minute.

Set up Grok Bot

Get access. Grok Bot is included with Cursor Ultra, Cursor Premium Teams, and SuperGrok Heavy. Get the desktop app for macOS or Windows from x.ai/bot and sign in. An iPhone companion app is also available, and your bots sync across devices.

Create a bot. Pick a suggested role or define your own, then give it a short name, one primary job, and a short description of how it should work. Focused bots work best, because a clear role gives the bot more useful context over time.

Connect MongoDB

1. Add the Composio plugin

Click the button. The Composio listing on x.ai opens and launches Grok Bot for you. If the app does not open on its own, click Add to Grok Bot.

Add to Grok Bot

Composio for Grok Bot listing on x.ai with the Add to Grok Bot button

Grok Bot opens the Composio plugin, showing its connector and skills. Click Add.

Composio plugin sheet in Grok Bot with the Add button

2. Authenticate

Go to the Installed section and click the Composio entry. You'll see its connector and skills listed.

Installed Composio plugin showing the Authenticate button

Click Authenticate. You'll be taken to the Composio consent screen. Review the access it requests and click Authorize. Composio handles the OAuth handshake for you, so you never touch API keys or tokens.

Composio authorization screen with Authorize and Deny

3. Connect your MongoDB account

Back in the chat, ask your bot to connect to MongoDB or give it any MongoDB task.

For example, ask it to:

  • "List collections in your production database"
  • "Query top slow queries from cluster"
  • "Create index on users.email field"

It will prompt you to authenticate and authorize access.

That's it. Composio's tools are now available in your Grok bot, and your MongoDB account is ready to use.

What is Grok Bot?

Grok is xAI's assistant, available as a chat interface and a bot builder for creating personal agents that run skills and connect to external apps.

With Composio Connect, your Grok bot can securely access apps like MongoDB through MCP without you sharing account credentials directly with the agent.

What is the MongoDB MCP server, and what's possible with it?

The MongoDB MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your MongoDB account. It provides structured and secure access to your MongoDB Atlas resources, databases, collections, documents, indexes, and performance data, so your agent can explore data, run queries, manage collections, optimize indexes, and administer Atlas resources on your behalf.

  • Database exploration and analysis: Have your agent list databases and collections, inspect schemas and storage use, count documents, and review database statistics.
  • Document queries and data changes: Direct your agent to find or aggregate documents, insert multiple records, or delete records that match a filter.
  • Collection and index management: Let the agent create, rename, or drop collections, inspect existing indexes, and create or remove indexes.
  • Query and performance optimization: Instruct your agent to explain query execution and retrieve Atlas performance recommendations for indexes, schemas, and recent operations.
  • Atlas resource administration: Have your agent create and inspect projects, clusters, database users, and network access lists, list alerts, load sample data, or pause, resume, and upgrade supported clusters.

Way Forward

Now that MongoDB is connected, extend your setup by connecting the other apps you already use every day, so your Grok bot can run true cross-app workflows end to end.

  • Connect Calendar to turn threads into scheduled meetings automatically.
  • Connect Slack or Teams to post summaries, approvals, and alerts where your team works.
  • Connect Notion, Linear, Jira, or Asana to convert requests into tickets, tasks, and docs.
  • Connect Drive, Dropbox, or OneDrive to fetch, file, and share attachments without manual steps.

Start with one workflow you do repeatedly, then keep adding apps as you find new handoffs. With everything behind a single connection, your bot can coordinate multiple tools safely and reliably in one conversation.

TOOLS

Supported Tools

Every MongoDB MCP action and event your agent gets out of the box.

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).

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.

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.

Atlas pause resume cluster

Pause or resume a dedicated (M10+) MongoDB Atlas cluster (Free and Flex clusters cannot be paused).

Atlas streams build

Create Atlas Stream Processing resources.

Atlas streams discover

Discover and inspect Atlas Stream Processing resources.

Atlas streams manage

Manage Atlas Stream Processing resources: start/stop processors, modify pipelines, update configurations.

Atlas streams teardown

Delete Atlas Stream Processing resources.

Atlas upgrade cluster

Upgrade a MongoDB Atlas cluster tier.

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.

Create index

Create an index for a collection

Db stats

Returns statistics that reflect the use state of a single database

Delete many

Removes all documents that match the filter from a MongoDB collection

Drop collection

Removes a collection or view from the database.

Drop database

Removes the specified database, deleting the associated data files

Drop index

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.

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.

FAQ

Frequently asked questions

Start with MongoDB MCP.It takes 30 seconds.

Managed auth, hosted MCP servers, and every MongoDB MCP tool your agent needs.Free to start.

Start building