Skip to content

Act as an OAuth authorization server for MCP clients (DCR) instead of per-client API keys #1971

Open

Description

@felipecrs

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:

  1. A request without a token gets 401 + WWW-Authenticate: Bearer resource_metadata=… (RFC 9728).
  2. The client discovers /.well-known/oauth-authorization-server (RFC 8414) and registers via DCR (RFC 7591).
  3. 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.
  4. 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_name is 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.

Activity

  1. Dumbris commented on Nov 22, 2026

    @Dumbris
    Member

    @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/oauth URL 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?

  2. felipecrs commented on Nov 22, 2026

    @felipecrs
    ContributorAuthor

    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.

  3. 33 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions