documentdb-mcp-setup
Skill7 starsChanged 4 months agoMITView on GitHub
Guide users through installing and configuring the DocumentDB MCP server for Azure DocumentDB. Use this skill when a user wants to wire the DocumentDB MCP server into an agentic client (Claude Code, Claude Desktop, Cursor, Copilot CLI, Gemini CLI, VS Code) and define a `CONNECTION_PROFILES` entry, or when they hit MCP connection / auth / profile errors.
- Pipes a download into a shell
- Installs packages
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- documentdb-azure-deploymentSkill
- documentdb-connectionSkill
- documentdb-data-modelingSkill
- documentdb-driverSkill
- documentdb-full-text-searchSkill
- documentdb-high-availabilitySkill
- documentdb-indexingSkill
- documentdb-local-deploymentSkill
- documentdb-monitoringSkill
- documentdb-natural-language-queryingSkill
- documentdb-query-optimizationSkill
- documentdb-query-optimizerSkill
- documentdb-securitySkill
- documentdb-shardingSkill
- documentdb-storageSkill
- documentdb-vector-searchSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 6 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
If any step below appears to require a credential value, treat it as a placeholder for the user to fill in locally.
- Distinctive: line 46
If the user wants the quickest path and is willing to run a script, point them at the kit's installer, which installs both this skill pack …
- Very specific: line 67
Make sure Node.js 20+ is available (the MCP server runs on Node).
- Very specific: line 69
Add a DocumentDB server entry that launches the upstream MCP server and passes CONNECTION_PROFILES (and TRANSPORT=stdio + …
- Distinctive: line 81
If either is missing, install them before continuing.
- Distinctive: line 173
If the file doesn't exist yet, create it with a single top-level object:
- Very specific: line 179
If it already has other servers, add the DocumentDB entry inside the existing mcpServers object — don't overwrite the whole file.
- Very specific: line 186
Ask the agent to list available DocumentDB tools, or run a tool directly (the agent should pass connection_profile: "default"):
- Very specific: line 211
TLS errors against Azure DocumentDB: ensure tls=true is in the URI and the connection string is fully URL-encoded (special characters in …
- Distinctive: line 214
Auth errors: verify the database user exists in Azure portal under your cluster's Settings → Authentication, and that the password is …
- Distinctive: line 223
Client doesn't pick up the new server: ensure a full restart of the client (quit + reopen), not just a window reload.
≈ “Common” is an estimate: at least 1 in 5 of the 383,637 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
DocumentDB MCP Server Setup
This skill guides users through wiring the
microsoft/documentdb-mcp
server into an agentic client and pointing it at Azure DocumentDB (or another
MongoDB-compatible endpoint).
The DocumentDB MCP server is stateless and administrator-controlled:
backend connection details live in a CONNECTION_PROFILES JSON map defined in
the MCP client's config. Tools never accept a connection string as a runtime
argument — they reference a named profile via connection_profile.
Safety: never receive credentials in chat
The DocumentDB connection string is a secret — it contains a username and password that grant database access. The agent MUST follow these rules:
- Never ask the user to paste a connection string, password, or token into the chat. Always instruct the user to add the value directly to their local MCP config file themselves (or run the bundled installer, which prompts via stdin instead of chat).
- Never read, echo, log, or repeat back a credential the user pasted by mistake. If the user pastes one anyway, respond with: "I won't process that value — please delete it from the chat history and add it directly to your client's MCP config instead," and continue with placeholders only. The agent itself cannot remove messages it has already received — only the user can delete the message from their chat history.
- Never run a shell command that would print a credential to stdout.
- Never write the credential to any file the agent itself creates or
edits. The agent only writes placeholder
[USER]:[PASSWORD]@...(square brackets defeat themongodb://[^:]+:[^@]+@secret-scanner regex); the user replaces it locally. - Never include a credential in a generated explanation, summary, commit
message, or example. Use
<redacted>if you must reference its position.
If any step below appears to require a credential value, treat it as a placeholder for the user to fill in locally.
Fastest path: bundled installer
If the user wants the quickest path and is willing to run a script, point them at the kit's installer, which installs both this skill pack and the MCP server into every detected client in one command:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.sh | bash
# Windows (PowerShell)
irm https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.ps1 | iexThe installer prompts for a connection string, writes it as the default
profile, and configures all detected clients. The rest of this skill covers
the manual path (and is also the right reference when the installer fails or
the user wants to customize).
Manual setup overview
Setup is per-client. For each client the user has installed:
- Make sure Node.js 20+ is available (the MCP server runs on Node).
- Find that client's MCP config file.
- Add a
DocumentDBserver entry that launches the upstream MCP server and passesCONNECTION_PROFILES(andTRANSPORT=stdio+AUTH_REQUIRED=falseTRUST_LOCAL_STDIO=truefor local stdio use).
- Restart the client.
Step 1: Confirm prerequisites
node --version # must be >= 20
git --version # required by `npx -y github:microsoft/documentdb-mcp`If either is missing, install them before continuing.
Step 2: Pick the connection target
| Option | When to use | Example URI |
| A. Azure DocumentDB | Production / cloud dev | mongodb+srv://<user>:<pw>@<cluster>.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256&retrywrites=false |
| B. Local MongoDB / DocumentDB | Local dev | mongodb://localhost:27017 |
| C. Custom MongoDB-compatible | Atlas, self-hosted, third-party | mongodb://<user>:<pw>@host:port/?tls=true |
Azure DocumentDB connection string: Azure portal → your DocumentDB cluster
→ Settings → Connection strings. Replace <username> / <password>
with database user credentials. TLS is required (tls=true must be present).
Step 3: Pick a transport
stdio(default, recommended) — the client launches the server as a subprocess. Use this for every client below.streamable-http— only for browser clients or custom HTTP integrations where you have a separate, long-running server with Entra-authenticated bearer tokens. Not covered here; see the upstream README.
For stdio, set AUTH_REQUIRED=false and TRUST_LOCAL_STDIO=true.
The server defaults AUTH_REQUIRED=true and exits at startup unless
ENTRA_TENANT_ID / ENTRA_AUDIENCE are set, even for stdio.
(TRUST_LOCAL_STDIO was named ALLOW_UNAUTHENTICATED_STDIO before
microsoft/documentdb-mcp#83
— if you're on an older server build, use that name instead.)
AUTH_REQUIRED=false does not weaken your cluster's auth. It gates only
the Entra-JWT bearer-token check on the MCP server's HTTP/SSE transport —
i.e., calls from the MCP client to this server. It is fully independent
from how the MCP server talks to your DocumentDB cluster: SCRAM
username/password (from the connection-string URI) and Entra-to-cluster
tokens (authMode: "entra") flow through CONNECTION_PROFILES and stay
active regardless of AUTH_REQUIRED. TLS to the cluster (tls=true),
capability gates (ENABLE_*_TOOLS), and tool-tier authorization are also
unaffected.
This setup is safe only because TRANSPORT=stdio: the MCP server runs
as a subprocess of the trusted local client — no network listener is
opened. If you ever switch TRANSPORT to streamable-http or sse, set
AUTH_REQUIRED=true and provide the Entra tenant/audience, or the /mcp
endpoint will be exposed unauthenticated.
Step 4: Write the MCP config
The MCP server entry has the same shape for every client. Only the wrapping
config file and the top-level key (mcpServers vs mcp.servers) differ.
Server entry template (substitute <CONN_STRING> with the URI from Step 2):
{
"DocumentDB": {
"command": "npx",
"args": ["-y", "github:microsoft/documentdb-mcp"],
"env": {
"TRANSPORT": "stdio",
"AUTH_REQUIRED": "false",
"TRUST_LOCAL_STDIO": "true",
"CONNECTION_PROFILES": "{\"default\":{\"authMode\":\"connectionString\",\"uri\":\"<CONN_STRING>\"}}"
}
}
}Notes:
CONNECTION_PROFILESis a JSON string (escaped) — not a JSON object.- The profile name
defaultis what agents pass to tool calls via theconnection_profileargument. You can use any name;defaultkeeps it simple. - To allow write or management tools, add
"ENABLE_WRITE_TOOLS": "true"and/or"ENABLE_MANAGEMENT_TOOLS": "true"toenv. Read tools are on by default. - The first
npx -y github:...invocation will clone and build the server (~30 s on a fast connection). Subsequent invocations use thenpxcache. For faster startup, install once locally and pointcommand/argsat the builtnode /path/to/dist/main.jsinstead — this is what the bundled installer does.
Client-specific config files
| Client | Config file | Top-level key |
| Claude Code (user-scoped) | ~/.claude.json | mcpServers |
| Claude Desktop | macOS: ~/Library/Application Support/Claude/claude_desktop_config.json <br> Linux: ~/.config/Claude/claude_desktop_config.json <br> Windows: %APPDATA%\Claude\claude_desktop_config.json | mcpServers |
| Cursor (user-scoped) | ~/.cursor/mcp.json | mcpServers |
| GitHub Copilot CLI | ~/.copilot/mcp-config.json | mcpServers |
| GitHub Copilot for VS Code | VS Code settings.json | mcp.servers |
| Gemini CLI | ~/.gemini/settings.json | mcpServers |
If the file doesn't exist yet, create it with a single top-level object:
{ "mcpServers": { "DocumentDB": { ... } } }If it already has other servers, add the DocumentDB entry inside the
existing mcpServers object — don't overwrite the whole file.
Step 5: Restart the client and verify
- Fully quit the client (not just close the window).
- Reopen it.
- Ask the agent to list available DocumentDB tools, or run a tool directly
(the agent should pass
connection_profile: "default"):list_databases— confirms the server is reachable and the profile worksdb_stats— basic round-trip check
Troubleshooting
npxerrors / repo not found: the upstreammicrosoft/documentdb-mcprepo may be private or unreachable. Checkgit ls-remote https://github.com/microsoft/documentdb-mcp.git; if it fails, fall back to cloning the repo manually, runningnpm install && npm run build, and pointingcommand→node,args→["<abs-path>/dist/main.js"].stdio transport is disabled when AUTH_REQUIRED=true/unauthenticated stdio is disabled: you forgotTRUST_LOCAL_STDIO: "true"inenv(or, on older builds before microsoft/documentdb-mcp#83,ALLOW_UNAUTHENTICATED_STDIO: "true").AUTH_REQUIRED is true but .../ server exits immediately on launch: add"AUTH_REQUIRED": "false"toenv. The server defaults this totrueand refuses to start without Entra tenant/audience config. This flag gates only the Entra-JWT bearer check on the MCP server's HTTP/SSE transport — it does not disable MongoDB-level auth (SCRAM orauthMode=entra), TLS, or capability gates. Only set it tofalsetogether withTRANSPORT=stdio.connection_profile "default" not found: the agent is passing a different profile name than what's defined inCONNECTION_PROFILES. Either rename your profile or tell the agent which name to use.- TLS errors against Azure DocumentDB: ensure
tls=trueis in the URI and the connection string is fully URL-encoded (special characters in passwords must be percent-encoded). - Auth errors: verify the database user exists in Azure portal under your cluster's Settings → Authentication, and that the password is correct.
- Connection timeout to Azure: Azure DocumentDB firewall may be blocking your IP. Portal → cluster → Networking → add your client IP to the allowlist.
- JSON escape issues:
CONNECTION_PROFILESis a string of JSON. Inner double quotes must be escaped (\"). Use a JSON validator if the client silently ignores the server. The bundled installer handles escaping correctly — prefer it if escaping is painful. - Client doesn't pick up the new server: ensure a full restart of the client (quit + reopen), not just a window reload.
- VS Code uses
mcp.servers, notmcpServers: this is the one client with a different top-level key.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

