createMcpHandler: Mcp-Param header validation and scope challenges only run when the factory returns an McpServer
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
- 45/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- backend-api-design, security
Direção de pesquisa
Start by locating createMcpHandler and its existing checks for McpServer products; the issue identifies the affected behavior but names no file or test. Trace how factory products reach handler.fetch and how the schema and scope challenge helpers are called. Done means a low-level Server can use the proposed options or exported helpers for both checks, with tests covering header validation and scope challenges.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
In 2.4.0, createMcpHandler runs two pre-dispatch checks for modern requests, but only when the factory's product is an McpServer:
if (route.messageKind === "request" && route.message.method === "tools/call" && product instanceof McpServer) {
const inputSchema = product.toolInputSchemaJson(toolName);
// scanXMcpHeaderDeclarations → validateMcpParamHeaders → rejectionResponse
}
if (route.messageKind === "request" && product instanceof McpServer) {
const challenge = await findScopeChallenge([route.message], authInfo, (context) => product.resolveScopeChallenge(context));
// createScopeChallengeResponse
}
The factory may return a low-level Server instead. In that case both checks are skipped without any warning:
- SEP-2243
Mcp-Param-*header validation. A request whose headers disagree with its tool arguments goes straight through to the handler. - OAuth scope challenges. No 403
insufficient_scopeis ever produced.
A low-level Server is the only option when the tool list can't be fixed when the instance is created. Examples:
- visibility that depends on the request's client capabilities;
- pagination cursors bound to the caller;
- extension methods;
- task and input-required results.
Such servers have to re-implement both checks before calling handler.fetch. scanXMcpHeaderDeclarations, validateMcpParamHeaders and createScopeChallengeResponse are not exported, so they have to be re-implemented from scratch rather than called.
Proposal, either of:
- Handler options that work with any product (preferred):
createMcpHandler(factory, { toolInputSchema?: (name: string, context) => JsonSchema | undefined, scopeChallenge?: ScopeChallengeHandler, })McpServerkeeps supplying its own throughtoolInputSchemaJsonandresolveScopeChallengewhen the options are absent. - At minimum, export the helpers:
scanXMcpHeaderDeclarations,validateMcpParamHeaders,findScopeChallengeandcreateScopeChallengeResponse. Servers built onServercould then reuse the exact SDK behavior.
Either way, it would help if the handler warned when a non-McpServer product skips these checks.
Context: we maintain an MCP server component on the low-level Server. It currently carries its own copy of the header validation and the scope-challenge responses for exactly this reason.
- 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á 7 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
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Vessel9817/onion-site-template#512 ·
Mantenedores costumam responder em até 1 dia
-
nightly-tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
BlackBeltTechnology/pi-agent-dashboard#1256 ·
Mantenedores costumam responder em até 1 dia
-
approved
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
fritzprix/libr-agent#3266 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
better-auth/better-auth#13101 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia