EMA leg 3: support private_key_jwt client authentication at the resource authorization server
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 58/100
- Tipo de issue
- Funcionalidade
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- api, authentication
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 11.3k
- Forks
- 1.6k
- Merge médio
- 2h 28min
- PRs com merge (30d)
- 111
Preparar o ambiente
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de modelcontextprotocol/inspector
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
modelcontextprotocol/inspector#3073 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
modelcontextprotocol/inspector#3072 ·
Mantenedores costumam responder em até 1 dia
-
CLI/mcpdo: a timeout above 2147483647 ms fires after 1 ms, and the error says to raise it furtherAbertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
modelcontextprotocol/inspector#3071 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/inspector#3069 ·
Mantenedores costumam responder em até 1 dia
-
CLI --tool-args-json silently sends 1e400 as null (round-trip guard missing; mcpdo rejects it)Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/inspector#3067 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/inspector
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
danielmiessler/LifeOS#3028 ·
Mantenedores costumam responder em até 5 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 90/100
Koenkk/zigbee2mqtt#33855 ·
Mantenedores costumam responder em até 1 dia