Skip to content

build(deploy): let MCP clients sign a person in on the hosted cloud - #3533

Merged
fforootd merged 2 commits into
mainfrom
claude/festive-hamilton-y0f0dx
Dec 1, 2026
Merged

fforootd merged 2 commits into
mainfrom
claude/festive-hamilton-y0f0dx

Conversation

@fforootd

@fforootd fforootd commented Dec 1, 2026

Copy link
Copy Markdown
Member

Context

Summary

The hosted cloud served /api/v1/mcp with a project secret, but not the OAuth server an MCP client signs a person in through: vercel.json sent /oauth/* and the well-known metadata to the website's 404, and the launcher left oauth.enabled off (/console/runtime.json said "oauth_enabled": false).

  • Routes (vercel.json): /oauth/*, /.well-known/oauth-authorization-server/* and /.well-known/oauth-protected-resource/* go to the server. The rest of /.well-known/ stays the website's, so security.txt keeps its redirect.
  • The switch (apps/api/cmd/cloud-launcher): the launcher defaults NEXTGEN_OAUTH_ENABLED to true.
  • Which clients: the launcher also defaults NEXTGEN_OAUTH_CLIENT_DOCUMENT_HOSTS to the hosts of the MCP clients that publish a client ID metadata document: claude.ai (Claude, Claude Code), chatgpt.com (ChatGPT, Codex), vscode.dev, zed.dev, goose-docs.ai, antigravity.google.
  • Overrides: both variables are launcher defaults, so a variable on the Vercel project overrides them. NEXTGEN_OAUTH_ENABLED=false and a redeploy turn the server off again.
  • Deployment check (e2e/console/src-deployment/routes.spec.ts): reads the endpoint's metadata and its 401 challenge, and holds that the OAuth paths reach the server.
  • Docs: the runbook and ADR 092 say what the cloud serves, how to turn it off, and which firewall rule to extend.

What this turns on beyond MCP:

  • oauth.enabled is one switch for the whole OAuth server. A customer project's issuer answers once its release turns OAuth on, where the Console said "Off on this server" until now.
  • The build's seeding deploys the platform project's release with its OAuth settings and an auth.client.admit policy. A seeding that fails fails the build, and the serving deployment stays.

Validation

  • go test ./cmd/cloud-launcher/ passes:
    • TestVercelJSONSendsTheServerOnlyItsOwnPaths now holds the OAuth paths to the server and security.txt, /oauth and /.well-known/openid-configuration to the website. It fails without the new rules.
    • The deployment-shape test pins both defaults; another test shows explicit values are kept.
    • TestClientDocumentHostsAreAListTheServerTakes validates the host list with the server's own check.
  • go vet ./cmd/cloud-launcher/ and gofmt -l are clean.
  • The launcher binary run locally (SQLite, no VERCEL_ENV, public base http://localhost:18741):
    • It seeded and started with OAuth on.
    • /console/runtime.json said "oauth_enabled": true.
    • POST /api/v1/mcp without a credential answered 401 with WWW-Authenticate: Bearer resource_metadata=".../.well-known/oauth-protected-resource/api/v1/mcp".
    • The protected-resource metadata named http://localhost:18741/oauth as its authorization server.
    • The issuer's metadata had client_id_metadata_document_supported: true, S256 and none.
    • GET /oauth/authorize with client_id=https://example.com/client.json answered 400 invalid_client ("this server does not admit clients whose document that host serves"), with no fetch.
    • The same request with Claude Code's document (https://claude.ai/oauth/claude-code-client-metadata) answered 302 to /console/login?auth_request=….
  • The new deployment check passes against that local server (CLOUD_URL=http://localhost:18741 playwright test --config console/playwright.deployment.config.mts -g "MCP client finds").
  • pnpm exec tsc --noEmit -p tsconfig.json in e2e, biome on the spec, and node scripts/check-pr-title.mjs pass.
  • vitest run scripts/cloud-build.test.mjs fails one case ("restored Go caches skip compilation…") in my container, on main without this change as well: it runs the Vercel build script, which the container cannot.
  • Not verified:
    • vercel.json's routes on a real Vercel deployment; the launcher test resolves them.
    • A full sign-in by a real client on the cloud. The platform issuer answers on the public base only, so that test needs production after merge.

Release notes / changeset

Notes

  • Firewall (Vercel project state, by hand): the server-per-address rule lists the server's root paths. /oauth/* and the two /.well-known/oauth-* prefixes belong in it too (runbook, Firewall rules). The rules are still on log.
  • Testing after merge: connect a client to https://preview.zitadel.com/api/v1/mcp. Previews sit behind Vercel Authentication, and the platform issuer answers only on the public base, so a preview cannot run the sign-in.
  • Known rough edges (ADR 092 §8):
    • Consent is asked on every connection.
    • A grant ends with its session, a day by default.
    • No page revokes an agent's access yet.

Generated by Claude Code

The cloud served the MCP endpoint with a project secret, but not the OAuth
server a client signs a person in through: vercel.json sent /oauth/* and
the well-known metadata to the website, and the launcher left
oauth.enabled off.

vercel.json now sends /oauth/*, /.well-known/oauth-authorization-server/*
and /.well-known/oauth-protected-resource/* to the server; the website
keeps /.well-known/security.txt. The launcher defaults NEXTGEN_OAUTH_ENABLED
to true and NEXTGEN_OAUTH_CLIENT_DOCUMENT_HOSTS to the hosts of the MCP
clients that publish a client document (Claude and Claude Code, ChatGPT
and Codex, VS Code, Zed, goose, Antigravity), so the platform issuer
fetches no document from any other host. Either variable on the Vercel
project overrides it; NEXTGEN_OAUTH_ENABLED=false turns the server off.

A deployment check reads the endpoint's metadata and its 401 challenge,
and holds that the OAuth paths reach the server. The runbook and ADR 092
say what the cloud serves, how to turn it off, and that the firewall's
server-per-address rule should list the new paths.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U
Copilot AI balanced review requested due to automatic review settings December 1, 2026 23:15
@vercel

vercel Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Dec 1, 2026 11:18pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-12-01T23:23:03.907232Z f9a5ca8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ No Changeset found

Latest commit: 68dd25b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…e rule

One rule names the two documents, as the rule for the API's resources
names them; the rest of /.well-known/ stays the website's, so
security.txt keeps its redirect.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0137eGmVSt2DgYJj2CjZbi1U

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The public OAuth rollout still requires maintainer validation of Vercel routing, the manual firewall update, and a real MCP client’s complete sign-in, consent, and token exchange flow.

No open issues 🎉

What changed in this PR

Enables MCP clients to sign users in on the hosted cloud using the existing OAuth server.

Changes:

  • Routes OAuth endpoints and discovery metadata to the server.
  • Enables OAuth by default with an overridable client-document host allowlist.
  • Adds routing and configuration checks, and documents deployment controls.
File Description
vercel.json Routes OAuth endpoints and metadata to the server.
e2e/​console/​src-deployment/​routes.spec.ts Checks MCP discovery, authentication challenges, and OAuth routing.
docs/​runbooks/​cloud.md Documents OAuth defaults, overrides, and firewall updates.
docs/​adrs/​092-mcp-server.md Records hosted-cloud support as implemented.
apps/​api/​cmd/​cloud-launcher/​main.go Defaults OAuth on and restricts client-document hosts.
apps/​api/​cmd/​cloud-launcher/​main_test.go Checks routes, defaults, host validation, and overrides.

Review effort: Balanced

@fforootd
fforootd added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 4115800 Dec 1, 2026
17 checks passed
@fforootd
fforootd deleted the claude/festive-hamilton-y0f0dx branch December 1, 2026 23:43
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Dec 1, 2026

This branch was successfully deployed

1 active deployment
Preview — 68dd25b5 Deployed Dec 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants