
mcp-mongo-server
by kiliczsh·★ 278·综合分 50
一个 MCP 服务器,支持 MongoDB 交互、模式推断和可配置的只读模式。
概述
MCP MongoDB Server 为 LLM 提供了与 MongoDB 数据库交互的标准接口。它提供了智能 ObjectId 处理、只读模式保护、自动集合模式检测以及完整的 MongoDB 查询和聚合管道支持。该服务器允许读取和写入操作(在非只读模式下),并提供了集合自动完成功能以改善 LLM 集成。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要MongoDB的MCP接口,并希望对读写访问进行细粒度控制时,特别是利用其独特的ObjectId处理功能时,选择这个服务器。
什么时候不要选它
如果您需要超越基本URI连接的身份验证,或需要支持非MongoDB数据库,请避免使用此服务器。
此 server 暴露的工具
从 README 抽取出 12 个工具queryExecute MongoDB queries against collections
aggregateRun MongoDB aggregation pipelines
insertInsert documents into MongoDB collections
updateUpdate documents in MongoDB collections
list_collectionsList all collections in the database
schema_inferenceInfer collection schema from sample documents
create_indexCreate indexes on collection fields
explain_planGet query execution plan for MongoDB queries
count_documentsCount documents matching a query filter
distinctGet distinct values from a field in a collection
drop_collectionRemove a collection from the database
list_databasesList all available databases
可对比工具
安装
安装
npx -y mcp-mongo-server mongodb://localhost:27017/database使用方法
# 使用 MongoDB URI 启动服务器
npx -y mcp-mongo-server mongodb://用户名:密码@localhost:27017/数据库名
# 以只读模式连接
npx -y mcp-mongo-server mongodb://用户名:密码@localhost:27017/数据库名 --read-onlyClaude Desktop 集成
添加到 Claude Desktop 配置文件:
{
"mcpServers": {
"mongo": {
"command": "npx",
"args": ["-y", "mcp-mongo-server", "mongodb://localhost:27017/database"]
}
}
}FAQ
- 是否支持写入操作?
- 是的,服务器支持插入、更新和创建索引操作,除非它以只读模式运行。
- 模式推断如何工作?
- 服务器通过分析集合中的文档样本自动检测集合模式。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by kilic · 2025-03-29
mcp-mongo-server 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。