Menghubungkan AI agent ke Azure DocumentDB dan database yang kompatibel dengan MongoDB melalui stateless tools untuk database, collection, index, dan document.
Juga dikenal sebagai microsoft/documentdb-mcp
- Stars
- 3
- Tools
- 18
- Unduhan, 30 hari
- —
- Versi terbaru
- —
- Commit terakhir
- 26 Okt 2026
- Lisensi
- MIT
Apa itu DocumentDB MCP?
DocumentDB adalah MCP server. Menghubungkan AI agent ke Azure DocumentDB dan database yang kompatibel dengan MongoDB melalui stateless tools untuk database, collection, index, dan document. Server ini menyediakan 18 tool, seperti list_databases, drop_database, drop_collection.
Ringkasan dibuat dari README proyek
Tentang DocumentDB MCP server
Server ini memungkinkan Anda menghubungkan AI agent ke Azure DocumentDB dan database yang kompatibel dengan MongoDB melalui sekumpulan stateless tools. Server ini menyediakan akses ke database, collection, index, dan document, sehingga memungkinkan developer untuk berinteraksi dengan data mereka secara langsung dari AI client. Server dapat dijalankan secara lokal via stdio untuk pengembangan atau secara remote menggunakan transport streamable HTTP dan SSE.
Administrator dapat menjaga keamanan dengan menggunakan connection profiles untuk mengelola akses database, memastikan bahwa connection string tidak pernah dikirim sebagai runtime arguments ke tools. Untuk lingkungan produksi, server ini mendukung autentikasi backend Microsoft Entra ID dan OIDC, yang menghilangkan kebutuhan akan password database. Server ini juga menyertakan rate limiting bawaan, seperti default 120 request per menit, untuk melindungi layanan. Anda dapat mengonfigurasi kapabilitas spesifik untuk read, write, dan management tools melalui environment variables guna mengontrol level akses yang diberikan ke berbagai role.
Apa yang bisa Anda lakukan dengannya
- 1Querying database documentsAI agent dapat mengambil data document tertentu dari deployment yang kompatibel dengan MongoDB menggunakan document tools yang tersedia.
- 2Managing database indexesDeveloper dapat menginstruksikan AI untuk memeriksa atau mengelola index di dalam sebuah collection.
- 3Performing database writesDengan konfigurasi yang tepat, AI client dapat mengeksekusi operasi write pada database.
- 4Securing database access via Entra IDDeployment produksi dapat menggunakan OIDC untuk autentikasi ke backend tanpa perlu menangani password database.
Ditulis berdasarkan README proyek. Setiap use case diperiksa terhadap kutipan dari README tersebut.
Tool DocumentDB MCP 18
Terdeteksi dari READMElist_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 | — |
Tampilkan semua 18 toolTampilkan lebih sedikit tool
insert_documentsupdate_documentsdelete_documentsaggregatefind_and_modifyexplain_operation
| insert_documents | — | |
| update_documents | — | |
| delete_documents | — | |
| aggregate | — | |
| find_and_modify | — | |
| explain_operation | — |
Konfigurasi
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
| Nama | Deskripsi | Tipe |
|---|---|---|
| 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 | — |
Pengecekan otomatis
Berjalan 14 Nov 2026Laporan lengkap →Belum diverifikasi. Sebuah server memerlukan skor 80, tidak ada temuan serius, dan data yang cukup untuk kami periksa. Cara kerja checks · Yang perlu diperbaiki untuk menambah poin
- Source repository terhubung dan dapat dijangkaumicrosoft/documentdb-mcp is public and reachablegithub.com/microsoft/documentdb-mcp ↗Lolos
- Nama paket mencantumkan repositori ini sebagai sumbernyaTidak diperiksa
- Provenance build (atestasi Sigstore)Tidak diperiksa
- Lisensi open source (OSI)MITspdx.org/licenses/MIT.html ↗Lolos
- Ada commit atau release dalam satu tahun terakhirLast commit or release 2026-10-26github.com/microsoft/documentdb-mcp ↗Lolos
- OpenSSF ScorecardTidak diperiksa
- Nama package tidak mirip dengan package populerTidak diperiksa
- Tidak ada advisory kritis pada paket atau dependensinyaTidak diperiksa
- Tidak ada instruksi tersembunyi untuk model18 tool descriptions and the README read; no override phrases, credential paths or hidden charactersLolos
- Tools yang bersifat destruktif telah diberi labelTidak diperiksa
- Endpoint remote merespons handshake MCPTidak diperiksa
README
Lihat di GitHubDocumentDB 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.
Pertanyaan tentang DocumentDB MCP
Tool apa yang disediakan DocumentDB MCP?
Server ini menyediakan 18 tool, termasuk list_databases, drop_database, drop_collection, rename_collection, sample_documents.
Bisakah saya menggunakan server ini dengan database yang kompatibel dengan MongoDB?
Ya, server ini bekerja dengan Azure DocumentDB dan deployment DocumentDB lainnya yang kompatibel dengan MongoDB.
Bagaimana cara menginstal server ini menggunakan npx?
Anda dapat menjalankan server secara langsung dari GitHub menggunakan command: npx -y github:microsoft/documentdb-mcp.
Apakah server ini mendukung write dan management tools?
Secara default, hanya read tools yang tersedia. Anda harus mengatur ENABLE_WRITE_TOOLS dan/atau ENABLE_MANAGEMENT_TOOLS ke true pada environment variables Anda untuk mengaktifkannya.
Apakah server ini sudah siap untuk produksi?
Belum, saat ini masih dalam tahap Public Preview dan tidak direkomendasikan untuk beban kerja produksi tanpa review mandiri dari Anda.