Skip to content

feat(console): publish oauth client metadata document - #47737

Merged
rekram1-node merged 3 commits into
devfrom
cimd-url
Sep 7, 2026
Merged

feat(console): publish oauth client metadata document#47737
rekram1-node merged 3 commits into
devfrom
cimd-url

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Publishes an OAuth Client ID Metadata Document (CIMD) for the opencode client at https://opencode.ai/oauth/opencode/client.json.

This is the first half of CIMD support for MCP OAuth. When an MCP authorization server advertises client_id_metadata_document_supported, opencode will be able to present this URL as its client_id instead of doing Dynamic Client Registration against every server. The authorization server fetches the document to learn the client name and allowed redirect URIs. No client-side integration in this PR; that follows separately.

The document is fully public by design: it contains only the app name, logo, redirect URIs, and grant types. This mirrors what OpenAI (chatgpt.com/oauth/codex/client.json), Anthropic, and Microsoft publish for their clients.

Document

{
  "client_id": "https://opencode.ai/oauth/opencode/client.json",
  "client_name": "opencode",
  "client_uri": "https://opencode.ai",
  "logo_uri": "https://opencode.ai/web-app-manifest-512x512.png",
  "application_type": "native",
  "redirect_uris": ["http://127.0.0.1/callback", "http://localhost/callback"],
  "grant_types": ["authorization_code", "refresh_token"],
  "response_types": ["code"],
  "token_endpoint_auth_method": "none",
  "token_endpoint_auth_methods_supported": ["none"]
}

Notes:

  • client_id is derived from the request origin so the document stays self-consistent on dev.opencode.ai and preview stages (the spec requires it to equal the exact URL served).
  • redirect_uris are portless loopback; opencode binds an ephemeral port per login and RFC 8252 §7.3 has authorization servers ignore the port for native-app loopback redirects. Same choice as Codex and Claude Code.
  • application_type: "native" is included explicitly; omitting it defaults to web under RFC 7591 and disables the loopback-port exemption on some servers (this bit Claude Code).
  • Served as a SolidStart API route (same pattern as changelog.json.ts) rather than a static file so Content-Type, Cache-Control, and CORS are explicit.

Deployment note

Authorization servers fetch this URL server-side from datacenter IPs. If any Cloudflare bot-protection or WAF rule applies to opencode.ai, /oauth/opencode/client.json needs to be exempt or CIMD logins will fail with a JS-challenge page (this happened to Anthropic's document).

@rekram1-node
rekram1-node merged commit 57ef382 into dev Sep 7, 2026
8 checks passed
@rekram1-node
rekram1-node deleted the cimd-url branch September 7, 2026 06:11
1056674754 added a commit to 1056674754/opencode that referenced this pull request Sep 9, 2026
Upstream v1.18.29 (1674747, merged at 18a4845) -> v1.18.30 (3104c14),
28 commits / 105 files. Staged delta vs pre-merge fork HEAD is identical to
the upstream tag-to-tag diff (105 files, +1676/-403), confirming a clean
adoption.

Functional changes:
- feat(opencode): port Astra system prompt from v2 (anomalyco#48057) — new
  session/prompt/gpt-astra.txt wired through system.ts; fork's system
  transforms live in the openchamber plugin, no overlap.
- fix: preserve Bedrock DeepSeek model ids (anomalyco#34441) — provider.ts Bedrock
  loader passes arn: model ids through unmodified and tightens the
  cross-region prefix match from "deepseek" to "deepseek.r1"; inside the
  custom Azure/Bedrock loader region, disjoint from the fork snapshot
  architecture.
- fix(provider): preserve explicit OpenAI service tiers (anomalyco#47671).
- fix(opencode): add GitLab reasoning variants (anomalyco#47306) — transform.ts
  reasoningEffort now routes gitlab gpt-family to reasoningEffort and
  claude-family to adaptive thinking; disjoint from the fork GLM/ZhiPu
  normalization block, which remains intact (+77 fork-only lines).
- SDK bumps: @ai-sdk/openai 3.0.88, @ai-sdk/azure 3.0.93,
  gitlab-ai-provider 6.15.0 (8 packages installed via bun install).
- console: oauth client metadata document (anomalyco#47737), Chatwoot enterprise
  form (anomalyco#47488), openai usage normalization + tier threshold (anomalyco#47342),
  localized refund FAQs, zen model table updates (muse spark); go.mdx
  client session compatibility docs incl. zh translation.

Conflicts resolved: 29 package.json version bumps (rebranded 1.18.30-sscity
with a version-generic pattern after the v1.18.27 incident), bun.lock (took
upstream, rebranded workspace entries via bun install). Fork deltas
verified intact vs v1.18.30: ProviderSnapshot architecture (+492 in
provider.ts), deferred snapshot init, GLM normalization (+77 in
transform.ts), config getFresh/commitFresh (+14). Tests: provider,
transform, bedrock, config, v2, azure plugin, session retry/llm — 1058
pass / 0 fail across 15 files (22 new upstream tests included); typecheck
clean.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant