MongoDB MCP Server
Official MCP server for interacting with MongoDB databases and MongoDB Atlas. Enables AI agents to query collections, run aggregations, manage indexes, inspect schemas, and perform CRUD operations. Also supports Atlas cloud management including cluster provisioning, database user management, performance advisor, and stream processing. Supports read-only mode for safe exploration.
连接
将此配置添加到 .claude/mcp.json
{
"mcpServers": {
"mongodb": {
"command": "npx",
"args": [
"-y",
"mongodb-mcp-server",
"--readOnly"
],
"env": {
"MDB_MCP_CONNECTION_STRING": "<YOUR_MDB_MCP_CONNECTION_STRING>",
"MDB_MCP_API_CLIENT_ID": "<YOUR_MDB_MCP_API_CLIENT_ID>",
"MDB_MCP_API_CLIENT_SECRET": "<YOUR_MDB_MCP_API_CLIENT_SECRET>"
}
}
}
}工具 (6)
find
Run a find query against a MongoDB collection with optional filter, projection, sort, and limit.
{
"type": "object",
"required": [
"database",
"collection"
],
"properties": {
"sort": {
"type": "object",
"description": "Sort specification"
},
"limit": {
"type": "integer",
"description": "Maximum number of documents to return"
},
"filter": {
"type": "object",
"description": "MongoDB query filter document"
},
"database": {
"type": "string",
"description": "Database name"
},
"collection": {
"type": "string",
"description": "Collection name"
},
"projection": {
"type": "object",
"description": "Fields to include or exclude"
}
}
}aggregate
Run an aggregation pipeline against a MongoDB collection.
{
"type": "object",
"required": [
"database",
"collection",
"pipeline"
],
"properties": {
"database": {
"type": "string",
"description": "Database name"
},
"pipeline": {
"type": "array",
"description": "Array of aggregation pipeline stages"
},
"collection": {
"type": "string",
"description": "Collection name"
}
}
}list-databases
List all databases on the connected MongoDB instance.
{
"type": "object",
"properties": {}
}list-collections
List all collections in a given database.
{
"type": "object",
"required": [
"database"
],
"properties": {
"database": {
"type": "string",
"description": "Database name"
}
}
}collection-schema
Infer and describe the schema for a MongoDB collection by sampling documents.
{
"type": "object",
"required": [
"database",
"collection"
],
"properties": {
"database": {
"type": "string",
"description": "Database name"
},
"collection": {
"type": "string",
"description": "Collection name"
}
}
}insert-many
Insert an array of documents into a MongoDB collection.
{
"type": "object",
"required": [
"database",
"collection",
"documents"
],
"properties": {
"database": {
"type": "string",
"description": "Database name"
},
"documents": {
"type": "array",
"description": "Array of documents to insert"
},
"collection": {
"type": "string",
"description": "Collection name"
}
}
}资源
此服务器未提供任何资源。
提示词
此服务器未提供任何提示词。
服务器信息
- 许可证
- Apache-2.0
- 版本
- 1.11.0
- 星标
- 1,000
- 最后更新
- 2026年5月22日