Documentation
¶
Overview ¶
Command mcp-auth-proxy fronts an OAuth-protected MCP server with an unauthenticated loopback endpoint, so a tool that cannot send a bearer token (the conformance runner) can grade the server behind it.
go run ./cmd/mcp-auth-proxy -server https://metronome-mcp.fly.dev/mcp -addr 127.0.0.1:18201
Tokens come from auth.OAuthTokenSource, which runs the MCP authorization flow on oneauth's client primitives: protected-resource and AS discovery, dynamic client registration (RegisterClient), and the authorization-code grant with PKCE (LoginWithBrowser). LoginWithBrowser hands the authorization URL to an OpenBrowser hook. With -headless (the default) that hook is oneauth's ApproveConsent, which plays the user clicking Approve on a demo consent page (metronome's); with -headless=false it opens a real browser, which a real login page needs.
A 401 from the server triggers a fresh registration and login before the request is retried once. That covers a server that restarted and forgot its clients, not only an expired token.