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”部分:
将mydb替换为您的数据库名称,并根据需要调整连接字符串。
示例用法
基本聚合
查询说明
安全功能
如果管道中未指定限制,则自动限制为 1000 个文档
所有操作的默认超时时间为 30 秒
仅限只读操作
从收集样本中推断安全模式
执照
此 MCP 服务器采用 MIT 许可证。这意味着您可以自由使用、修改和分发该软件,但须遵守 MIT 许可证的条款和条件。更多详情,请参阅项目仓库中的 LICENSE 文件。
This server cannot be installed
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 数据库的只读访问权限,以检查收集模式并执行聚合管道。
Related Resources
Related MCP Servers
- -security-license-qualityProvides read-only access to PostgreSQL databases, enabling users to inspect database schemas and execute read-only queries through a Model Context Protocol server.Last updated -4
- -security-license-qualityEnables LLMs to interact with MySQL databases by inspecting schemas and executing safe, read-only queries within transactions.Last updated -09MIT License
- -security-license-qualityProvides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only SQL queries within a secure transaction context.Last updated -22,3041
- -security-license-qualityProvides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only SQL queries.Last updated -22,304