Skip to main content
Glama

MongoDB MCP Server

Official

MongoDB MCP 服务器

提供对 MongoDB 数据库的只读访问的模型上下文协议 (MLM) 服务器。该服务器使 LLM 能够检查集合模式并执行聚合管道。

成分

工具

  • 总计的
    • 针对连接的数据库执行 MongoDB 聚合管道
    • 输入:
      • collection (字符串):要查询的集合
      • pipeline (数组):MongoDB 聚合管道阶段
      • options (对象):可选的聚合设置
        • allowDiskUse (布尔值):允许需要使用磁盘的操作
        • maxTimeMS (数字):最大执行时间(以毫秒为单位)
        • comment (字符串):用于标识操作的注释
    • 如果未指定限制阶段,则默认限制为 1000 个文档
    • 默认超时时间为 30 秒
  • 解释
    • 获取聚合管道的执行计划
    • 输入:
      • collection (字符串):要分析的集合
      • pipeline (数组):MongoDB 聚合管道阶段
      • verbosity (字符串):解释的详细程度
        • 选项:“queryPlanner”、“executionStats”、“allPlansExecution”
        • 默认值:“queryPlanner”

资源

服务器为数据库中的每个集合提供架构信息:

  • 集合模式mongodb://<host>/<collection>/schema
    • 推断每个集合的 JSON 架构信息
    • 包括字段名称和数据类型
    • 模式源自采样收集文档

与 Claude Desktop 一起使用

要将此服务器与 Claude Desktop 应用程序一起使用,请将以下配置添加到claude_desktop_config.json的“mcpServers”部分:

"mongodb": { "command": "npx", "args": [ "-y" , "@pash1986/mcp-server-mongodb" ], "env" : { "MONGODB_URI" : "mongodb+srv://<yourcluster>" // 'mongodb://localhost:27017' } }

mydb替换为您的数据库名称,并根据需要调整连接字符串。

示例用法

基本聚合

{ "collection": "users", "pipeline": [ { "$match": { "age": { "$gt": 21 } } }, { "$group": { "_id": "$city", "avgAge": { "$avg": "$age" }, "count": { "$sum": 1 } }}, { "$sort": { "count": -1 } }, { "$limit": 10 } ], "options": { "allowDiskUse": true, "maxTimeMS": 60000, "comment": "City-wise user statistics" } }

查询说明

{ "collection": "users", "pipeline": [ { "$match": { "age": { "$gt": 21 } } }, { "$sort": { "age": 1 } } ], "verbosity": "executionStats" }

安全功能

  • 如果管道中未指定限制,则自动限制为 1000 个文档
  • 所有操作的默认超时时间为 30 秒
  • 仅限只读操作
  • 从收集样本中推断安全模式

执照

此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。

-
security - not tested
F
license - not found
-
quality - not tested

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.

为 LLM 提供对 MongoDB 数据库的只读访问权限,以检查收集模式并执行聚合管道。

  1. 成分
    1. 工具
    2. 资源
  2. 与 Claude Desktop 一起使用
    1. 示例用法
      1. 基本聚合
      2. 查询说明
    2. 安全功能
      1. 执照

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that provides access to MongoDB databases. This server enables LLMs to inspect collection schemas and execute read-only queries.
          Last updated -
          8
          817
          217
          TypeScript
          MIT License
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.
          Last updated -
          340
          TypeScript
          MIT License
          • Apple
        • -
          security
          F
          license
          -
          quality
          A protocol server that enables LLMs like Claude to interact with MongoDB databases, providing tools for schema exploration, aggregation queries, and data analysis through natural language in Cursor.
          Last updated -
          11
          5
          TypeScript
          • Linux
          • Apple
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.
          Last updated -
          340
          MIT License
          • Apple

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-developer/mongodb-mcp-server'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server