Skip to content

docs(spec): spec 132 opt-in browser login for MCP clients - #1996

Merged
Dumbris merged 16 commits into
mainfrom
claude/oauth-api-key-client-role-eb4179
Nov 23, 2026
Merged

Dumbris merged 16 commits into
mainfrom
claude/oauth-api-key-client-role-eb4179

Conversation

@Dumbris

@Dumbris Dumbris commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Spec 132: opt-in browser login (OAuth) for MCP clients, next to API keys. Docs only, no code.

Related #1971

What it specifies

  • MCPProxy can act as the OAuth 2.1 authorization server for its own MCP endpoint, so a client needs only a URL.
  • Off by default. With mcp_oauth_enabled off and never used, every existing address answers as before and nothing new is stored. API keys, client credentials and agent tokens are unchanged either way.
  • Which client it is comes from the address, not from the name the client reports. Connect writes /mcp/oauth/<client-id>; the generic /mcp/oauth makes the administrator choose on the consent page.
  • A browser login is one more credential under a Clients hub row and uses that client's single profile binding.
  • Consent on every login; loopback only and personal edition only in version 1.

Files

  • specs/132-client-oauth-login/design.md — decisions and rejected alternatives
  • spec.md, plan.md, research.md, data-model.md, quickstart.md, contracts/, tasks.md (71 tasks, three delivery PRs)
  • ROADMAP.md regenerated by the pre-commit hook

Review

Cross-model review with opencode gpt-6.1-sol: design three rounds (round 3 clean), plan set five rounds (round 5 clean). Findings and how each was resolved are listed in the Review sections of design.md and plan.md.

Open risk carried into PR-1

The issuer is plain HTTP on loopback and clients must follow discovery for a path below the MCP root. Task T044 checks Claude Code, Cursor, VS Code and MCP Inspector before any UI work starts.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: fc5e11d
Status: ✅  Deploy successful!
Preview URL: https://709aa79a.mcpproxy-docs.pages.dev
Branch Preview URL: https://claude-oauth-api-key-client.mcpproxy-docs.pages.dev

View logs

@Dumbris Dumbris changed the title docs(spec): spec 131 opt-in browser login for MCP clients docs(spec): spec 132 opt-in browser login for MCP clients Nov 22, 2026
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build Artifacts

Workflow Run: View Run
Branch: claude/oauth-api-key-client-role-eb4179

