Repository navigation
Description
Symptom
ChatGPT dev-mode apps cannot authenticate against any altinity-mcp broker-mode deployment post-#115. /oauth/authorize rejects with:
{"error":"invalid_client","error_description":"unknown OAuth client"}Pod log:
DBG OAuth /authorize rejected: CIMD resolution failed
error="cimd: invalid metadata document: token_endpoint_auth_method must be \"none\" (got \"private_key_jwt\")"
client_id=https://chatgpt.com/oauth/kDmjx77UnKOM/client.json
Root cause
#115 (cmd/altinity-mcp/cimd.go::parseCIMDMetadata) hardcodes token_endpoint_auth_method == "none" as the only accepted value. This matches claude.ai's CIMD doc but not ChatGPT's. ChatGPT publishes:
{
"client_id": "https://chatgpt.com/oauth/<id>/client.json",
"client_uri": "https://chatgpt.com/",
"redirect_uris": ["https://chatgpt.com/connector/oauth/<id>"],
"grant_types": ["authorization_code","refresh_token"],
"response_types": ["code"],
"client_name": "ChatGPT",
"token_endpoint_auth_method": "private_key_jwt",
"token_endpoint_auth_signing_alg": "RS256",
"jwks_uri": "https://chatgpt.com/oauth/jwks.json"
}ChatGPT uses RFC 7523 §2.2 private_key_jwt: it signs a client_assertion JWT with its private key, server verifies via the published JWKS. Strictly more authentication than none+PKCE — not less. Our blanket rejection is wrong.
Spec references
- RFC 7591 §2 —
token_endpoint_auth_methodregistered values includeprivate_key_jwt. - RFC 7523 §2.2 — JWT bearer client authentication.
- RFC 7521 §4.2 —
client_assertion/client_assertion_typeparams at token endpoint. - MCP authorization 2025-11-25 explicitly allows CIMD clients to declare
private_key_jwt.
Scope
cmd/altinity-mcp/cimd.go
- Add
JWKSURI string \json:"jwks_uri"`andTokenEndpointAuthMethodtocimdMetadata`. - Accept either
none(PKCE-only public client) orprivate_key_jwt(withjwks_urinon-empty + URL-validated same way as CIMDclient_idURL — https only, SSRF-safe IP, IDNA-clean host). - Reject
client_secret_*methods (we never have a client secret). - Surface auth method + JWKS URI on
statelessRegisteredClient.
cmd/altinity-mcp/oauth_server.go
- At
/oauth/token, if the resolved CIMD client usesprivate_key_jwt:- Require
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer. - Require
client_assertionform param. - Parse JWT header, look up
kidin the CIMD client's JWKS (fetched SSRF-safely; cache reusescimdCachepattern but separate keyspace, e.g.jwks:<jwks_uri>). - Verify signature with the matching JWK.
- Validate claims:
iss == sub == client_id,audincludes our/oauth/tokenURL,expnot expired,nbfif present,iatwithin window,jtifor replay (short in-memory cache, TTL = exp - now + 60s — matches recommendation in RFC 7523 §3 ¶10).
- Require
- Maintain existing
nonepath unchanged for claude.ai.
Tests (cmd/altinity-mcp/cimd_test.go + new oauth_private_key_jwt_test.go)
- CIMD doc parse:
noneaccepted,private_key_jwtw/jwks_uriaccepted,private_key_jwtw/ojwks_urirejected,client_secret_basicrejected. /tokenwith validclient_assertion→ success; tampered signature → 401; expired → 401; wrong aud → 401; replay → 401.
E2E
- Repeat the 2026-05-15 claude.ai E2E matrix on otel-google-mcp / otel-google-gating-mcp / antalya-mcp / github-mcp (confirm no regression for
none+PKCE). - Add ChatGPT side: create dev-mode app pointing at each MCP, OAuth flow,
execute_query SELECT currentUser(), 1+1.
Out of scope
- DPoP (separate auth_method, separate spec, ChatGPT doesn't use it today).
client_secret_jwt(we have no shared secret with the client).- Server-initiated revocation list / dynamic JWKS rotation — TTL-based cache invalidation matches what we already do for CIMD docs.
Affected deployments
All four production broker-mode MCPs (post-#115):
otel-google-mcp(forward)otel-google-gating-mcp(gating + broker_upstream)github-mcp(gating + broker_upstream)antalya-mcp(forward)
claude.ai keeps working on all four — only ChatGPT is blocked.
Detection
User reported the failing URL from a fresh ChatGPT dev-mode app:
https://otel-google-36be80-mcp.demo.altinity.cloud/oauth/authorize?...&client_id=https%3A%2F%2Fchatgpt.com%2Foauth%2FkDmjx77UnKOM%2Fclient.json&...
Verified the CIMD doc lives at that URL (HTTP 200, JSON, 485 bytes) — issue is purely on our parser/validator side.
Activity
Merge pull request #119 from Altinity/feature/cimd-private-key-jwt-118
cimd: support private_key_jwt CIMD clients (Altinity#118)