MongoDB MCP Server Configuration & Usage Guide
Installationnpx
Risk LevelHigh Risk
API KeyRequired
Clients3 supported
MongoDB 数据库查询与操作,支持集合浏览、文档查询和聚合管道
Supported Clients
- Claude Desktop
- Cursor
- VS Code / Cline
Installation Command
npx -y mcp-mongo-serverConfiguration Example
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mcp-mongo-server"
],
"env": {
"MONGODB_URI": "mongodb://localhost:27017/mydb"
}
}
}
}Environment variable required:MONGODB_URI。Do not commit these values to public repositories.
Permission Scope & Security Notes
可读写 MongoDB 数据库,建议使用只读账号连接测试数据库
- database-read
- database-write
- network-access
- credential-required
Risk Score:6/10
Common Errors
- 连接超时
- 确认 MongoDB 服务运行中且连接字符串正确
- 认证失败
- 检查 URI 中的用户名密码和 authSource 参数
Sources
Recently Verified:2026-05-18。Client versions and configuration formats may change. Please refer to official documentation before use.