Available Artifacts

  • archive-darwin-amd64 (33 MB)
  • archive-darwin-arm64 (30 MB)
  • archive-linux-amd64 (20 MB)
  • archive-linux-arm64 (18 MB)
  • archive-windows-amd64 (33 MB)
  • archive-windows-arm64 (29 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (29 MB)
  • installer-dmg-darwin-arm64 (26 MB)
  • smart-mcp-proxymcpproxy-goVA1ATD.dockerbuild (0 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 45161299876 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Dumbris
Dumbris marked this pull request as draft November 22, 2026 17:47
The issue author asked for the consent page to be pre-filled from the
client name with the user able to override it; approved by the maintainer.
The reported name may pre-select one client on the generic address when it
matches exactly one known client. It decides nothing by itself.

Related #1971
@Dumbris
Dumbris marked this pull request as ready for review November 23, 2026 10:58
Dumbris added a commit that referenced this pull request Nov 23, 2026
…ec 132 PR-1a) (#1997)

First slice of Spec 132 (opt-in browser login for MCP clients, spec in
#1996): the switch and the gate. The endpoints are not functional yet.

Related #1971

## What changes

- New config field `mcp_oauth_enabled` (default `false`, omitted from
saved configs), env `MCPPROXY_MCP_OAUTH_ENABLED` (process-only, not
persisted), hot-reloadable.
- New patterns registered on the HTTP mux, each behind a per-request
gate (`internal/server/oauth_login_routes.go`): `/mcp/oauth`,
`/mcp/oauth/`, `/oauth/register`, `/oauth/authorize`, `/oauth/token`,
`/.well-known/oauth-authorization-server`,
`/.well-known/oauth-protected-resource/mcp/oauth` and its subtree.

| Switch | Ever used | Answer |
|---|---|---|
| off (default) | no | the handler that answered the path before this PR
|
| off | yes | 404 (cannot happen yet: nothing sets "used") |
| on | any | 501 stub, only for a loopback TCP peer with a loopback Host
in a personal-edition build; otherwise 404 |

No `/oauth/` or `/.well-known/` subtree is registered, so the mux adds
no trailing-slash redirect that did not exist before.

## With the switch off nothing changes

- `TestOAuthLogin_DefaultOff_RoutesUnchanged` compares a mux with the
new patterns against one without them for 14 paths × GET/POST × three
credential states × `require_mcp_auth` on/off (status, body, `Location`,
`WWW-Authenticate`). It builds both muxes with a test helper around the
real host-validation and MCP-auth middleware, not through
`startCustomHTTPServer`.
- `TestOAuthLogin_DefaultOff_NoStorage`: no bucket or meta key is
created.
- `./scripts/test-api-e2e.sh` against the built binary: 77/77.

## Verification

- `go test -race` for `internal/config`, `internal/runtime`,
`internal/server` (personal and `-tags server`, CI skip regex): pass.
- `golangci-lint` with `.github/.golangci.yml`, bare and `--build-tags
server`: 0 issues.
- Cross-model review (opencode `gpt-6.1-sol`): round 1 one finding
(server-edition check used the config, not the build; fixed in the
second commit), round 2 clean.
@Dumbris
Dumbris merged commit b9c52d6 into main Nov 23, 2026
52 checks passed
Dumbris added a commit that referenced this pull request Nov 23, 2026
## Summary

Second slice of Spec 132 (opt-in browser login for MCP clients, spec in
#1996). Pure protocol logic in the new leaf package `internal/mcplogin`;
nothing calls it yet, so no behaviour changes.

- Token formats (`mcp_oat_` access, `mcp_ort_` refresh with a MAC), PKCE
S256, redirect URI matching (loopback, any port), resource and issuer
checks, registration validation, in-memory limiter and bounded state.
- No new dependencies.

## Review

Cross-reviewed with opencode `github-copilot/gpt-6.1-sol` until clean.

## Testing

`go test -race ./internal/mcplogin/...`

Related #1971
Dumbris added a commit that referenced this pull request Nov 23, 2026
…132 PR-1c) (#2012)

## Summary

Third slice of Spec 132 (opt-in browser login for MCP clients; spec
merged in #1996, switch in #1997, protocol in #2010). Storage only;
nothing serves it yet, so no behaviour changes while `mcp_oauth_enabled`
is off (the default).

- bbolt buckets for registrations, grants and the ever-used marker,
created only when first written.
- One binding writer shared by API-key clients and browser logins; pins
restored by binding incarnation.
- Removal of a client purges its logins in the same transaction.
- No new dependencies.

## Review

Cross-reviewed with opencode `github-copilot/gpt-6.1-sol` until clean.

## Testing

`go test -race ./internal/storage/...`

Related #1971
Dumbris added a commit that referenced this pull request Nov 23, 2026
## Summary

Fourth slice of Spec 132 (opt-in browser login for MCP clients; spec
#1996, switch #1997, protocol #2010, storage #2012). Runtime service
only; no HTTP endpoint serves it yet, so nothing changes while
`mcp_oauth_enabled` is off (the default).

- `OAuthLoginService`: describe, preview, approve, deny, exchange,
refresh, revoke, list.
- Exchange and refresh run under the config commit lock with one config
snapshot; the binding guard (`binding_bypassable_without_auth`) covers
browser logins.
- Atomic HMAC key creation; refresh-token replay revokes the grant.
- Activity rows for approve, deny, issue, revoke and replay.
- No new dependencies.

## Review

Cross-reviewed with opencode `github-copilot/gpt-6.1-sol`, five rounds,
clean.

## Testing

`go test -race ./internal/runtime/... -run 'OAuth|Oauth'`

Related #1971
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.

2 participants