ステートレスなツールを使用して、AIエージェントをAzure DocumentDBおよびMongoDB互換のデータベース、コレクション、インデックス、ドキュメントに接続します。
別名 microsoft/documentdb-mcp
- スター
- 3
- ツール
- 18
- ダウンロード数(30日間)
- —
- 最新バージョン
- —
- 最終コミット
- 2026年10月26日
- ライセンス
- MIT
DocumentDB MCPとは
DocumentDBはMCPサーバーです。 ステートレスなツールを使用して、AIエージェントをAzure DocumentDBおよびMongoDB互換のデータベース、コレクション、インデックス、ドキュメントに接続します。. 18個のツールを提供しており、list_databases, drop_database, drop_collectionなどがあります。
プロジェクトのREADMEから生成された概要
DocumentDB MCP server について
このサーバーは、一連のステートレスなツールを通じて、AIエージェントをAzure DocumentDBおよびMongoDB互換のデータベースに接続することを可能にします。データベース、コレクション、インデックス、ドキュメントへのアクセスを提供し、開発者がAIクライアントから直接データとやり取りできるようにします。サーバーは、開発用にstdioを介してローカルで実行するか、streamable HTTPおよびSSEトランスポートを使用してリモートで実行できます。
管理者は、接続プロファイルを使用してデータベースアクセスを管理することでセキュリティを維持し、接続文字列がツールの実行時引数として渡されないようにします。本番環境向けに、サーバーはMicrosoft Entra IDおよびOIDCバックエンド認証をサポートしており、データベースパスワードを不要にします。また、サービスを保護するために、デフォルトで毎分120リクエストなどの組み込みレート制限が含まれています。ユーザーは環境変数を通じて、読み取り、書き込み、管理ツールの特定の機能を構成し、異なるロールに付与されるアクセスレベルを制御できます。
できること
- 1データベースドキュメントのクエリAIエージェントは、提供されたドキュメントツールを使用して、MongoDB互換のデプロイメントから特定のドキュメントデータを取得できます。
- 2データベースインデックスの管理開発者はAIに対して、コレクション内のインデックスを検査または管理するように指示できます。
- 3データベースへの書き込み実行適切な設定を行うことで、AIクライアントはデータベースに対して書き込み操作を実行できます。
- 4Entra IDによるデータベースアクセスの保護本番環境のデプロイでは、OIDCを使用してバックエンドと認証を行うことができ、データベースパスワードを扱う必要がありません。
プロジェクトの README から作成されています。すべてのユースケースは、その引用と照らし合わせて確認されています。
DocumentDB MCPツール 18
READMEから検出list_databasesdrop_databasedrop_collectionrename_collectionsample_documentscurrent_opsget_statisticscreate_indexlist_indexesdrop_indexfind_documentscount_documents
| list_databases | — | |
| drop_database | — | |
| drop_collection | — | |
| rename_collection | — | |
| sample_documents | — | |
| current_ops | — | |
| get_statistics | — | |
| create_index | — | |
| list_indexes | — | |
| drop_index | — | |
| find_documents | — | |
| count_documents | — |
18個のツールをすべて表示ツールを折りたたむ
insert_documentsupdate_documentsdelete_documentsaggregatefind_and_modifyexplain_operation
| insert_documents | — | |
| update_documents | — | |
| delete_documents | — | |
| aggregate | — | |
| find_and_modify | — | |
| explain_operation | — |
設定
ALLOW_AGGREGATE_WRITE_STAGESAUTH_REQUIREDCONNECTION_PROFILESCONNECTION_PROFILES_FILEDOCUMENTDB_LOCAL_URIENABLE_MANAGEMENT_TOOLSENABLE_READ_TOOLSENABLE_WRITE_TOOLSENTRA_AUDIENCEENTRA_TENANT_IDMCP_MANAGEMENT_ROLE_VALUESMCP_READ_ROLE_VALUESMCP_WRITE_ROLE_VALUESRATE_LIMIT_ENABLEDRATE_LIMIT_MAX_REQUESTSRATE_LIMIT_WINDOW_MSTRUST_LOCAL_STDIO
| 名前 | 説明 | 種類 |
|---|---|---|
| ALLOW_AGGREGATE_WRITE_STAGES | — | |
| AUTH_REQUIRED | — | |
| CONNECTION_PROFILES | — | |
| CONNECTION_PROFILES_FILE | — | |
| DOCUMENTDB_LOCAL_URI | — | |
| ENABLE_MANAGEMENT_TOOLS | — | |
| ENABLE_READ_TOOLS | — | |
| ENABLE_WRITE_TOOLS | — | |
| ENTRA_AUDIENCE | — | |
| ENTRA_TENANT_ID | — | |
| MCP_MANAGEMENT_ROLE_VALUES | — | |
| MCP_READ_ROLE_VALUES | — | |
| MCP_WRITE_ROLE_VALUES | — | |
| RATE_LIMIT_ENABLED | — | |
| RATE_LIMIT_MAX_REQUESTS | — | |
| RATE_LIMIT_WINDOW_MS | — | |
| TRUST_LOCAL_STDIO | — |
自動チェック
実行日 2026年11月14日詳細レポート →まだ検証されていません。サーバーには80点のスコア、重大な問題がないこと、および検証に必要な十分なデータが必要です。 チェックの仕組み
- ソースリポジトリがリンクされており、アクセス可能microsoft/documentdb-mcp is public and reachablegithub.com/microsoft/documentdb-mcp ↗合格
- パッケージがこのリポジトリをソースとして示している未チェック
- ビルドの来歴(Sigstore 証明)未チェック
- オープンソースライセンス (OSI)MITspdx.org/licenses/MIT.html ↗合格
- 過去1年以内にコミットまたはリリースありLast commit or release 2026-10-26github.com/microsoft/documentdb-mcp ↗合格
- OpenSSF Scorecard未チェック
- パッケージ名が有名なパッケージに酷似していない未チェック
- パッケージと依存関係に重大なアドバイザリがない未チェック
- モデルへの隠れた指示がない18 tool descriptions and the README read; no override phrases, credential paths or hidden characters合格
- 破壊的なツールがラベル付けされている未チェック
- リモート endpoint が MCP ハンドシェイクに応答する未チェック
README
GitHubで見るDocumentDB MCP Server
[!IMPORTANT] Public Preview. This server is in Public Preview. APIs, configuration, environment variables, and tool behavior may change in breaking ways before General Availability. There is no SLA. Provided "as-is"; see the Azure Preview Supplemental Terms. Not recommended for production workloads without your own review.
DocumentDB MCP Server is a tools-only Model Context Protocol server for Azure DocumentDB and other MongoDB-compatible DocumentDB deployments. It exposes stateless database, collection, index, and document tools through MCP while keeping database connection details under server administrator control.
Every tool call uses a configured connection_profile. Tools do not accept runtime database connection strings, and production deployments can use Microsoft Entra ID / OIDC backend authentication so the server does not need a database password.
Installation
Node.js 20 or later is required. The server is not yet published to a public package registry, so install it directly from this repository.
Run from source
git clone https://github.com/microsoft/documentdb-mcp.git
cd documentdb-mcp
npm install
npm run build
node dist/main.js
For local development with watch mode:
npm install
npm run dev
Run with npx from GitHub
For MCP clients that spawn a server over stdio (Copilot CLI, Claude Desktop, VS Code), npx can fetch and run the server directly from this repository:
npx -y github:microsoft/documentdb-mcp
See MCP Client Quickstart for client configuration examples.
MCP Client Quickstart
For local development with an MCP client, run the server over stdio with a single connection profile. The server uses an existing CONNECTION_PROFILES JSON value (or a file via CONNECTION_PROFILES_FILE) to choose the backend; tools never accept connection strings as MCP arguments.
Set these environment variables in the client config below to match your environment:
TRANSPORT=stdio— talk to the MCP client over stdio.TRUST_LOCAL_STDIO=true— local stdio uses a trusted local process boundary; only enable on a trusted machine.CONNECTION_PROFILES— a JSON map of administrator-defined profiles. Tools reference one by name via theconnection_profileargument.
Copilot CLI
Run /mcp add interactively, or edit ~/.copilot/mcp-config.json:
{
"mcpServers": {
"DocumentDB": {
"command": "npx",
"args": ["-y", "github:microsoft/documentdb-mcp"],
"env": {
"TRANSPORT": "stdio",
"TRUST_LOCAL_STDIO": "true",
"CONNECTION_PROFILES": "{\"local\":{\"authMode\":\"connectionString\",\"uri\":\"mongodb://localhost:27017\"}}"
}
}
}
}
In tool calls, set connection_profile to "local" (or whatever profile name you defined).
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"DocumentDB": {
"command": "npx",
"args": ["-y", "github:microsoft/documentdb-mcp"],
"env": {
"TRANSPORT": "stdio",
"TRUST_LOCAL_STDIO": "true",
"CONNECTION_PROFILES": "{\"local\":{\"authMode\":\"connectionString\",\"uri\":\"mongodb://localhost:27017\"}}"
}
}
}
}
VS Code
Add to settings.json:
{
"mcp.servers": {
"documentdb": {
"command": "npx",
"args": ["-y", "github:microsoft/documentdb-mcp"],
"env": {
"TRANSPORT": "stdio",
"TRUST_LOCAL_STDIO": "true",
"CONNECTION_PROFILES": "{\"local\":{\"authMode\":\"connectionString\",\"uri\":\"mongodb://localhost:27017\"}}"
}
}
}
}
To enable write or management tools, also set "ENABLE_WRITE_TOOLS": "true" and/or "ENABLE_MANAGEMENT_TOOLS": "true" in the env block. By default only read tools are exposed.
Configuration
Copy .env.example to .env and adjust it for your deployment. The default transport is streamable HTTP on http://localhost:8070/mcp.
Key settings:
TRANSPORT=streamable-http
HOST=localhost
PORT=8070
AUTH_REQUIRED=true
ENTRA_TENANT_ID=<tenant-id>
ENTRA_AUDIENCE=<application-client-id-or-api-audience>
RATE_LIMIT_ENABLED=true
RATE_LIMIT_WINDOW_MS=60000
RATE_LIMIT_MAX_REQUESTS=120
MCP_READ_ROLE_VALUES=DocumentDB.MCP.Read
MCP_WRITE_ROLE_VALUES=DocumentDB.MCP.Write
MCP_MANAGEMENT_ROLE_VALUES=DocumentDB.MCP.Management
ENABLE_READ_TOOLS=true
ENABLE_WRITE_TOOLS=false
ENABLE_MANAGEMENT_TOOLS=false
ALLOW_AGGREGATE_WRITE_STAGES=false
HTTP and SSE transports require a Microsoft Entra bearer token by default. stdio uses a trusted local process boundary and is blocked unless TRUST_LOCAL_STDIO=true; use it only for trusted local development.
HTTP and SSE endpoints are rate-limited before token validation. The default is 120 requests per IP per 60 seconds and can be adjusted with the RATE_LIMIT_* settings.
Authentication And Authorization
The server validates incoming Entra tokens and maps configured claim values to MCP roles. Values can come from the roles, groups, or scp claims.
Roles are hierarchical:
readcan call read-only tools.writecan call write and read tools.managementcan call management, write, and read tools.
Write and management tools also require explicit capability flags. This keeps higher-impact operations unavailable by default even when a caller has the matching role.
The Entra layer protects access to the MCP server. Backend database access is configured separately through connection profiles.
App Role Example
For production, app roles are the clearest way to govern MCP access.
Create an Entra App Registration for the MCP server/API and add app roles similar to these values:
[
{
"allowedMemberTypes": ["User", "Group"],
"displayName": "DocumentDB MCP Read",
"value": "DocumentDB.MCP.Read",
"description": "Allows read-only MCP tools"
},
{
"allowedMemberTypes": ["User", "Group"],
"displayName": "DocumentDB MCP Write",
"value": "DocumentDB.MCP.Write",
"description": "Allows write MCP tools"
},
{
"allowedMemberTypes": ["User", "Group"],
"displayName": "DocumentDB MCP Management",
"value": "DocumentDB.MCP.Management",
"description": "Allows high-impact management MCP tools"
}
]
Assign users or groups to these roles in the Enterprise Application. Set ENTRA_AUDIENCE to the application client ID or Application ID URI that your MCP clients use when requesting tokens.
For manual validation with Azure CLI, request a token for the configured audience:
az login --tenant <tenant-id>
az account get-access-token --resource <entra-audience>
Connection Profiles
Connection profiles are administrator-defined and selected by name in tool calls.
Recommended Entra/OIDC backend profile:
CONNECTION_PROFILES={"sandbox":{"authMode":"entra","endpoint":"example.mongocluster.cosmos.azure.com","tokenScope":"https://ossrdbms-aad.database.windows.net/.default","allowedHosts":["*.mongocluster.cosmos.azure.com"]}}
Before running locally, sign in with Azure CLI:
az login --tenant <tenant-id>
In Azure hosting, use managed identity or workload identity and grant that identity access to the backend database. The server uses DefaultAzureCredential, so the same profile shape works for local Azure CLI login and managed deployments.
Legacy SCRAM profiles are still available for local or sandbox use when an administrator explicitly configures them:
CONNECTION_PROFILES={"local":{"uriEnv":"DOCUMENTDB_LOCAL_URI"}}
DOCUMENTDB_LOCAL_URI=mongodb://localhost:27017
You can also load profiles from a file:
CONNECTION_PROFILES_FILE=/etc/documentdb-mcp/profiles.json
Tools
All tools require connection_profile.
| Tool | Role | Purpose |
|---|---|---|
list_databases |
read | List databases, or collections for one database. |
drop_database |
management | Drop a database and all collections. |
drop_collection |
management | Drop a collection. |
rename_collection |
management | Rename a collection. |
sample_documents |
read | Return sample documents from a collection. |
current_ops |
management | Return current MongoDB operations. |
get_statistics |
read | Return database, collection, or index statistics. |
create_index |
management | Create an index. |
list_indexes |
read | List collection indexes. |
drop_index |
management | Drop an index. |
find_documents |
read | Find documents with query, projection, sort, limit, and skip options. |
count_documents |
read | Count documents matching a query. |
insert_documents |
write | Insert one or more documents. |
update_documents |
write | Update one or many documents. |
delete_documents |
write | Delete one or many documents. |
aggregate |
read | Run an aggregation pipeline. $out and $merge are disabled unless explicitly enabled. |
find_and_modify |
write | Atomically find and update one document. |
explain_operation |
read | Explain find, count, or aggregate with execution stats. |
MCP Client Usage
For streamable HTTP, configure your MCP client with:
http://<host>:8070/mcp
The client must send an Entra bearer token when AUTH_REQUIRED=true.
For trusted local stdio testing:
TRANSPORT=stdio
AUTH_REQUIRED=false
TRUST_LOCAL_STDIO=true
Then configure the MCP command as:
node /absolute/path/to/documentdb-mcp/dist/main.js
Example read tool input:
{
"connection_profile": "sandbox",
"db_name": "mcp_validation",
"collection_name": "vehicles",
"query": { "status": "active" },
"options": { "limit": 5 }
}
Example write tool input, requiring both the write role and ENABLE_WRITE_TOOLS=true:
{
"connection_profile": "sandbox",
"db_name": "mcp_validation",
"collection_name": "vehicles",
"documents": {
"vin": "VIN-100",
"make": "Contoso",
"model": "Test",
"status": "active"
}
}
Security Checks
The server enforces these controls before opening a database connection:
- HTTP/SSE authentication when
AUTH_REQUIRED=true. - Per-IP rate limiting on HTTP/SSE routes before authentication.
- MCP role checks for each tool.
- Default-off gates for write and management tools.
- Server-side connection profile resolution.
- Rejection of tool inputs that omit
connection_profile. - Default rejection of aggregation
$outand$mergestages.
Allowed and denied tool invocations are written to stderr with the [MCP-AUDIT] prefix. Audit records include the tool name, required role, decision, connection profile, transport, session or request IDs, and caller identity metadata when available.
Data masking is not supported
The server does not mask, redact, or anonymize document fields. Tool results are returned to the MCP client verbatim, which means they typically flow into an LLM and any of its downstream logging, telemetry, or memory. Treat every database the server can reach as fully readable by anyone authorized to call its read tools.
If you need to expose a database that contains PII, PHI, payment data, secrets, or other sensitive fields, configure masking at the database layer (for example, a masked MongoDB view built with $project / $set / $substr / $concat / $hash) and point the connection profile's identity at the masked view rather than the underlying collection. Per-profile masking support in the server is tracked as a future enhancement.
Development
Run tests and build before packaging:
npm test
npm run build
Preview the package contents:
npm pack --dry-run
The package should contain dist/, README.md, .env.example, tool_list.md, LICENSE.md, and package metadata.
License
See LICENSE.md.
DocumentDB MCPのよくある質問
DocumentDB MCPが提供するツールは
18個のツールを提供しており、list_databases, drop_database, drop_collection, rename_collection, sample_documentsなどがあります。
MongoDB互換のデータベースでも使用できますか?
はい、このサーバーはAzure DocumentDBおよびその他のMongoDB互換のDocumentDBデプロイメントで動作します。
npxを使用してサーバーをインストールするにはどうすればよいですか?
以下のコマンドを使用して、GitHubから直接サーバーを実行できます:npx -y github:microsoft/documentdb-mcp。
このサーバーは書き込みおよび管理ツールをサポートしていますか?
デフォルトでは読み取りツールのみが公開されています。これらを有効にするには、環境変数でENABLE_WRITE_TOOLSおよび/またはENABLE_MANAGEMENT_TOOLSをtrueに設定する必要があります。
このサーバーは本番環境での利用に適していますか?
いいえ、現在はパブリックプレビュー段階であり、独自のレビューなしで本番環境のワークロードに使用することは推奨されません。