Repository navigation
feat: connect a coding agent to the server's MCP endpoint from zitadel setup - #3549
Conversation
…l setup
setup writes a root .mcp.json, the file Claude Code and the Copilot agent
in VS Code read, naming the server's MCP endpoint as the server `zitadel`.
The file is committed and holds no secret: its headersHelper, which Claude
Code runs in the project's directory once the person trusts the folder,
reads the project secret from the git-ignored .zitadel/secret, and its
headers name ${ZITADEL_PROJECT_SECRET:-} for a client that fills it from
its environment.
setup adds its server beside the servers a .mcp.json already names and
leaves alone one that names `zitadel` or is no JSON object. The AGENTS.md
guidance names the endpoint, a docs guide explains the file and how to
connect other clients, and ADR 092 records the answer to its open
question 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmSarR3gn9oz3Btwd8H
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8b6a2c6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The fixture generator drops what setup writes that the app never reads. .mcp.json is an agent's configuration, and names the server setup ran against rather than the one the lane serves, so it is dropped as zitadel.json, AGENTS.md and README.md are, and the fixtures do not drift with the port they were generated on. Also formats the three patcher tests the .mcp.json edit touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0137eGmSarR3gn9oz3Btwd8H
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
The patch does not configure VS Code’s Copilot agent, and doctor --fix fails to restore a deleted .mcp.json file or zitadel entry.
2 open issues
What changed in this PR
Adds MCP client configuration to zitadel setup, connecting coding agents to the server’s existing API tools.
Changes:
- Generates
.mcp.jsonwith credential references while preserving existing server entries. - Adds configuration tests and excludes MCP configuration from conformance fixtures.
- Documents agent connections and records the setup decision.
| File | Description |
|---|---|
| docs/adrs/092-mcp-server.md | Records the client-configuration decision. |
| conformance/suite/bin/conformance-fixture.mjs | Excludes .mcp.json from fixtures. |
| apps/docs/content/docs/sdks/vue.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/tanstack-start.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/sveltekit.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/svelte.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/solid.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/solid-start.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/react.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/qwik.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/qwik-router.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/nuxt.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/next.mdx | Links agent connection guidance. |
| apps/docs/content/docs/sdks/angular.mdx | Links agent connection guidance. |
| apps/docs/content/docs/guides/meta.json | Adds the guide to navigation. |
| apps/docs/content/docs/guides/connect-an-agent.mdx | Explains client configuration and permissions. |
| apps/docs/content/docs/get-started/agents.mdx | Introduces MCP connections. |
| apps/cli/tests/unit/lib/orca/patchers/rule/tanstack-start/index.test.ts | Adjusts expected configuration edits. |
| apps/cli/tests/unit/lib/orca/patchers/rule/sveltekit/index.test.ts | Adjusts expected configuration edits. |
| apps/cli/tests/unit/lib/orca/patchers/rule/qwik-router/index.test.ts | Adjusts expected configuration edits. |
| apps/cli/tests/unit/lib/orca/patchers/rule/mcp-client.test.ts | Tests configuration merging and credential helper. |
| apps/cli/tests/unit/lib/orca/patchers/rule/guidance.test.ts | Tests generated MCP guidance. |
| apps/cli/tests/unit/lib/json.test.ts | Tests nested JSON edits. |
| apps/cli/tests/integration/setup.spec.ts | Tests setup’s MCP file handling. |
| apps/cli/tests/helpers/project.ts | Adds MCP configuration test helpers. |
| apps/cli/src/lib/orca/patchers/rule/mcp-client.ts | Generates and merges MCP configuration. |
| apps/cli/src/lib/orca/patchers/rule/guidance.ts | Adds endpoint guidance for agents. |
| apps/cli/src/lib/orca/patchers/rule/base.ts | Includes MCP configuration in setup plans. |
| apps/cli/src/lib/json.ts | Supports targeted nested JSON edits. |
| apps/cli/skills/zitadel-cli/SKILL.md | Documents setup’s MCP behavior. |
| .changeset/setup-mcp-client-config.md | Adds CLI minor-release notes. |
Review effort: Balanced
| import type { FileOp } from "./file-writer/types"; | ||
|
|
||
| /** The file setup writes, at the project's root. */ | ||
| export const MCP_CONFIG_FILE = ".mcp.json"; |
| return [ | ||
| { | ||
| kind: "edit", | ||
| path: MCP_CONFIG_FILE, |

Context
setupwrite the client's configuration?").Related work found in a search of issues and pull requests, open and closed: #2315 (the
zitadel mcpstdio prototype in the CLI) and #2451 (zitadel loginfor the CLI and MCP clients) are closed drafts; nothing open writes an MCP client's configuration. No overlap.Summary
zitadel setupwrites.mcp.jsonat the app's root, the file Claude Code and the Copilot agent in VS Code read. It names the server's MCP endpoint (<server>/api/v1/mcp) as the serverzitadel.headersHelper(node -p …) in the project's directory once the person trusts the folder; it reads the project secret from the git-ignored.zitadel/secret. VS Code runs no helper and fillsheadersfrom${ZITADEL_PROJECT_SECRET:-}in the environment it was started in. The empty default keeps Claude Code from warning about a variable it does not need..mcp.jsonalready names. It leaves a file alone when it already nameszitadelor is not a JSON object. It writes none for--server mock.mcpEndpointOf), so a tool set or read-only path can be added there later.SKILL.mdand ADR 092 record the decision.Validation
Run by the session that wrote the change, in its cloud container:
vitest runof the whole CLI withTERM=xterm-256color: every test passes but one, which fails only as root:auth-method sso enable when the schema cannot be writtenrelies onchmodto stop a write. With the container's defaultTERM=linux, about 40 terminal-rendering tests also fail; they pass with a Unicode terminal. Both failures are environmental.biome check src testsand the CLI typecheck: clean.setup.spec.ts: 132 pass, including three new specs..mcp.jsonis committed, holds no project secret, and is left alone when hand-written..zitadel/secretand checks the header it prints.zitadel setup --server http://localhost:8080 --framework nextagainst a local server built from this branch. Claude Code 2.1.334 started in the app, with the folder trusted and the server approved, reportszitadel … √ Connectedwith no environment variable set. The server log shows its requests authenticated (200)..mcp.jsonwith the other files setup writes for people and agents, so fixtures do not carry it and do not drift.Checked again when opening this draft:
node scripts/check-pr-title.mjs --title "…"passes, and the branch is one commit on current main.Release notes / changeset
.changeset/setup-mcp-client-config.md(@zitadel/cli, minor).zitadel setupwrites.mcp.json, which connects Claude Code and VS Code to the MCP endpoint without a secret in the file.Notes
.mcp.jsonis written, because one file covers Claude Code and VS Code. Cursor (.cursor/mcp.json,${env:…}only) and Codex (.codex/config.toml,http_headers_helperorbearer_token_env_var) are shown in the guide and not written. Writing them is a small follow-up.doctor --fixreplays the edit, as it does for the guidance sections, so it restores azitadelentry someone deleted.ejectleaves.mcp.jsonas it is.https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
Generated by Claude Code