Looker's `use_client_oauth` mode can't complete OAuth from a browser client (CORS) — proposing a discovery/token proxy
Prerequisites
- Search the current open issues
What are you trying to do that currently feels hard or impossible?
Problem
Several sources already support useClientOAuth for per-request, browser-supplied
access tokens (bigquery, alloydbadmin, cloudgda, cloudhealthcare,
cloudloggingadmin, cloudmonitoring, cloudsqladmin, spanner, and others). All of
those authenticate against Google's own OAuth infrastructure
(accounts.google.com / oauth2.googleapis.com), which is built to support
public, browser-based clients directly — proper CORS headers, PKCE, etc.
Looker's use_client_oauth mode (internal/sources/looker) is the exception.
Looker's own OAuth authorization server doesn't send CORS headers on its
/.well-known/oauth-authorization-server discovery document or its token
endpoint. That means a browser-based MCP client can discover that it needs
Looker OAuth (via PRM), but can't actually complete the flow — both the
discovery fetch and the token exchange are blocked by the browser itself
before the request reaches Looker.
Today there's no way to use use_client_oauth: true against Looker from a
browser client. Non-browser clients (a backend service, curl, etc.) are
unaffected, since CORS is a browser-enforced restriction.
Proposed fix
Have the toolbox proxy both endpoints itself, adding the CORS headers Looker doesn't send:
GET /.well-known/oauth-authorization-server→ the toolbox serves a synthesized discovery document.authorization_endpointpoints directly at Looker (fine — that redirect happens via top-level navigation, not subject to CORS).token_endpointpoints back at the toolbox's own proxy, not at Looker, so a standards-compliant client's token exchange gets routed through the CORS-safe path automatically.POST /oauth/token→ the toolbox forwards the exchange to Looker server-side, where CORS doesn't apply, and relays the response back.
I have a working implementation and tests for this already (happy to open the PR once scope is agreed — see the open design question below).
Open design question
Looker is the only source today with a third-party OAuth server that has this
CORS gap — every other useClientOAuth source rides on Google's own compliant
OAuth infra. That raises a real question about how narrow or general the fix
should be:
Option A — small, generic interface. Add something like
sources.OAuthProxySource (mirrors the existing auth.MCPAuthService pattern
already used for PRM/auth discovery) with two methods
(ClientOAuthEnabled() bool, OAuthAuthorizationServerBaseURL() string).
internal/server mounts the proxy routes only if exactly one configured
source implements it and needs it. Zero implementers today besides Looker,
but any future non-Google source with the same CORS limitation could opt in
without touching internal/server again.
Option B — Looker-only. Skip the new interface; type-assert
*looker.Source directly wherever the proxy is mounted, or keep the routes
entirely inside internal/sources/looker. Smaller diff, no new public
interface surface, at the cost of coupling something outside
internal/sources/looker to a concrete source package (or duplicating
per-source HTTP mounting logic if kept fully inside the source package).
I don't have a strong opinion on which fits the project's conventions better and would rather get maintainer input before writing (or rewriting) a PR against one shape or the other. Happy to share the current implementation (built against Option A) as a reference if useful.
Suggested Solution(s)
Have the toolbox proxy both of Looker's endpoints itself, adding the CORS headers Looker's own authorization server doesn't send:
- GET /.well-known/oauth-authorization-server — the toolbox serves a
synthesized discovery document.
authorization_endpointpoints directly at Looker (fine, since that redirect happens via top-level browser navigation and isn't subject to CORS).token_endpointpoints back at the toolbox's own proxy rather than at Looker, so a standards-compliant OAuth client's token exchange is automatically routed through the CORS-safe path. - POST /oauth/token — the toolbox forwards the exchange to Looker server-side, where CORS doesn't apply, and relays the response back.
Open design question on scope: Looker is the only source today whose
authorization server has this CORS gap (every other useClientOAuth source
rides on Google's own CORS-compliant OAuth infra), so this could be added
either as (a) a small generic interface any source can opt into — something
like sources.OAuthProxySource with ClientOAuthEnabled() and
OAuthAuthorizationServerBaseURL() methods, mirroring how auth.MCPAuthService
already works for PRM/auth discovery — or (b) a Looker-specific
implementation with no new public interface. I have a working prototype of
option (a) with tests, and can share it or open a PR once there's agreement
on which shape is preferred.
Alternatives Considered
- Run a separate reverse proxy in front of Looker just to add CORS headers to its OAuth endpoints. Works, but it's extra infrastructure every deployer using use_client_oauth with Looker would have to stand up and maintain themselves, rather than something the toolbox handles once.
- Don't support use_client_oauth with Looker from browser-based clients at all — fall back to a single service-account-style credential for the whole toolbox process. This is what we run today, but it means every tool call is authenticated as one shared identity rather than the actual end user, which we're trying to move away from for audit and access-control reasons.
Additional Details
No response
Source: googleapis/mcp-toolbox