Purpose
MongoDB Atlas MCP Server is a Model Context Protocol (MCP) server used to provide access to the MongoDB Atlas API. Internally it uses the mongodb-atlas-api-client package to wrap MongoDB Atlas functionality as MCP tools for invocation by MCP-compatible clients. This server exposes most of the interfaces of mongodb-atlas-api-client.
Main Capabilities
The MCP tools provided by the server are grouped by functional area as follows:
- Database Users: user_get (get by username), user_get_all (list all), user_create, user_update, user_delete.
- Clusters: cluster_get, cluster_get_all, cluster_create, cluster_update, cluster_delete; cluster_get_advanced_configuration and cluster_update_advanced_configuration (processArgs advanced configuration); cluster_test_primary_failover (initiate a test primary failover).
- Projects: project_get_by_id, project_get_by_name, project_get_all, project_create, project_delete; project_get_teams (list project teams), project_remove_user (remove a project user), project_assign_teams (assign teams).
- Cloud Backup: cloud_backup_get_snapshots (list replica set snapshots), cloud_backup_get_snapshot (get a specified snapshot), cloud_backup_get_restore_job (get a snapshot restore job), cloud_backup_create_restore_job (create a snapshot restore job).
- Organizations: organization_get_by_id, organization_get_all, organization_get_users, organization_get_projects, organization_delete, organization_rename, organization_invite.
- Project Access List (current): project_access_list_get_all, project_access_list_get, project_access_list_create, project_access_list_update (POST-semantics upsert), project_access_list_delete.
- Project Whitelist (legacy): project_whitelist_get_all, project_whitelist_get, project_whitelist_create, project_whitelist_update, project_whitelist_delete.
- Events: events_get_all (list project events), events_get (get project-scoped event by ID), events_get_by_org (get organization event by ID), events_get_all_by_org (list organization events).
- Atlas Search: atlas_search_get_all (list collection indexes), atlas_search_create, atlas_search_get, atlas_search_update, atlas_search_delete, atlas_search_get_all_analyzers (list analyzers), atlas_search_upsert_analyzer (create/update analyzer).
- Atlas Users (account-level): atlas_user_get_by_name, atlas_user_get_by_id, atlas_user_get_all (list project Atlas users), atlas_user_create, atlas_user_update.
- Alerts: alert_get_all (list project alerts), alert_get, alert_acknowledge.
- Data Lake: datalake_get, datalake_get_all, datalake_create, datalake_update, datalake_delete, datalake_get_logs_stream (retrieve query logs, returns base64-encoded gzip data).
- Cloud Provider Access: cloud_provider_access_get_all, cloud_provider_access_create, cloud_provider_access_update, cloud_provider_access_delete.
How to Use
1. Clone the repository and install dependencies
Clone the repository and install dependencies (the official materials do not give the specific content of the installation command).
2. Set environment variables
Before using the server, you need to set environment variables containing MongoDB Atlas API credentials.
Required environment variables:
- MONGODB_ATLAS_PUBLIC_KEY: MongoDB Atlas API public key
- MONGODB_ATLAS_PRIVATE_KEY: MongoDB Atlas API private key
- MONGODB_ATLAS_PROJECT_ID: MongoDB Atlas project/group ID
Optional environment variables:
- MONGODB_ATLAS_BASE_URL: Atlas API base URL (defaults to https://cloud.mongodb.com/api/atlas/v1.0 )
3. Obtain an Atlas API key
- Log in to MongoDB Atlas.
- Go to Organization Settings → Access Manager → API Keys.
- Click Create API Key.
- Assign appropriate permissions (Project Read/Write access is recommended).
- Copy the public key and private key.
- Find the Project ID in the project settings.
4. Configuration example
The official materials provide an example configuration method, or create a .env file (the specific example content is not fully shown in the materials).
5. Run the server
After running the server, it can be used with any MCP-compatible client. The server communicates via stdin/stdout.
Example tool usage
The official materials provide example tool usage; it states that logs are returned as base64-encoded gzip data in the text response, and you need to first decode the base64 and then decompress (gunzip) it in order to read it.
Development mode
The official materials mention that it can be run in development mode.
Dependencies and References
- @modelcontextprotocol/sdk: MCP SDK used for the server implementation.
- mongodb-atlas-api-client: MongoDB Atlas API client library.
Applicable Scenarios
Suitable for scenarios where MongoDB Atlas is already in use and you want to centrally manage and query Atlas resources through tool calls via an MCP-compatible client, such as managing database users, clusters, projects, organizations, backups, access lists, Atlas Search indexes, alerts, Data Lake, and cloud provider access, etc.
Limitations
- Requires MongoDB Atlas API credentials (public key, private key, project ID) and requires assigning appropriate permissions.
- The server communicates via stdin/stdout and requires an MCP-compatible client.
- The server provides detailed error information for the following situations: missing or invalid API credentials, network connection issues, invalid parameters, MongoDB Atlas API errors.
- The specific request/response parameters of some tools, installation commands, run commands, and the complete content of configuration examples are not fully mentioned in the official materialsprovided; log-type tools return base64-encoded gzip data, which requires additional decoding and decompression.