Skip to content

Commit 24b5ed8

Browse files
authored
fix(console): register legacy MCP OAuth callback (#58453)
1 parent 02671e6 commit 24b5ed8

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎packages/console/app/src/routes/oauth/opencode/client.json.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ export function GET(event: APIEvent) {
2222
client_uri: origin,
2323
logo_uri: origin + "/web-app-manifest-512x512.png",
2424
application_type: "native",
25-
redirect_uris: ["http://127.0.0.1/callback", "http://localhost/callback"],
25+
redirect_uris: [
26+
"http://127.0.0.1/callback",
27+
"http://localhost/callback",
28+
// Older clients use this path; loopback ports still vary per login.
29+
"http://127.0.0.1/mcp/oauth/callback",
30+
],
2631
grant_types: ["authorization_code", "refresh_token"],
2732
response_types: ["code"],
2833
token_endpoint_auth_method: "none",

‎services/www/src/docs/content/mcp-servers.mdx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,13 @@ With CIMD, OpenCode sends its metadata document URL as the `client_id` and skips
238238
https://opencode.ai/oauth/opencode/client.json
239239
```
240240

241-
The document allows the loopback redirects `http://127.0.0.1/callback` and `http://localhost/callback` without a port. Authorization servers accept any loopback port for these redirects, as [RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252#section-7.3) requires, so `callback_port` works with CIMD. A custom `redirect_uri` does not, so OpenCode falls back to DCR.
241+
The document allows these loopback redirects without a port:
242+
243+
- `http://127.0.0.1/callback`
244+
- `http://localhost/callback`
245+
- `http://127.0.0.1/mcp/oauth/callback` for older clients
246+
247+
Authorization servers accept any loopback port for these redirects, as [RFC 8252](https://datatracker.ietf.org/doc/html/rfc8252#section-7.3) requires, so `callback_port` works with CIMD. A custom `redirect_uri` does not, so OpenCode falls back to DCR.
242248

243249
If the authorization server supports neither CIMD nor DCR, configure a pre-registered client.
244250

0 commit comments

Comments
 (0)