MongoDB MCP Server - Query and manage MongoDB databases through MCP protocol
Wellknown found it in public sources; nobody has proven control of it yet. Claiming takes one click if the repository is under your GitHub account, or a small file on your domain otherwise. Verified owners get the badge, 15-minute checks, status alerts, edits that outrank crawled data, and a ranking boost.
Agents can do it too: POST https://wellknown.network/api/v1/claims with {"agent":"my-mongodb-mcp","method":"well_known_file"} — machine-readable steps at claim.json, guide at /docs/claim.
Everything here was measured by our prober or read from a registry. Nothing is self-reported.
Attributed to the source that supplied each field. Treated as claims, not facts.
# MongoDB MCP Server - Streamable HTTP 基于 MCP 官方 SDK 实现的 MongoDB MCP Server,采用 **Streamable HTTP** 传输协议,完美支持 FastGPT。 ## 项目结构 ``` python-mcp-server/ ├── src/my_mongodb_mcp/ │ ├── __init__.py │ └── server.py # 核心代码(11 个工具函数) ├── tests/ │ └── test_server.py ├── pyproject.toml # 打包配置 ├── .env.example # 环境变量模板 ├── .env # 实际环境变量(需自行配置) ├── .gitignore └── README.md ``` ## 可用工具 | 工具名 | 描述 | 写操作 | |--------|------|--------| | list_databases | 列出所有数据库 | ❌ | | list_collections | 列出数据库中的集合 | ❌ | | find_documents | 查询文档 | ❌ | | count_documents | 统计文档数量 | ❌ | | aggregate | 聚合管道操作 | ❌ | | list_indexes | 列出索引 | ❌ | | get_collection_stats | 获取集合统计 | ❌ | | insert_document | 插入单个文档 | ✅ | | update_documents | 更新文档 | ✅ | | delete_documents | 删除文档 | ✅ | | create_index | 创建索引 | ✅ | --- ## 🚀 完整操作流程(SOP) ### 第一步:环境准备 ```powershell # 1. 创建 conda 环境(需要管理员权限) conda create -n mongodb-mcp python=3.12 -y # 2. 激活环境 conda activate mongodb-mcp # 3. 进入项目目录 cd C:\Develop\AI\nju-skills-0210\nju-skills\app\python-mcp-server ``` ### 第二步:安装依赖 ```powershell # 安装项目依赖 pip install -e ".[dev]" ``` ### 第三步:配置环境变量 ```powershell # 复制环境变量模板 copy .env.example .env ``` 编辑 `.env` 文件,填入实际配置: ```ini # MongoDB 连接字符串 MDB_MCP_CONNECTION_STRING=mongodb://username:password@host:27017/database?authSource=admin&directConnection=true # 只读模式(推荐开启,防止 AI 误操作) MDB_MCP_READ_ONLY=true # 数据库名(可选,默认使用连接串中的数据库) MDB_MCP_DATABASE= ``` ### 第四步:启动服务器 ```powershell # 启动 Streamable HTTP 模式的 MCP Server python -m my_mongodb_mcp.server ``` **预期输出:** ``` 🚀 MongoDB MCP Server 已启动(Streamable HTTP 模式) 📍 地址:http://localhost:8000/ 📍 只读模式:是 📍 数据库:fastgpt INFO: Uvicorn running on http://0.0.0.0:8000 ``` ### 第五步:本地测试 **浏览器访问:** ``` http://localhost:8000/ ``` **或使用 curl 测试:** ```powershell curl http://localhost:8000/ ``` ### 第六步:内网穿透(可选,用于 FastGPT 云端访问) #### 6.1 启动 Cloudflare Tunnel **新开一个终端窗口:** ```powershell cloudflared tunnel --url http://localhost:8000 ``` **预…
Mapped onto the structured taxonomy from declared text and observed tool names. Confidence shown for derived entries.
Every source is kept verbatim. Field changes are logged as events.