Skip to content

Add gated native OAuth verification and token exchange - #207

Open
rgarcia wants to merge 4 commits into
mainfrom
hypeship/oauth-native-consumer
Open

rgarcia wants to merge 4 commits into
mainfrom
hypeship/oauth-native-consumer

Conversation

@rgarcia

@rgarcia rgarcia commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Add a default-off native OAuth consumer without changing MCP hosting, public discovery or existing Clerk/API-key authentication.

  • Select native credentials without falling back to Clerk; verify issuer, audience, epoch, signature and authoritative status with pinned configuration.
  • Authenticate the configured MCP intermediary to exchange an MCP-audience token for narrower, parent-bound API access. Never forward the native MCP token to the API.
  • Recheck native status on every request and cap native streams at a one-minute authorization lease.
  • Accept additive service-principal auth-context responses and record bounded compatibility outcomes for retained verification/authorize/token/register paths.
  • Reject native protocol credentials sent to the retained TypeScript issuer endpoints.

Deployment order

Depends on kernel/kernel#4236 being deployed first. Keep OAUTH_NATIVE_ENABLED=false until the issuer and test intermediary are configured. No deployment, DNS/discovery change or activation is included. Existing /mcp hosting remains unchanged.

Configuration uses only server-pinned issuer URLs, audiences, public keys, recovery epoch and an explicit intermediary client credential. JWT headers/claims never supply a fetch destination. Native connection context is not cached; independent API authorization still applies on every tool call. The issuer currently closes unsupported delegation/credential-producing API surfaces, so this is not full native tool parity.

Validation

  • bunx tsc --noEmit passed.
  • 69 focused tests passed across native exchange/lease, auth context, MCP transport and retained token/authorize/register suites.
  • Prettier and diff whitespace checks passed.
  • No real signed-in client, production issuer, Vercel stream or live telemetry-ingestion acceptance was run. Local native tests use real RSA signatures with mocked authority HTTP responses.

@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
mcp Ready Ready Preview Sep 20, 2026 2:50pm UTC

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 543f575. Configure here.

Comment thread src/app/[transport]/route.ts
Comment thread src/lib/native-oauth.ts Outdated
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