mongodb-atlas-admin
Manage MongoDB Atlas clusters, projects, users, backups, and alerts via the Atlas Admin API v2. Use when: (1) Creating, scaling, or deleting Atlas clusters, (2) Managing database users and IP access lists, (3) Configuring backups, snapshots, and restore jobs, (4) Setting up alerts and monitoring, (5) Managing projects and organizations, (6) Viewing cluster metrics and logs. Requires Atlas API keys (public/private) or service account credentials.
- License 许可
- MIT
- 最近更新
- 2026-08-23
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- mongodb-atlas-admin
- metadata
- { "clawdbot": { "emoji": "?", "author": { "name": "Michael Lynn", "github": "mrlynn", "website": "https://mlynn.org", "linkedin": "https://linkedin.com/in/mlynn" }, "requires": { "bins": [ "curl", "jq" ] } } }
- description
- Manage MongoDB Atlas clusters, projects, users, backups, and alerts via the Atlas Admin API v2. Use when: (1) Creating, scaling, or deleting Atlas clusters, (2) Managing database users and IP access lists, (3) Configuring backups, snapshots, and restore jobs, (4) Setting up alerts and monitoring, (5) Managing projects and organizations, (6) Viewing cluster metrics and logs. Requires Atlas API keys (public/private) or service account credentials.
02 资源文件 3
- 参考文档_meta.json290 B
- 参考文档references/api-endpoints.md9.7 KB
- 脚本scripts/atlas.sh9.2 KB
03 SKILL.md 正文
MongoDB Atlas Admin
Manage MongoDB Atlas infrastructure programmatically via the Atlas Administration API v2.
Authentication
Atlas API uses HTTP Digest Authentication with API keys or OAuth2 with service accounts.
API Keys (Legacy but simpler)
# Set credentials
export ATLAS_PUBLIC_KEY="your-public-key"
export ATLAS_PRIVATE_KEY="your-private-key"
# All requests use digest auth
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" \
--digest \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
"https://cloud.mongodb.com/api/atlas/v2/..."
Service Accounts (OAuth2 - Recommended)
# Get access token
TOKEN=$(curl -s --request POST \
"https://cloud.mongodb.com/api/oauth/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=client_credentials&client_id=${CLIENT_ID}&client_secret=${CLIENT_SECRET}" \
| jq -r '.access_token')
# Use token (valid 1 hour)
curl --header "Authorization: Bearer ${TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/..."
Quick Reference
| Task | Endpoint | Method |
|---|---|---|
| List projects | /groups |
GET |
| Create project | /groups |
POST |
| List clusters | /groups/{groupId}/clusters |
GET |
| Create cluster | /groups/{groupId}/clusters |
POST |
| Get cluster | /groups/{groupId}/clusters/{clusterName} |
GET |
| Update cluster | /groups/{groupId}/clusters/{clusterName} |
PATCH |
| Delete cluster | /groups/{groupId}/clusters/{clusterName} |
DELETE |
| List DB users | /groups/{groupId}/databaseUsers |
GET |
| Create DB user | /groups/{groupId}/databaseUsers |
POST |
| List IP access | /groups/{groupId}/accessList |
GET |
| Add IP access | /groups/{groupId}/accessList |
POST |
Clusters
List All Clusters in Project
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters"
Get Cluster Details
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}"
Create Cluster (M10+)
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters" \
-d '{
"name": "my-cluster",
"clusterType": "REPLICASET",
"replicationSpecs": [{
"regionConfigs": [{
"providerName": "AWS",
"regionName": "US_EAST_1",
"priority": 7,
"electableSpecs": {
"instanceSize": "M10",
"nodeCount": 3
}
}]
}]
}'
Create Free Tier Cluster (M0)
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters" \
-d '{
"name": "free-cluster",
"clusterType": "REPLICASET",
"replicationSpecs": [{
"regionConfigs": [{
"providerName": "TENANT",
"backingProviderName": "AWS",
"regionName": "US_EAST_1",
"priority": 7,
"electableSpecs": {
"instanceSize": "M0",
"nodeCount": 3
}
}]
}]
}'
Scale Cluster (Change Instance Size)
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}" \
-d '{
"replicationSpecs": [{
"regionConfigs": [{
"providerName": "AWS",
"regionName": "US_EAST_1",
"priority": 7,
"electableSpecs": {
"instanceSize": "M20",
"nodeCount": 3
}
}]
}]
}'
Delete Cluster
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-X DELETE "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}"
Pause/Resume Cluster
# Pause (M10+ only)
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}" \
-d '{"paused": true}'
# Resume
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}" \
-d '{"paused": false}'
Projects (Groups)
List All Projects
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups"
Create Project
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups" \
-d '{
"name": "my-project",
"orgId": "YOUR_ORG_ID"
}'
Delete Project
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-X DELETE "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}"
Database Users
List Database Users
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/databaseUsers"
Create Database User
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/databaseUsers" \
-d '{
"databaseName": "admin",
"username": "myuser",
"password": "securePassword123!",
"roles": [{
"databaseName": "admin",
"roleName": "readWriteAnyDatabase"
}]
}'
Delete Database User
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-X DELETE "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/databaseUsers/admin/${USERNAME}"
IP Access List
List IP Access Entries
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/accessList"
Add IP Address
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/accessList" \
-d '[{
"ipAddress": "192.168.1.1",
"comment": "Office IP"
}]'
Allow All IPs (Development Only!)
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/accessList" \
-d '[{
"cidrBlock": "0.0.0.0/0",
"comment": "Allow all - DEV ONLY"
}]'
Backups & Snapshots
List Snapshots
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}/backup/snapshots"
Take On-Demand Snapshot
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}/backup/snapshots" \
-d '{
"description": "Pre-deployment snapshot",
"retentionInDays": 7
}'
Restore From Snapshot
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
-H "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/clusters/${CLUSTER_NAME}/backup/restoreJobs" \
-d '{
"snapshotId": "SNAPSHOT_ID",
"deliveryType": "automated",
"targetClusterName": "restored-cluster",
"targetGroupId": "${GROUP_ID}"
}'
Alerts
List Alert Configurations
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/alertConfigs"
Get Active Alerts
curl --user "${ATLAS_PUBLIC_KEY}:${ATLAS_PRIVATE_KEY}" --digest \
-H "Accept: application/vnd.atlas.2025-03-12+json" \
"https://cloud.mongodb.com/api/atlas/v2/groups/${GROUP_ID}/alerts?status=OPEN"
Instance Sizes
| Tier | vCPUs | RAM | Storage | Use Case |
|---|---|---|---|---|
| M0 | Shared | Shared | 512 MB | Free tier, dev/learning |
| M2 | Shared | Shared | 2 GB | Small dev projects |
| M5 | Shared | Shared | 5 GB | Larger dev projects |
| M10 | 2 | 2 GB | 10 GB | Dev/staging, low traffic |
| M20 | 2 | 4 GB | 20 GB | Light production |
| M30 | 2 | 8 GB | 40 GB | Production |
| M40 | 4 | 16 GB | 80 GB | High-traffic production |
| M50 | 8 | 32 GB | 160 GB | Large production |
| M60+ | 16+ | 64+ GB | 320+ GB | Enterprise |
Helper Script
For convenience, use scripts/atlas.sh wrapper:
# Usage
./scripts/atlas.sh <command> [args]
# Examples
./scripts/atlas.sh projects list
./scripts/atlas.sh clusters list <project-id>
./scripts/atlas.sh clusters create <project-id> <name> <size> <region>
./scripts/atlas.sh clusters delete <project-id> <name>
./scripts/atlas.sh clusters pause <project-id> <name>
./scripts/atlas.sh users list <project-id>
./scripts/atlas.sh users create <project-id> <username> <password>
Environment Variables
# Required
export ATLAS_PUBLIC_KEY="..."
export ATLAS_PRIVATE_KEY="..."
# Optional (for service accounts)
export ATLAS_CLIENT_ID="..."
export ATLAS_CLIENT_SECRET="..."
# Common IDs
export ATLAS_ORG_ID="..." # Organization ID
export ATLAS_GROUP_ID="..." # Project/Group ID
API Reference
- Base URL:
https://cloud.mongodb.com/api/atlas/v2 - Accept Header:
application/vnd.atlas.2025-03-12+json - Full Docs: https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/
- OpenAPI Spec: https://github.com/mongodb/atlas-sdk-go/blob/main/openapi/atlas-api.yaml
For detailed endpoint documentation, see references/api-endpoints.md.
Author
Michael Lynn — Principal Staff Developer Advocate at MongoDB
- ? Website: mlynn.org
- ? GitHub: @mrlynn
- ? LinkedIn: linkedin.com/in/mlynn
Issues & contributions welcome on GitHub!
04 同仓库更多 Skills
crowd-prompting
A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.
dilemm-ai
Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
arxiv-paper-reviews
Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.