MongoDB Atlas MCP Server

Official

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides tools for managing MongoDB Atlas projects, including creating and configuring clusters, managing database users, setting up network access, and retrieving connection strings.

MongoDB Atlas MCP 服务器

用于管理 MongoDB Atlas 项目的 MCP(模型上下文协议)服务器。此软件包提供了通过 MCP 接口创建和管理 MongoDB Atlas 集群、用户和网络访问的工具。

演示视频

观看演示视频,了解 MongoDB Atlas MCP Server 的实际运行情况。

特征

MCP 工具

  • create_atlas_cluster - 在现有项目中创建一个新的 MongoDB Atlas 集群
  • setup_atlas_network_access - 为 Atlas 项目配置网络访问
  • create_atlas_user - 创建具有 atlasAdmin 角色的新数据库用户
  • get_atlas_connection_strings - 检索集群的连接字符串
  • list_atlas_projects - 列出所有可使用提供的 API 密钥访问的 Atlas 项目
  • list_atlas_clusters - 列出特定 Atlas 项目中的所有集群

安装

npm install mcp-mongodb-atlas

用法

作为命令行工具

您可以直接从命令行运行 Atlas 项目管理器:

# Using environment variables export ATLAS_PUBLIC_KEY="your-public-key" export ATLAS_PRIVATE_KEY="your-private-key" npx mcp-mongodb-atlas # Or passing keys as arguments npx mcp-mongodb-atlas "your-public-key" "your-private-key"

使用 Cline(VSCode 扩展)

要在 VSCode 中与 Cline 一起使用,请将服务器配置添加到您的 MCP 设置文件中:

{ "mcpServers": { "atlas": { "command": "npx", "args": ["mcp-mongodb-atlas"], "env": { "ATLAS_PUBLIC_KEY": "your-public-key", "ATLAS_PRIVATE_KEY": "your-private-key" }, "disabled": false, "autoApprove": [] } } }

MCP 设置文件位于:

  • macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
  • Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

使用光标

要与 Cursor 一起使用,请转到设置中的“Cursor 设置”>“MCP”,然后添加具有以下配置的新服务器:

  1. 名称atlas (或您喜欢的任何名称)
  2. 命令npx mcp-mongodb-atlas
  3. 参数:提供您的 API 密钥作为参数
## Suggested Command npx mcp-mongodb-atlas <public_key> <private_key>

较新版本可以使用以下命令设置~/.cursor/mcp.json文件:

{ "mcpServers": { "atlas": { "command": "npx", "args": ["mcp-mongodb-atlas"], "env": { "ATLAS_PUBLIC_KEY": "your-public-key", "ATLAS_PRIVATE_KEY": "your-private-key" }, "disabled": false, "autoApprove": [] } } }
  1. 环境变量(可选):
    • ATLAS_PUBLIC_KEY :您的 MongoDB Atlas 公钥
    • ATLAS_PRIVATE_KEY :您的 MongoDB Atlas 私钥

使用 Claude Desktop

要与 Claude Desktop 一起使用,请添加服务器配置:

在 macOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "atlas": { "command": "npx", "args": ["mcp-mongodb-atlas"], "env": { "ATLAS_PUBLIC_KEY": "your-public-key", "ATLAS_PRIVATE_KEY": "your-private-key" } } } }

API 密钥

您需要 MongoDB Atlas API 密钥才能使用此工具。要创建 API 密钥,请执行以下操作:

  1. 登录您的 MongoDB Atlas 帐户
  2. 转到访问管理器 > API 密钥
  3. 创建具有适当权限的新 API 密钥
  4. 保存公钥和私钥

发展

克隆存储库并安装依赖项:

git clone https://github.com/mongodb-developer/mcp-mongodb-atlas.git cd mcp-mongodb-atlas npm install

构建项目:

npm run build

对于使用自动重建的开发:

npm run watch

调试

由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们建议使用 MCP Inspector:

npm run inspector

检查器将提供一个 URL 来访问浏览器中的调试工具。

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

MCP 服务器使用户能够通过自然语言命令创建和管理 MongoDB Atlas 集群、用户和网络访问。

  1. Demo Video
    1. Features
      1. MCP Tools
    2. Installation
      1. Usage
        1. As a Command Line Tool
        2. With Cline (VSCode Extension)
        3. With Cursor
        4. With Claude Desktop
      2. API Keys
        1. Development
          1. Debugging
        2. License
          ID: d9peo804ly