Act as an OAuth authorization server for MCP clients (DCR) instead of per-client API keys
Problem Every MCP client needs a key generated in MCPProxy and pasted into its config. That's manual, the key sits in plaintext in client config files, and rotating it means editing every client.
Proposal
Let MCPProxy be the OAuth 2.1 authorization server for its own MCP endpoint, following the MCP authorization spec. A client is set up with just a URL, e.g. http://127.0.0.1:8080/mcp/oauth (a separate path, so /mcp behaves as it does today), and logs in on its own:
- A request without a token gets
401+WWW-Authenticate: Bearer resource_metadata=…(RFC 9728). - The client discovers
/.well-known/oauth-authorization-server(RFC 8414) and registers via DCR (RFC 7591). - The browser opens a consent page in the Web UI. The logged-in admin approves it and can pick a profile or which servers it can reach.
- Authorization code + PKCE (S256) → access + refresh token.
Issued tokens are agent tokens underneath, so profiles, scoping, activity attribution and revocation keep working. The client shows up in the Clients hub under its approved registration.
Security
- Approval needs a Web UI session; registrations that are never approved expire. DCR is rate-limited and capped.
client_nameis self-asserted, so a client is identified by its approved registration, not its name.- Redirect URIs are limited to loopback or HTTPS (RFC 8252).
- API keys and agent tokens stay available for headless clients.
Related Spec 089 (remote access tunnel) already plans these endpoints (DCR, authorize/consent, token) for tunneled traffic. Building them for the local endpoint first would give the tunnel its login check for free.
@felipecrs thanks for this, I like the idea and started on it. Spec is in #1996. It will be opt-in at first, and API keys stay.
One UX question where I'd like your opinion: after the OAuth login, how should MCPProxy know which client it is, so it can apply the right profile?
client_name from DCR is self-reported, so I don't want to trust it. Current plan:
- Connect writes a per-client URL, e.g.
/mcp/oauth/cursor. The consent page says "Sign-in request for Cursor" and uses Cursor's profile. One click. - A generic
/mcp/oauthURL also works. There you pick "new client" or an existing one, plus a profile, on the consent page.
Does that match how you'd expect it to work? Or would you rather always choose the profile on the consent page, whatever the URL is?
I have no problem with the per-client URL, but I think it would be nicer to choose the profile in the consent page.
I would also pre-fill it based on the client name, which I suppose will be enough for most cases, while still allowing users to override it during consent page.
@felipecrs your suggestion is in. On the generic /mcp/oauth address the consent page is now pre-filled from the name the client reports, and you can change it before approving. It only pre-selects when the name matches exactly one known client, and the page says the name is unverified. A per-client address from Connect still fixes the client.
One difference: for a client that already has a profile, the page shows the profile but you change it in the Clients hub, because it also applies to that client's API key.
It is all on main, off by default (mcp_oauth_enabled), and ships in the next release. Docs: https://docs.mcpproxy.app/features/client-oauth-login/. Connect writes the OAuth config for Claude Code only for now, so I'm keeping this issue open for the other clients. If you try it, I'd like to hear how the consent page feels.
Status on browser login for MCP clients (Spec 132), 2026-11-25:
- Claude Code: works (
connect --auth oauthand the Connect screens), as before. - MCP Inspector 2.13.0 (web): verified end to end at the generic
/mcp/oauthaddress (registration, consent/approval, MCP 2025-11-25, tools listed). It has no config file Connect can write, so it is not a Connect client; the per-client address only exists once a client id does. - Cursor 3.12.30 / VS Code 1.122.0: not verified. A scratch Cursor requires a Cursor account sign-in before it uses MCP, and VS Code could not be driven safely in a scratch profile. They stay on API keys, and Connect refuses
--auth oauthfor them. Cursor's docs say its desktop redirect ishttp://localhost:8787/callback, which this server accepts, so it may work once someone checks it with a real session. - The Connect screen was swept in a real browser (choice, diff, connect, Undo, feature off): no defect found. Record and screenshots are in PR #2039.
Works in VS Code (official/stable):
I just think that it should have plugged into the existing built-in client automatically (instead of suggesting me to create a new one), this one:
And speaking of which, I wonder if it should allow users to select the built-in clients when connecting so that they can force it to attach to what they want. Not sure if reasonable, though. (Currently it only shows my custom profiles).
@felipecrs thank you for trying VS Code and for the screenshots.
The cause: VS Code reports itself as visual studio code, which is a known name of the built-in VS Code client. But the page only compared names with clients that already had an API key or a login, and the built-in one had neither yet, so it was never a candidate.
Fix in #2047: built-in clients without records are now matched too, and the page suggests them. You still confirm before anything is attached.
Your picker question: yes, added in the same PR. The Client list now also shows the built-in clients, so you can pick one yourself and override the suggestion. Choosing it asks for a profile like a new client does.
One thing to know: that name matches the built-in "VS Code" client, not "GitHub Copilot (VS Code, Copilot CLI)", which is a separate client. If you wanted the Copilot one, pick it from the list.
@Dumbris not sure what is the best profile in that case for VS Code.
The thing is VS Code used to use its own harness, but now they migrated to Copilot harness.
They are advertising hard for people to migrate, although the previous harness can still be chosen (just no longer the default).
The existing VS Code profile in MCP Proxy was created for such previous harness. It's the one that reads MCP servers from the VS Code config dir rather than from Copilot dir.
So, I'm not really sure. I used VS Code via Copilot harness for this test, and I personally would have expected it to attach to the Copilot entry (which says VS Code under parenthesis).
My hope is that we can retire the plain "VS Code" in future from MCP Proxy, supposing the vs code's previous harness will eventually be retired as well.
@felipecrs you are right, thank you for the detail. VS Code sends the same registration name, "Visual Studio Code", on both harnesses, so the name alone cannot tell them apart. That is why #2047 suggested plain "VS Code".
I changed #2047. The page now suggests, in this order:
- the one of the two that already has a key or login;
- else the one whose MCP client name this install saw in the last 30 days (
vscode-agent-hostmeans the Copilot harness); - else "GitHub Copilot (VS Code, Copilot CLI)", because it is VS Code's default harness.
Both stay in the list, and nothing is attached until you approve. I could not check what the older harness sends at registration, so that part is unverified.
On retiring plain "VS Code": not yet. The older harness can still be chosen until February 2027, so the entry stays until then.