Server metadata advertises the RFC 8414 issuer with a trailing slash (URL normalization in createOAuthMetadata)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- express, node.js, typescript
- Domínio
- authentication, backend
Direção de pesquisa
Start in packages/server-legacy/src/auth/router.ts: read createOAuthMetadata and authorizationHandler, then trace how issuerUrl reaches both the metadata issuer and the RFC 9207 iss parameter. Compare with checkIssuerUrl and the e2e scenario hosting:auth:as-iss-emission, which currently pins the slashed form. Done means both fields are byte-identical and slash-less for root issuers and the regression tests named in PR #3184 pass.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Description
createOAuthMetadata (packages/server-legacy/src/auth/router.ts) writes the metadata issuer as issuerUrl.href. Because new URL('https://host').href normalizes to https://host/, an authorization server built from a slash-less origin string advertises its issuer with a trailing slash.
RFC 8414 §2 forbids a trailing slash on the issuer identifier, and §3.3 requires the metadata issuer to be byte-identical to the URL the well-known document was fetched from.
Reproduction
import express from 'express';
import { mcpAuthRouter } from '@modelcontextprotocol/sdk/server/auth/router.js';
// minimal provider stub…
const app = express();
app.use(mcpAuthRouter({
provider: mockProvider,
issuerUrl: new URL('https://auth.example.com'), // no trailing slash — the usual case
}));
app.listen(3000);
curl -s http://localhost:3000/.well-known/oauth-authorization-server | jq .issuer
# → "https://auth.example.com/" ← slash appeared
# expected → "https://auth.example.com"
The SDK's own client fails the same round trip: discoverAuthorizationServerMetadata validates the metadata issuer echo against the discovery URL and throws IssuerMismatchError when they differ. So on SDK 1.32.x an SDK server and an SDK client cannot complete OAuth discovery against each other for any root issuer — and other strict RFC 8414 clients (Python SDK's validate_metadata_issuer, OpenCodealt's client, …) reject it identically. We hit this in production: strict clients could not connect any OAuth-protected MCP behind our authorization server until we patched the served document.
Proposed fix
packages/server-legacy/src/auth/router.ts — derive the identifier slash-less before writing the field (an issuerIdentifierOf() that strips the single normalization slash); both new URL('https://host') and new URL('https://host/') then serve the same compliant metadata. The RFC 9207 iss parameter emitted by authorizationHandler has the same normalization and needs the same treatment to stay byte-identical with the metadata issuer (its e2e scenario hosting:auth:as-iss-emission currently pins the slashed form).
Upstream PR with the fix + regression tests: #3184
Additional context
- The client side needs no change — main's
IssuerMismatchErrorecho check is correct and already tolerates a slashed discovery URL against a slash-less metadata issuer; it's the server document that's wrong. - Related but distinct: #1968 covered the client-side
resourceindicator trailing slash; this is the server-sideissuerfield, still unfixed on main. - Happy to rebase/adjust if maintainers would rather enforce this in
checkIssuerUrl(rejecting slashed input) than normalize on output — normalizing was chosen for backward compatibility with existing deployments.
- Linguagem predominante
- TypeScript
- Estrelas
- 13.8k
- Forks
- 2.5k
- Merge médio
- 6d 23h
- PRs com merge (30d)
- 2
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem 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/typescript-sdk
-
v2
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Talvez já em andamento @mgoldsborough assumiu há 6 dias. Abertav2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
modelcontextprotocol/typescript-sdk#3249 ·
Mantenedores costumam responder em até 1 dia
-
v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyTalvez já em andamento @Tidehyc assumiu há 8 dias. Abertav2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsTalvez já em andamento @yunusemrejs assumiu há 12 dias. Abertav1 v2
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de modelcontextprotocol/typescript-sdk
Issues semelhantes
-
triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
novuhq/novu#13613 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
enhancement from-app needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
nightly-labs/openbot#23943 ·
Mantenedores costumam responder em até 1 dia
-
comp/desktop desktop/chat P3 type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
NousResearch/hermes-agent#164451 ·
Mantenedores costumam responder em até 1 dia
-
shortkeys-2188:ready
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
crittermike/shortkeys#1121 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
Doist/todoist-cli#742 ·