MCP Catalogs
首页mcp-mongo-server screenshot

mcp-mongo-server

by kiliczsh·278·综合分 50

一个 MCP 服务器,支持 MongoDB 交互、模式推断和可配置的只读模式。

databasedeveloper-toolsai-llm
54
Forks
3
活跃 Issue
3 个月前
最近提交
2 天前
收录于

概述

MCP MongoDB Server 为 LLM 提供了与 MongoDB 数据库交互的标准接口。它提供了智能 ObjectId 处理、只读模式保护、自动集合模式检测以及完整的 MongoDB 查询和聚合管道支持。该服务器允许读取和写入操作(在非只读模式下),并提供了集合自动完成功能以改善 LLM 集成。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:使 AI 助手能够查询和分析 MongoDB 数据库
:通过自然语言自动化数据库管理操作
:允许 LLM 应用访问和操作 MongoDB 集合中的数据
:是否支持写入操作?
:模式推断如何工作?

什么时候选它

当您需要MongoDB的MCP接口,并希望对读写访问进行细粒度控制时,特别是利用其独特的ObjectId处理功能时,选择这个服务器。

什么时候不要选它

如果您需要超越基本URI连接的身份验证,或需要支持非MongoDB数据库,请避免使用此服务器。

此 server 暴露的工具

从 README 抽取出 12 个工具
  • query

    Execute MongoDB queries against collections

  • aggregate

    Run MongoDB aggregation pipelines

  • insert

    Insert documents into MongoDB collections

  • update

    Update documents in MongoDB collections

  • list_collections

    List all collections in the database

  • schema_inference

    Infer collection schema from sample documents

  • create_index

    Create indexes on collection fields

  • explain_plan

    Get query execution plan for MongoDB queries

  • count_documents

    Count documents matching a query filter

  • distinct

    Get distinct values from a field in a collection

  • drop_collection

    Remove a collection from the database

  • list_databases

    List all available databases

可对比工具

mcp-postgres-servermongomcpshell-mcp

安装

安装

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-only

Claude Desktop 集成

添加到 Claude Desktop 配置文件:

{
  "mcpServers": {
    "mongo": {
      "command": "npx",
      "args": ["-y", "mcp-mongo-server", "mongodb://localhost:27017/database"]
    }
  }
}

FAQ

是否支持写入操作?
是的,服务器支持插入、更新和创建索引操作,除非它以只读模式运行。
模式推断如何工作?
服务器通过分析集合中的文档样本自动检测集合模式。

Hacker News 讨论

开发者社区最近的相关讨论。

mcp-mongo-server 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。