montumodi/mongodb-atlas-mcp-server
๐ โ๏ธ ๐ช ๐ ๐ง - A Model Context Protocol (MCP) that provides access to the MongoDB Atlas API. This server wraps the mongodb-atlas-api-client package to expose MongoDB Atlas functionality through MCP tools.
Quick Install
{
"mcpServers": {
"montumodi-mongodb-atlas-mcp-server": {
"command": "npx",
"args": [
"-y",
"montumodi-mongodb-atlas-mcp-server"
]
}
}
}Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.
Documentation Overview
MongoDB Atlas MCP Server
A Model Context Protocol (MCP) server that provides access to the MongoDB Atlas API. This server wraps the mongodb-atlas-api-client package to expose MongoDB Atlas functionality through MCP tools.
Features
This MCP server exposes most of the mongodb-atlas-api-client surface as MCP tools.
Database Users
user_getโ Get a database user by usernameuser_get_allโ List all database usersuser_createโ Create a database useruser_updateโ Update a database useruser_deleteโ Delete a database user
Clusters
cluster_getโ Get cluster detailscluster_get_allโ List clusterscluster_createโ Create clustercluster_updateโ Update clustercluster_deleteโ Delete clustercluster_get_advanced_configurationโ Get processArgs (advanced config)cluster_update_advanced_configurationโ Update processArgs (advanced config)cluster_test_primary_failoverโ Initiate a test primary failover
Projects
project_get_by_idโ Get project by IDproject_get_by_nameโ Get project by nameproject_get_allโ List projectsproject_createโ Create projectproject_deleteโ Delete projectproject_get_teamsโ List teams for a projectproject_remove_userโ Remove a user from a projectproject_assign_teamsโ Assign teams to a project
Cloud Backups
cloud_backup_get_snapshotsโ List cloud backup snapshots (replicaset)cloud_backup_get_snapshotโ Get a specific snapshotcloud_backup_get_restore_jobโ Get a snapshot restore jobcloud_backup_create_restore_jobโ Create a snapshot restore job
Organizations
organization_get_by_idโ Get organization by IDorganization_get_allโ List organizationsorganization_get_usersโ List users in an organizationorganization_get_projectsโ List projects in an organizationorganization_deleteโ Delete organizationorganization_renameโ Rename organizationorganization_inviteโ Invite users to organization
Project Access Lists (current)
project_access_list_get_allโ List IP access list entriesproject_access_list_getโ Get a specific access list entryproject_access_list_createโ Add entries to access listproject_access_list_updateโ Upsert access list entries (POST semantics)project_access_list_deleteโ Delete an access list entry
Project Whitelist (legacy)
project_whitelist_get_allโ List whitelist entriesproject_whitelist_getโ Get a whitelist entryproject_whitelist_createโ Add whitelist entriesproject_whitelist_updateโ Update whitelist entriesproject_whitelist_deleteโ Delete a whitelist entry
Events
events_get_allโ List project eventsevents_getโ Get event by ID (project scope)events_get_by_orgโ Get event by ID for an organizationevents_get_all_by_orgโ List organization events
Atlas Search
atlas_search_get_allโ List indexes for a collectionatlas_search_createโ Create an indexatlas_search_getโ Get index by IDatlas_search_updateโ Update index by IDatlas_search_deleteโ Delete index by IDatlas_search_get_all_analyzersโ List analyzersatlas_search_upsert_analyzerโ Create/Update analyzers
Atlas Users (Account-level)
atlas_user_get_by_nameโ Get Atlas user by usernameatlas_user_get_by_idโ Get Atlas user by IDatlas_user_get_allโ List Atlas users for the projectatlas_user_createโ Create Atlas useratlas_user_updateโ Update Atlas user
Alerts
alert_get_allโ List project alertsalert_getโ Get alert by IDalert_acknowledgeโ Acknowledge alert
Data Lake
datalake_getโ Get Data Lake by namedatalake_get_allโ List Data Lakesdatalake_createโ Create Data Lakedatalake_updateโ Update Data Lakedatalake_deleteโ Delete Data Lakedatalake_get_logs_streamโ Get query logs (returns base64-encoded gzip data)
Cloud Provider Access
cloud_provider_access_get_allโ List cloud provider access rolescloud_provider_access_createโ Create a rolecloud_provider_access_updateโ Update a role (roleId + body)cloud_provider_access_deleteโ Delete a role (cloudProvider + roleId)
Installation
- Clone this repository:
git clone https://github.com/montumodi/mongodb-atlas-mcp-server.git
cd mongodb-atlas-mcp-server
- Install dependencies:
npm install
Configuration
Before using the server, you need to set up environment variables with your MongoDB Atlas API credentials:
Required Environment Variables
MONGODB_ATLAS_PUBLIC_KEY- Your MongoDB Atlas API public keyMONGODB_ATLAS_PRIVATE_KEY- Your MongoDB Atlas API private keyMONGODB_ATLAS_PROJECT_ID- Your MongoDB Atlas project/group ID
Optional Environment Variables
MONGODB_ATLAS_BASE_URL- Atlas API base URL (defaults tohttps://cloud.mongodb.com/api/atlas/v1.0)
Getting Atlas API Keys
- Log in to MongoDB Atlas
- Go to Organization Settings โ Access Manager โ API Keys
- Click Create API Key
- Assign appropriate permissions (Project Read/Write access recommended)
- Copy the public and private keys
- Find your Project ID in the project settings
Example Configuration
export MONGODB_ATLAS_PUBLIC_KEY="your-public-key"
export MONGODB_ATLAS_PRIVATE_KEY="your-private-key"
export MONGODB_ATLAS_PROJECT_ID="your-project-id"
Or create a .env file:
MONGODB_ATLAS_PUBLIC_KEY=your-public-key
MONGODB_ATLAS_PRIVATE_KEY=your-private-key
MONGODB_ATLAS_PROJECT_ID=your-project-id
Usage
Running the Server
npm start
Using with MCP Clients
This server implements the Model Context Protocol and can be used with any MCP-compatible client. The server communicates over stdin/stdout.
Example Tool Usage
Get All Clusters
{
"name": "cluster_get_all",
"arguments": {
"options": {
"itemsPerPage": 10
}
}
}
Create a Database User
{
"name": "user_create",
"arguments": {
"body": {
"username": "newuser",
"password": "securepassword123",
"roles": [
{
"databaseName": "myapp",
"roleName": "readWrite"
}
],
"databaseName": "admin"
}
}
}
Get Project Events
Get Data Lake Logs (example)
Note: The logs are returned as base64-encoded gzip data in the text response. Decode base64 and then gunzip to read.
{
"name": "datalake_get_logs_stream",
"arguments": { "dataLakeName": "MyDataLake" }
}
{
"name": "events_get_all",
"arguments": {
"options": {
"itemsPerPage": 20,
"eventType": ["CLUSTER"]
}
}
}
Error Handling
The server provides detailed error messages for:
- Missing or invalid API credentials
- Network connectivity issues
- Invalid parameters
- MongoDB Atlas API errors
Development
Running in Development Mode
npm run dev
Testing
npm test
Dependencies
- @modelcontextprotocol/sdk - MCP SDK for server implementation
- mongodb-atlas-api-client - MongoDB Atlas API client library
API Reference
This server exposes MongoDB Atlas API functionality through MCP tools. For detailed information about the underlying Atlas API, refer to:
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT
Support
For issues and questions:
- Check the MongoDB Atlas API Documentation
- Review the mongodb-atlas-api-client documentation
- Open an issue in this repository