Repository navigation
Conversation
Clients that cached mcp.onkernel.com's own OAuth endpoints still register, authorize and exchange tokens against the TypeScript routes. The Kernel API does not recognize the tokens those routes issue, so every MCP request with them fails with 401 "Organization context not found". On mcp.onkernel.com and mcp.dev.onkernel.com, 308 /authorize, /register, /token and /.well-known/oauth-authorization-server to the matching hosted authorization server. Credentials issued by the TypeScript routes are not migrated; the hosted server rejects them and clients register again. Local, preview and other hosts keep serving OAuth from this app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MCP clients that cached
mcp.onkernel.com's own OAuth endpoints (from its/.well-known/oauth-authorization-serveror saved/register,/authorize,/tokenURLs) still go through the TypeScript OAuth routes. The Kernel API does not recognize the tokens those routes issue:GET /auth/contextfinds no org record for the JWT, so every MCP request fails with401 Organization context not found. This happens even right after a successful authorization or refresh.Production request logs show the pattern across several clients. The client gets a 401 on
/mcp, refreshes atmcp.onkernel.com/token(200,outcome: success), and gets 401 again with the new token. Clients registered againstauth.onkernel.comare unaffected.This PR sends those clients to the hosted Go authorization server instead of keeping the TypeScript path alive:
mcp.onkernel.comandmcp.dev.onkernel.com,/authorize,/register,/tokenand/.well-known/oauth-authorization-servernow return a308to the same path and query onauth.onkernel.com/auth.dev.onkernel.com.308preserves the method and body forPOST /tokenandPOST /register.OPTIONSpreflights still reach the existing route handlers, so browser clients get CORS headers before following the redirect.oauthResourceMetadata.hostedAuthorizationServeris factored out of it./mcpand/.well-known/oauth-protected-resource/mcpare unchanged; they already point at the hosted server.Behavior for existing credentials
Credentials issued by the TypeScript routes are intentionally not migrated:
/registerexist only in Clerk, not in the Go server's client registry, so the Go server rejects them.invalid_grant/ re-authorize.Affected clients need to reconnect once. Re-registration now lands on the Go server. Clients whose HTTP stack does not follow redirects on
POST /tokensee a failed refresh and prompt the user to reconnect. Clients that pinnedhttps://mcp.onkernel.comas the issuer and validate RFC 9207issstrictly may also need a reconnect.Follow-up, not in this PR: remove the now-unreachable TypeScript OAuth handlers and the Redis proxy path they depend on.
Testing
bun test: 1140 pass, 0 fail. New cases insrc/proxy.test.tscover both hosted origins, theHostheader behind Next,OPTIONSpassthrough, non-hosted origins (localhost, preview, look-alike host), and/mcpplus resource metadata staying put.bunx tsc --noEmitis clean.bun run format:checkflags onlyAGENTS.md, which also fails onmain.🤖 Generated with Claude Code