MCP MongoDB Server

MCP MongoDB Server

site icon
2025.02.17 0
JavaScript数据库服务MongoDB 访问数据库
MCP MongoDB Server 是一个基于 Model Context Protocol 的服务,提供对 MongoDB 数据库的访问能力。该服务允许 LLMs(大型语言模型)检查集合模式并执行只读查询。
View on GitHub

Overview

基本能力

产品定位

MCP MongoDB Server 是一个数据库访问服务,专门为 MongoDB 数据库提供只读查询和集合模式检查功能。

核心功能

  • 资源访问:通过 mongodb:// URI 列出和访问集合,每个集合都有名称、描述和模式。
  • 工具能力
  • query:执行只读 MongoDB 查询。
  • aggregate:执行只读 MongoDB 聚合查询。
  • 提示功能:提供集合结构、数据类型和基本统计信息的分析。

适用场景

  • 需要从 MongoDB 数据库中获取只读数据的场景。
  • 需要分析 MongoDB 集合结构和数据类型的场景。
  • 与 LLMs 集成,提供数据库查询能力的场景。

工具列表

  • query:执行只读 MongoDB 查询。
  • aggregate:执行只读 MongoDB 聚合查询。

常见问题解答

  • 调试建议:使用 MCP Inspector 进行调试。
  • 安装方式:可以通过 Smithery 或 mcp-get 安装。

使用教程

使用依赖

安装 Node.js 和 npm。

安装教程

npm install
npm run build

调试方式

npm run inspector

开发

开发依赖

npm install

构建

npm run build

开发模式

npm run watch

安装配置

使用 Claude Desktop

claude_desktop_config.json 中添加配置:

{
  "mcpServers": {
    "mongodb": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-mongo-server",
        "mongodb://muhammed:[email protected]/sample_namespace"
      ]
    }
  }
}

通过 Smithery 安装

npx @smithery/cli install mcp-mongo-server --client claude

通过 mcp-get 安装

npx @michaellatman/mcp-get@latest install mcp-mongo-server

许可证

该项目遵循 MIT 开源许可条款。