EMA leg 3: support private_key_jwt client authentication at the resource authorization server
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 58/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- typescript
- Domaine
- api, authentication
Piste de recherche
Start with core/auth/ema/wire.ts and core/auth/ema/tokenEndpoint.ts, then review the existing createPrivateKeyJwtAuth SDK helper and the prototype details in the issue. Trace how per-server oauth.clientSecret is stored, redacted, and edited in Server Settings, and check the existing EMA and keychain tests. Done when leg 3 can use a private key to send a token-endpoint-audience client assertion without sending a configured secret, with key storage and UI covered.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Which client?
All / shared core
The problem
When a server uses enterprise-managed authorization, leg 3 (redeeming the ID-JAG at the resource authorization server with the jwt-bearer grant) can only authenticate the client with client_secret_post or, since #2725, none. redeemIdJagForAccessToken in core/auth/ema/wire.ts builds the client information from resourceClientSecret alone, and applyClientAuth in core/auth/ema/tokenEndpoint.ts handles only client_secret_basic and client_secret_post.
An ID-JAG is a bearer assertion, so a resource AS can reasonably require a confidential client at leg 3, and some require one that proves possession of a key (private_key_jwt). Against such a server the Inspector cannot complete leg 3 at all, even though leg 2 succeeds.
To reproduce:
- Register a client at a resource AS that advertises
private_key_jwtintoken_endpoint_auth_methods_supportedand requires a key for thejwt-bearergrant. - Configure the IdP in Client Settings → Enterprise-Managed Authorization, connected to that resource AS for the same client id.
- In the server's settings, turn on enterprise-managed authorization and set the Resource AS Client ID.
- Connect. Leg 2 returns an ID-JAG. Leg 3 fails with
invalid_client, because the request carries either no client authentication or a secret the server does not accept.
Solution you have in mind (optional)
A third choice next to the client secret: a private key. When set, leg 3 sends client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer and a client_assertion signed with it, with iss = sub = the client id and aud = the token endpoint (RFC 7523 §2.2, §3), and no client_secret.
The SDK already ships createPrivateKeyJwtAuth, so core/ would take no new dependency. Two details worth deciding deliberately:
- Pass
audexplicitly as the token endpoint. The helper defaultsaudto the AS metadataissuer. RFC 7523 allows that, but some servers accept only the token endpoint URL there; the token endpoint is the value every server accepts. kid.createPrivateKeyJwtAuthhas no option to put akidin the assertion header. A server that tries each registered key works without one; a server that selects the key bykidwould not. An optionalkidin the SDK helper would close that gap.
Alternatives or workarounds you have tried
- Registering a second, secret-based client at the resource AS just for the Inspector. That is only possible where the AS still allows secrets for this grant, and it tests a different client from the one real agents use.
- Minting the resource token outside the Inspector (a separate script doing legs 1–3 with the key) and pasting it as a static
Authorization: Bearerheader. That works, but it skips the Inspector's own discovery, resource and scope handling, which is what we wanted to exercise.
Already built it locally?
Yes, as a prototype in a fork, and tested end to end against a real resource AS: IdP sign-in, ID-JAG from the IdP, leg 3 authenticated with private_key_jwt, then tools listed. The design, so it can be reproduced through your workflow:
- A new
core/auth/ema/clientAssertion.ts. It accepts a PKCS#8 PEM or a private JWK and infers the algorithm from the key: a JWK's ownalgwins; otherwise ES256, ES384, ES512, RS256 and EdDSA are tried in order. It returns the two form parameters. A SEC1 or PKCS#1 PEM is rejected with a message pointing toopenssl pkcs8 -topk8 -nocrypt, and a public JWK is rejected as having no private part. redeemIdJagForAccessTokentakes an optionalresourceClientPrivateKey. The order is key, then secret, then none. With a key set, no secret is sent, even if one is configured.- The key is a per-server
oauth.clientPrivateKey, handled exactly likeclientSecret: it is kept in the OS keychain (new fieldoauth-client-private-key), never written tomcp.json, kept on a config-only save, and shown as[redacted]byservers list. - Server Settings → Authorization gets a "Resource AS Client Private Key" input, shown only while enterprise-managed authorization is on, since it is used only at leg 3. A pasted PEM loses its line breaks in a single-line input; that is harmless, because
joseignores whitespace in PEM bodies. - Tests: unit tests for the new module (keys generated per run with
jose, the assertion checked withjwtVerify), a leg-3 test asserting a valid assertion is sent and the configured secret is not, keychain lift/merge round-trip tests, form tests, and the redaction case inservers-list.test.ts.
It was prototyped with an AI coding agent from a short instruction: "add private_key_jwt client authentication to EMA leg 3: an optional per-server key, the assertion's aud set to the token endpoint, sent as client_assertion + client_assertion_type". Happy to share screenshots of the settings field and the successful connection.
Before you submit
- I searched existing issues and this is not a duplicate.
- This is a request for the Inspector itself, not for the MCP specification or an SDK.
- Langage dominant
- TypeScript
- Étoiles
- 11.3k
- Forks
- 1.6k
- Merge moyen
- 2 h 28 min
- PR mergées (30 j)
- 111
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/inspector
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
modelcontextprotocol/inspector#3073 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
modelcontextprotocol/inspector#3072 ·
Les mainteneurs répondent en général sous 1 jour
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it furtherOuvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
modelcontextprotocol/inspector#3071 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
modelcontextprotocol/inspector#3069 ·
Les mainteneurs répondent en général sous 1 jour
-
CLI --tool-args-json silently sends 1e400 as null (round-trip guard missing; mcpdo rejects it)Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
modelcontextprotocol/inspector#3067 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de modelcontextprotocol/inspector
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
danielmiessler/LifeOS#3028 ·
Les mainteneurs répondent en général sous 5 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
Koenkk/zigbee2mqtt#33855 ·
Les mainteneurs répondent en général sous 1 jour