Conecta agentes de IA a Azure DocumentDB y bases de datos compatibles con MongoDB mediante herramientas stateless para bases de datos, colecciones, índices y documentos.
También conocido como microsoft/documentdb-mcp
- Stars
- 3
- Herramientas
- 18
- Descargas, 30 días
- —
- Última versión
- —
- Último commit
- 26 oct 2026
- Licencia
- MIT
¿Qué es DocumentDB MCP?
DocumentDB es un MCP server. Conecta agentes de IA a Azure DocumentDB y bases de datos compatibles con MongoDB mediante herramientas stateless para bases de datos, colecciones, índices y documentos. Expone 18 herramientas, como list_databases, drop_database, drop_collection.
Resumen generado a partir del README del proyecto
Acerca del MCP server de DocumentDB
Este servidor permite conectar agentes de IA a Azure DocumentDB y bases de datos compatibles con MongoDB a través de un conjunto de herramientas stateless. Proporciona acceso a bases de datos, colecciones, índices y documentos, lo que permite a los desarrolladores interactuar con sus datos directamente desde un cliente de IA. El servidor se puede ejecutar localmente vía stdio para desarrollo o de forma remota utilizando transportes streamable HTTP y SSE.
Los administradores mantienen la seguridad mediante el uso de perfiles de conexión para gestionar el acceso a la base de datos, asegurando que las cadenas de conexión nunca se pasen como argumentos de ejecución a las herramientas. Para entornos de producción, el servidor admite autenticación de backend con Microsoft Entra ID y OIDC, lo que elimina la necesidad de usar contraseñas de la base de datos. También incluye limitación de tasa (rate limiting) integrada, con un valor predeterminado de 120 solicitudes por minuto, para proteger el servicio. Los usuarios pueden configurar capacidades específicas para herramientas de lectura, escritura y gestión mediante variables de entorno para controlar el nivel de acceso otorgado a diferentes roles.
Qué puedes hacer con él
- 1Consultar documentos de la base de datosUn agente de IA puede recuperar datos de documentos específicos de un despliegue compatible con MongoDB utilizando las herramientas de documentos proporcionadas.
- 2Gestionar índices de la base de datosUn desarrollador puede instruir a una IA para inspeccionar o gestionar los índices dentro de una colección.
- 3Realizar escrituras en la base de datosCon la configuración adecuada, un cliente de IA puede ejecutar operaciones de escritura en la base de datos.
- 4Asegurar el acceso a la base de datos mediante Entra IDLos despliegues de producción pueden usar OIDC para autenticarse con el backend sin necesidad de gestionar contraseñas de la base de datos.
Escrito a partir del README del proyecto. Cada caso de uso se verifica con una cita del mismo.
Herramientas de DocumentDB MCP 18
Detectado desde el 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 | — |
Mostrar las 18 herramientasMostrar menos herramientas
insert_documentsupdate_documentsdelete_documentsaggregatefind_and_modifyexplain_operation
| insert_documents | — | |
| update_documents | — | |
| delete_documents | — | |
| aggregate | — | |
| find_and_modify | — | |
| explain_operation | — |
Configuración
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
| Nombre | Descripción | Tipo |
|---|---|---|
| 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 | — |
Verificaciones automáticas
Ejecutado 14 nov 2026Informe completo →Aún no verificado. Un servidor necesita una puntuación de 80, ningún hallazgo grave y suficientes datos para que podamos revisarlo. Cómo funcionan las verificaciones · Qué corregir para obtener más puntos
- Repositorio de origen vinculado y accesiblemicrosoft/documentdb-mcp is public and reachablegithub.com/microsoft/documentdb-mcp ↗Aprobado
- El paquete indica este repositorio como su origenNo verificado
- Procedencia de la compilación (atestación de Sigstore)No verificado
- Licencia de código abierto (OSI)MITspdx.org/licenses/MIT.html ↗Aprobado
- Commit o lanzamiento en el último añoLast commit or release 2026-10-26github.com/microsoft/documentdb-mcp ↗Aprobado
- OpenSSF ScorecardNo verificado
- El nombre del paquete no es similar a un paquete popularNo verificado
- No hay avisos críticos en el paquete ni en sus dependenciasNo verificado
- Sin instrucciones ocultas para el modelo18 tool descriptions and the README read; no override phrases, credential paths or hidden charactersAprobado
- Las herramientas destructivas están etiquetadasNo verificado
- El endpoint remoto responde al handshake de MCPNo verificado
README
Ver en 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.
Preguntas sobre DocumentDB MCP
¿Qué herramientas proporciona DocumentDB MCP?
Expone 18 herramientas, incluidas list_databases, drop_database, drop_collection, rename_collection, sample_documents.
¿Puedo usar este servidor con bases de datos compatibles con MongoDB?
Sí, el servidor funciona con Azure DocumentDB y otros despliegues de DocumentDB compatibles con MongoDB.
¿Cómo instalo el servidor usando npx?
Puedes ejecutar el servidor directamente desde GitHub usando el comando: npx -y github:microsoft/documentdb-mcp.
¿El servidor admite herramientas de escritura y gestión?
Por defecto, solo se exponen herramientas de lectura. Debes establecer ENABLE_WRITE_TOOLS y/o ENABLE_MANAGEMENT_TOOLS en true en tus variables de entorno para habilitarlas.
¿Está este servidor listo para producción?
No, actualmente está en Public Preview y no se recomienda para cargas de trabajo de producción sin una revisión propia.