diff --git a/AGENTS.md b/AGENTS.md index f45448d..b954729 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,6 +2,14 @@ This repository is an **Agent Skills** pack for **Azure DocumentDB (with MongoDB compatibility)** — the managed Azure service built on the open-source [DocumentDB](https://github.com/microsoft/documentdb) project. Every skill targets Azure DocumentDB specifically; rules call out DocumentDB features that differ from community MongoDB (`cosmosSearch` vector indexes, `createSearchIndexes` full-text search, cluster M-tiers, Entra RBAC, CMK, etc.). +> **Status: Public Preview.** This kit and its upstream MCP server are +> pre-GA; rule contents, skill shapes, installer behavior, and the MCP +> tool surface may change in breaking ways. No SLA. See the +> [Azure Preview Supplemental Terms](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). +> When acting on the kit, agents should call out this status to the user +> if they're about to commit kit-installed configs into anything that +> looks production-shaped. + ## How agents should use this kit ### Skill routing (do this first) @@ -42,7 +50,7 @@ These skills walk the user (or another agent) through a task end-to-end. | Skill | Folder | When to use | |---|---|---| -| `documentdb-mcp-setup` | `skills/mcp-setup/` | User has the DocumentDB MCP server installed but hasn't configured `DOCUMENTDB_URI` / transport / shell profile | +| `documentdb-mcp-setup` | `skills/mcp-setup/` | Installing / configuring the DocumentDB MCP server in an agentic client (Claude Code, Claude Desktop, Cursor, Copilot CLI, Gemini CLI, VS Code); defining `CONNECTION_PROFILES` | | `documentdb-azure-deployment` | `skills/azure-deployment/` | Provisioning an Azure DocumentDB cluster (`Microsoft.DocumentDB/mongoClusters`) via Bicep, Azure CLI, Terraform, or portal; firewall rules; connection string retrieval | | `documentdb-natural-language-querying` | `skills/natural-language-querying/` | "How do I query…", "filter / group / aggregate…", SQL → MQL translation (read-only queries only) | | `documentdb-query-optimizer` | `skills/query-optimizer/` | "Why is this slow?", index review, `explain()`-driven tuning; loads `references/core-indexing-principles.md` | diff --git a/CHANGELOG.md b/CHANGELOG.md index d168638..a28f0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,91 @@ # Changelog +## 2026-05-27 — Mark project as Public Preview + +Add a Public Preview status badge to `README.md` and a top-of-document +IMPORTANT admonition pointing at the +[Azure Preview Supplemental Terms](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). +Add a matching status note to `AGENTS.md` so agents reading the kit +relay the preview status to users before committing kit-installed +configs into production-shaped surfaces. No functional changes; this +clarifies that the kit (like the upstream `microsoft/documentdb-mcp` +server it depends on) is pre-GA, has no SLA, is provided "as-is", and +may change in breaking ways before General Availability. + +## 2026-05-27 — Track upstream rename: `ALLOW_UNAUTHENTICATED_STDIO` → `TRUST_LOCAL_STDIO` + +Upstream [microsoft/documentdb-mcp#83](https://github.com/microsoft/documentdb-mcp/pull/83) +renamed `ALLOW_UNAUTHENTICATED_STDIO` to `TRUST_LOCAL_STDIO`. The old name is +no longer recognized — server builds at `main` silently ignore it. The kit's +installer kept working only because it also sets `AUTH_REQUIRED=false`, which +short-circuits the Entra startup-validator before `TRUST_LOCAL_STDIO` is ever +consulted. Renamed everywhere so future readers don't see a dead env var: + +- `install.sh` — `build_env_json()` (both python and jq paths) +- `install.ps1` — `Get-EnvJsonHashtable()` +- `mcp.json` +- `skills/mcp-setup/SKILL.md` — Step 3, config template, troubleshooting +- `README.md` — troubleshooting table + +Also fixed a small but real correctness issue in the upstream-installed +"Install in VS Code" badge: it sets `TRUST_LOCAL_STDIO=true` and `TRANSPORT=stdio` +but omits `AUTH_REQUIRED=false`. Because the server's `validateConfig` runs +before the transport switch and demands `ENTRA_TENANT_ID` / `ENTRA_AUDIENCE` +whenever `AUTH_REQUIRED=true` (the default), the install-button config exits +at startup with "AUTH_REQUIRED=true requires ENTRA_TENANT_ID to be set." A +separate PR upstream fixes both the validator (skip the Entra check when +`TRANSPORT=stdio` and `TRUST_LOCAL_STDIO=true`) and the badge URL. + +## 2026-05-21 — Cross-client installer: skills + DocumentDB MCP server in one command + +Replaced the non-functional `npx skills add Azure/documentdb-agent-kit` +placeholder with real installers (`install.sh` for macOS/Linux, `install.ps1` +for Windows / cross-platform PowerShell) that, in one command, wire both the +kit's skills and the [`microsoft/documentdb-mcp`](https://github.com/microsoft/documentdb-mcp) +server into every detected client. + +What landed: + +- **`install.sh`** — POSIX bash installer, zero runtime deps beyond `git` + + Node 20+. Auto-detects Claude Code, Claude Desktop, Cursor, GitHub Copilot + CLI, and Gemini CLI; clones+builds the MCP server into + `~/.documentdb-agent-kit/mcp-server/`; symlinks each skill into clients that + support a skills directory; merges (idempotently) a single `DocumentDB` MCP + entry into each client's JSON config with a timestamped `.bak` backup before + every edit. Uses `python3` for JSON merging when available (universal on + dev machines), falls back to `jq`. +- **`install.ps1`** — PowerShell 5.1+ / pwsh 7+ mirror. Same flow, native + `ConvertFrom-Json` / `ConvertTo-Json` for merges. Falls back to copying skills + when symlink creation requires Developer Mode / admin on Windows. +- **Flags on both:** `--uri`, `--yes`, `--dry-run`, `--uninstall`, `--clients`, + `--skills-only`, `--mcp-only`, `--mcp-ref`, `--kit-ref`, `--profile`. +- **README rewrite** — install section now documents the one-liner, what gets + installed where, requirements, flags, verify steps, uninstall, and a + manual-install fallback. +- **`skills/mcp-setup/SKILL.md` rewrite** — the previous version told users to + set `DOCUMENTDB_URI` in a shell profile, which is **not** how the current + upstream MCP server is configured. Rewrote around the actual upstream + contract: per-client MCP config file with `CONNECTION_PROFILES` JSON, + `TRANSPORT=stdio`, `AUTH_REQUIRED=false`, and + `ALLOW_UNAUTHENTICATED_STDIO=true` (later renamed `TRUST_LOCAL_STDIO` in + [microsoft/documentdb-mcp#83](https://github.com/microsoft/documentdb-mcp/pull/83); + this kit was updated to emit the new name in the 2026-05-27 entry below). + Added per-client config-file table for + Claude Code / Desktop / Cursor / Copilot CLI / Gemini CLI / VS Code. + Updated AGENTS.md's mcp-setup row accordingly. Documented that + `AUTH_REQUIRED` gates only the Entra-JWT bearer check on the MCP server's + HTTP/SSE transport and is independent of MongoDB cluster auth (SCRAM / + `authMode=entra`), TLS, and capability gates — `AUTH_REQUIRED=false` is + safe only with `TRANSPORT=stdio`, and the same caveat is captured in the + installer comments. + +Verified end-to-end (Bash + PowerShell) in sandboxed `$HOME` against fake +client configs: existing MCP servers preserved, single- and multi-element +`args` arrays preserved across JSON round-trips, idempotent re-runs do not +duplicate the `DocumentDB` entry, uninstall removes only the kit's entries +and symlinks (foreign symlinks + other server entries untouched), and +`~/.documentdb-agent-kit/` is removed on uninstall. + ## 2026-05-04 — Plugin manifests for Claude / Cursor / Codex / Gemini + bundled MCP server The kit now ships as an installable plugin/extension for every major coding agent, bundling the [DocumentDB MCP server](https://github.com/microsoft/documentdb-mcp) (`documentdb-mcp-server` on npm) alongside the existing `skills/` tree. Users get skills + database tools in a single install command. diff --git a/README.md b/README.md index 6d7689e..6d306e2 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,288 @@ # documentdb-agent-kit +[![Status: Public Preview](https://img.shields.io/badge/Status-Public%20Preview-orange?style=flat)](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) + +> [!IMPORTANT] +> **Public Preview.** This project is currently in Public Preview. APIs, +> configuration, on-disk layout, skill contents, and installer behavior may +> change in breaking ways before General Availability. There is no SLA. +> Provided "as-is"; see the [Azure Preview Supplemental Terms](https://azure.microsoft.com/support/legal/preview-supplemental-terms/). +> Not recommended for production workloads. + A bundle of agent skills + an MCP server for **Azure DocumentDB (MongoDB-compatible)** — the fully managed Azure service built on the open-source [DocumentDB](https://github.com/documentdb/documentdb) project (Postgres-backed, 99.03% MongoDB-compatible). Skills follow the [Agent Skills](https://agentskills.io/) format and the kit ships with plugin manifests for Claude Code, Cursor, Codex, Gemini CLI, and GitHub Copilot. 👉 **Capabilities and skill catalog:** [`docs/SKILLS.md`](docs/SKILLS.md) +## Repo Structure + +``` +skills/ + / # rule-folder skill (data-modeling, vector-search, …) + .md # one markdown file per rule + references/ # deep-dive reference docs (optional) + / # standalone skill (mcp-setup, query-optimizer, …) + SKILL.md # agent-facing activation + instructions + references/ # reference docs the skill loads at runtime +``` + ## Installation -The plugin bundles the [DocumentDB MCP server](https://github.com/microsoft/documentdb-mcp) (`documentdb-mcp-server` on npm — Node.js 20+) together with all skills under `skills/`. +The kit ships with a one-command installer that wires both the **skills** and +the [`microsoft/documentdb-mcp`](https://github.com/microsoft/documentdb-mcp) +server into every detected MCP client. This is the recommended path today — +the per-agent plugin/extension marketplaces below are still being published. + +### Step-by-step: macOS + +**1. Prerequisites** + +```bash +# git +xcode-select --install # if not already installed +# Node.js 20+ (Homebrew) +brew install node@20 && brew link --overwrite --force node@20 + +# Verify +git --version +node --version # must be v20.x or higher +``` + +**2. Get your DocumentDB connection string** + +- **Azure DocumentDB:** Azure portal → cluster → *Settings → Connection strings*. Shape: + `mongodb+srv://:@.mongocluster.cosmos.azure.com/?tls=true&authMechanism=SCRAM-SHA-256`. + URL-encode special characters in the password. +- **Local DocumentDB / MongoDB:** `mongodb://localhost:27017` +- **Atlas / self-hosted:** your standard MongoDB URI. + +> ⚠️ Keep the connection string in your shell only — don't paste it into any AI agent chat. + +**3. Run the installer** + +```bash +curl -fsSL https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.sh \ + | bash -s -- --uri "" --yes +``` + +Or with the URI in an env var: + +```bash +export DOCUMENTDB_URI="" +curl -fsSL https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.sh | bash -s -- --yes +``` + +**4. Fully quit and reopen each configured client.** Closing the window isn't enough — MCP config is read only at process start. + +**5. Verify** (see [Verify it worked](#verify-it-worked) below). + +### Step-by-step: Linux + +**1. Prerequisites** + +```bash +# git +sudo apt install -y git # Debian/Ubuntu +# sudo dnf install -y git # Fedora/RHEL +# sudo pacman -S git # Arch + +# Node.js 20+ — distro packages are usually too old. Pick one: + +# Option A: NodeSource (Debian/Ubuntu/Fedora/RHEL) +curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - +sudo apt install -y nodejs + +# Option B: nvm (any distro, recommended for dev machines) +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash +exec $SHELL +nvm install 20 && nvm use 20 + +# Verify +git --version +node --version # must be v20.x or higher +npm --version +``` + +**2. Get your DocumentDB connection string** — same as macOS above. + +**3. Run the installer** + +```bash +curl -fsSL https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.sh \ + | bash -s -- --uri "" --yes +``` + +> The `bash -s --` part is **required** when piping through `curl` — it tells bash that everything after is an argument to the script, not to bash itself. + +**4. Fully quit and reopen each configured client.** For terminal clients (Copilot CLI, Gemini CLI), exit and reopen the shell. + +**5. Verify** (see [Verify it worked](#verify-it-worked) below). + +> Don't `sudo` the installer — it only writes user-scoped configs. Running as root will create files owned by root in your home directory. + +### Step-by-step: Windows + +**1. Prerequisites** + +Open **PowerShell** (Windows PowerShell 5.1 or pwsh 7+) — as your normal user, not admin: + +```powershell +# git +winget install --id Git.Git + +# Node.js 20+ +winget install OpenJS.NodeJS.LTS + +# Verify (open a new PowerShell window first to refresh PATH) +git --version +node --version # must be v20.x or higher +$PSVersionTable.PSVersion # 5.1+ or 7+ +``` + +*(Optional but recommended)* Enable **Developer Mode** so the installer can use symlinks instead of copying files: *Settings → Privacy & security → For developers → Developer Mode = On*. Without it the installer falls back to copying — that still works, just less elegant for skill updates. + +**2. Get your DocumentDB connection string** — same as macOS above. + +**3. Run the installer** + +```powershell +$env:DOCUMENTDB_URI = "" +irm https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.ps1 | iex +``` + +If you get `running scripts is disabled on this system`, run this once in the same window and re-run: + +```powershell +Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass +``` + +**To pass flags** (`-Yes`, `-DryRun`, `-Uninstall`, etc.), `irm | iex` won't work — download then invoke: + +```powershell +irm https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.ps1 -OutFile $env:TEMP\install.ps1 +& $env:TEMP\install.ps1 -Uri "" -Yes +``` + +**4. Fully quit and reopen each configured client.** Use the system tray / Task Manager — closing the window isn't enough. + +**5. Verify** (see [Verify it worked](#verify-it-worked) below). + +### What gets installed + +| Path | What | +|---|---| +| `~/.documentdb-agent-kit/agent-kit/` | Clone of this repo (skills + AGENTS.md) | +| `~/.documentdb-agent-kit/mcp-server/` | Clone + build of `microsoft/documentdb-mcp` | + +Then, per detected client: + +| Client | MCP entry → | Skills → | +|---|---|---| +| Claude Code | `~/.claude.json` | `~/.claude/skills/` (symlinks) | +| Claude Desktop | `claude_desktop_config.json` (per-OS path) | `Claude/skills/` (symlinks, if dir exists) | +| Cursor | `~/.cursor/mcp.json` | — (use Cursor Rules per-project) | +| GitHub Copilot CLI | `~/.copilot/mcp-config.json` | — (copy `AGENTS.md` per-project) | +| Gemini CLI | `~/.gemini/settings.json` | — (use `GEMINI.md` per-project) | + +Existing entries in each client's config are preserved — the installer only +adds (or updates) a single `DocumentDB` entry. A timestamped `.bak` backup is +written before every JSON edit. + +### Requirements summary + +- `git` +- Node.js 20+ and `npm` (the MCP server is a Node app, built from source on + install). `--skills-only` mode skips Node requirements. + +See the per-OS step-by-step sections above for install commands. + +### Common flags + +```text +--uri DocumentDB / MongoDB connection string +--yes Non-interactive (don't prompt) +--dry-run Print planned changes; write nothing +--uninstall Remove MCP entries, skill symlinks, and ~/.documentdb-agent-kit +--clients Comma-separated: claude-code,claude-desktop,cursor,copilot-cli,gemini-cli +--skills-only Skip MCP server install +--mcp-only Skip skill linking +--mcp-ref Git ref of microsoft/documentdb-mcp (default: main) +--profile CONNECTION_PROFILES key name (default: default) +``` + +Connection string can also be supplied via `$DOCUMENTDB_URI` (or +`$env:DOCUMENTDB_URI` on PowerShell). When neither flag nor env var is set and +a TTY is attached, the installer prompts. + +### Verify it worked + +1. Fully **quit** and reopen each configured client (not just close the window). +2. Ask the agent: *"list databases using the DocumentDB MCP server with connection_profile 'default'"*. +3. You should get back the database list. + +### Uninstall + +```bash +# macOS / Linux +curl -fsSL https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.sh | bash -s -- --uninstall --yes +``` + +```powershell +# Windows +irm https://raw.githubusercontent.com/Azure/documentdb-agent-kit/main/install.ps1 -OutFile $env:TEMP\install.ps1 +& $env:TEMP\install.ps1 -Uninstall -Yes +``` + +Removes the kit's `DocumentDB` MCP entry from every client, removes skill +symlinks, and deletes `~/.documentdb-agent-kit/`. Other MCP servers and your +non-kit skills are left untouched. + +### Troubleshooting + +| Symptom | Platform | Fix | +|---|---|---| +| `bash: line N: --uri: command not found` | macOS / Linux | Missing `bash -s --` between `curl ... \|` and the flags. | +| `running scripts is disabled on this system` | Windows | `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` in the same PowerShell session, then re-run. | +| `Invoke-Expression: A parameter cannot be found that matches parameter name 'ArgumentList'` | Windows | `irm \| iex` doesn't accept flags. Use the `irm -OutFile … ; & $env:TEMP\install.ps1 -Yes` pattern. | +| `npm: Unknown command: "pm"` during MCP build | Windows | Old installer bug — re-fetch the latest `install.ps1` (fixed in this kit). | +| `node: command not found` after install | all | Open a new terminal to refresh `PATH`. With nvm, also run `nvm use 20`. | +| `npm: not found` but Node.js is installed | Linux (Debian/Ubuntu) | The distro `nodejs` package sometimes omits npm — `sudo apt install -y npm`, or use nvm. | +| `symlink failed for ; copying instead` warnings | Windows | Harmless. Enable Developer Mode if you want real symlinks. | +| Agent: `connection_profile "default" not found` | all | Tell the agent to use profile `default` explicitly, or pass `--profile ` / `-Profile ` to the installer. | +| Agent: `AUTH_REQUIRED is true ...` or server exits at launch | all | Re-run the installer — it sets `AUTH_REQUIRED=false` + `TRUST_LOCAL_STDIO=true`, required for local stdio. This only disables the MCP-server's Entra-JWT *transport* gate; your cluster's SCRAM/Entra auth is unaffected. | +| TLS error against Azure | all | Confirm `tls=true` is in the URI and the password is URL-encoded. | +| Connection timeout to Azure | all | Azure portal → cluster → *Networking* → add your client IP to the firewall allowlist. | +| `Permission denied` writing into `~/.claude.json` | Linux / macOS | Don't `sudo` the installer — it writes user-scoped configs. Run as your normal user. | + +### Manual install (no script) + +If you don't want to run the installer, every step is documented in the +[`documentdb-mcp-setup` skill](skills/mcp-setup/SKILL.md) (per-client config +file paths, MCP server config template, `CONNECTION_PROFILES` JSON, etc.). +For skills-only manual install: + +```bash +# Claude Code (project-scoped) +mkdir -p .claude && ln -s "$(pwd)/skills" .claude/skills + +# Claude Code (user-scoped) +mkdir -p ~/.claude/skills && for d in skills/*/; do ln -s "$(pwd)/$d" ~/.claude/skills/; done + +# Gemini CLI (project-scoped) +ln -s AGENTS.md GEMINI.md + +# GitHub Copilot / other AGENTS.md-aware clients: drop AGENTS.md + skills/ at repo root +``` + +On Windows, use `New-Item -ItemType SymbolicLink` or copy folders. + +### Coming soon: per-agent plugin / extension marketplaces -> ⚠️ **Plugin install paths are not yet published.** The per-agent plugin/marketplace commands below are commented out until the plugin lands in each agent's registry. In the meantime, use the [skills-only one-liner](#universal-one-liner--skills-only-no-mcp-server) to install the skill catalog. +The kit ships plugin manifests for Claude Code, Cursor, Codex, and Gemini CLI +(under `.claude-plugin/`, `.cursor-plugin/`, `.codex-plugin/`, +`gemini-extension.json`). The native marketplace install commands below are +**not yet published** — use the one-liner installer above in the meantime.