Repository navigation
Description
Summary
mcp/oauthlogin requires an iss parameter on every OAuth callback. iss comes from
RFC 9207, which is an optional extension, so mecatl can only complete an OAuth
login against an authorization server that happens to implement it. Against any other
the callback is discarded, no authorization code is ever read, and the flow waits out
its callback timeout.
mcp/oauthlogin/callback.go (validQuery):
for _, required := range []string{"state", "iss"} {
if len(query[required]) != 1 {
return false
}
}Who this affects
The MCP OAuth login path, which is the flow that authenticates mecated to a remote
MCP server requiring OAuth:
cmd/mecated/mcplogin.gointernal/adapter/mcp/oauth_login.gointernal/app/mcplogin.go
Which providers break
Checked by fetching each discovery document for
authorization_response_iss_parameter_supported:
| Provider | Advertises RFC 9207 |
|---|---|
| yes | |
| Keycloak 26.7 | yes |
| Microsoft Entra ID | no |
| GitLab | no |
| Apple | no |
| Salesforce | no |
| Dex | no |
Dex is the confirmed case: its callback arrives with code and state and no iss,
and login cannot complete. Keycloak's advertises true, and login works.
Absence of the metadata field means the server does not advertise support, which is
not absolute proof it never emits the parameter — but it is the signal RFC 9207 keys
the requirement on, and in practice a server without the metadata field has not
implemented the parameter.
Not checked: Okta, Auth0, Ping, Cognito. Their discovery documents are per-tenant, so
there is no public URL to fetch; do not read their absence from the table either way.
Worth checking separately: vMCP's own embedded authorization server. MCP servers often
run a minimal embedded AS rather than delegating to a full IdP, and a minimal
implementation is exactly the kind that skips an optional 2022 extension. If it does
not emit iss, mecatl cannot OAuth against our own vMCP.
Why it is hard to diagnose
The failure is silent. The browser shows "Authorization could not be completed"; the
process learns nothing, because the rejection reason never leaves the HTTP response,
and the run ends on a generic ErrAuthorizationFailed after the callback timeout.
Locating it currently means reading the validation code.
Proposed fix
RFC 9207 section 2.4: validate iss when it is present, and require it only when the
authorization server's discovery document advertises
authorization_response_iss_parameter_supported. That keeps mix-up protection for a
server that promised an iss — it cannot be stripped — while working with servers that
never offered one.
The listener holds no discovery document, so the required-if-advertised half cannot
live in mcp/oauthlogin. On this path the natural home is
internal/adapter/mcp/oauth_login.go, which already receives the discovery result and
passes result.Iss through to the SDK.
A version of this fix exists on spike/mecak8s-vmcp-b1-login, where the second half
lives in internal/adapter/clientauth (that path does its own discovery). It is not a
cherry-pick: the layer that owns the check differs.
Activity
fix(mcp): support optional RFC 9207 issuers
jhrozek commentedon Aug 27, 2026
Correction to the proposed fix in the description, after reading the SDK.
The MCP Go SDK already implements RFC 9207 section 2.4 independently, in
auth/authorization_code.go(validateIssuerResponse, called from theauthorization-code handler), keyed on its own discovery metadata:
So the description is wrong on two counts:
internal/adapter/mcp. It already exists downstream, and duplicating it therewould be redundant.
mcp/oauthlogin/callback.go: validateisswhen present, stop requiring it.Mix-up protection for this consumer is preserved by the SDK, which is stricter
than a bare relaxation -- it also rejects an
issthat arrives when the serverdid not advertise support.
spike/mecak8s-vmcp-b1-logincarries that relaxation along with arequired-if-advertised check in
internal/adapter/clientauth(needed there becausethe mecatui path does its own discovery and does not go through the SDK). Merging
that branch closes this issue; extracting just the
callback.gochange would closeit sooner and is a three-file diff.