> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Administer MongoDB Atlas Clusters With Agents

> Let agents manage Atlas clusters, database users, and projects through the Administration API, using service account credentials they never see.

## Overview

Buckle connects AI agents to MongoDB Atlas through the Atlas Administration API. Agents can manage clusters, database users, projects, and organizations. The gateway injects credentials into requests to `cloud.mongodb.com` automatically.

Unlike most integrations, MongoDB Atlas uses service account client credentials (OAuth2 client credentials grant) rather than a browser-based OAuth flow.

## What you will set up

* An Atlas service account with the permissions your agents need
* A connection that exchanges client credentials for access tokens
* Per-agent, per-tool access, such as approval before deleting clusters

## Setup

**1. Create a service account in Atlas**

Go to the [MongoDB Atlas dashboard](https://cloud.mongodb.com), navigate to **Access Manager** > **API Keys** or **Service Accounts**, and create a new service account with the permissions your agents need.

Note the **Client ID** and **Client Secret**.

**2. Connect in Buckle**

Open the Buckle dashboard, go to **Settings** > **Apps** > **MongoDB Atlas**, and enter your Client ID and Client Secret.

![Buckle connect window for MongoDB Atlas, showing the setup guide link and the fields to fill in.](https://mintcdn.com/onecli-17d3f772/h1DTAVlDkLshz4JZ/images/integrations/mongodb-atlas/buckle-connect-mongodb-atlas.png?fit=max\&auto=format\&n=h1DTAVlDkLshz4JZ\&q=85\&s=35aeca765e4bb809b86607b270af58f2)

The MongoDB Atlas connect window in Buckle.

Buckle exchanges these for an OAuth2 access token automatically and refreshes it as needed.

## What agents can do

| Area | Examples |
| - | - |
| **Clusters** | List, create, modify, and delete clusters |
| **Database Users** | Manage database users and roles |
| **Projects** | View and manage Atlas projects |
| **Organizations** | Read organization metadata |
| **Network Access** | Manage IP access lists |
| **Backups** | View and manage backup snapshots |

## Use cases

* Infrastructure agents that provision and scale MongoDB clusters
* Database management agents that create users and configure access
* Monitoring agents that check cluster health and metrics
* Migration agents that manage backup and restore operations

## Controlling access

Access is per agent: [grant](/docs/guides/agent-access.md) the connection to each agent that needs it, choosing per tool what runs freely, what needs human approval, and what stays blocked — a read-only agent is a single grant. Organization [rules](/docs/guides/rules.md) add guardrails on top, like rate limits and blanket blocks. Everything is checked before credential injection, so a blocked request never reaches the Atlas API.

## FAQ

> [accordion] How do I rotate the Atlas client secret?
>
> Create a new secret for the service account in Atlas, then update it in **Settings** > **Apps** > **MongoDB Atlas**. Agents pick it up automatically. Access tokens are refreshed for you.

> [accordion] How do I keep Atlas credentials out of the agent's context?
>
> Store the client ID and secret in Buckle. The gateway exchanges them for tokens and injects them at the proxy. See [How it works](/docs/how-it-works.md).

> [accordion] Can I require approval before cluster changes?
>
> Yes. Put write tools behind approval when you [grant](/docs/guides/agent-access.md) the connection, and add [rules](/docs/guides/rules.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.