createMcpHandler: Mcp-Param header validation and scope challenges only run when the factory returns an McpServer
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend-api-design, security
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 13.8k
- Fork
- 2.5k
- Merge medio
- 6g 23h
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/typescript-sdk
-
v2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
modelcontextprotocol/typescript-sdk#3270 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
`callTool` with `allowInputRequired: true` throws on an `input_required` result when the tool declares an `outputSchema`Forse già presa @mgoldsborough l’ha presa 6 giorni fa. Apertav2
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
modelcontextprotocol/typescript-sdk#3249 ·
I maintainer di solito rispondono entro 1 giorno
-
v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
modelcontextprotocol/typescript-sdk#3243 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
TypeScript client accepts an unknown `resultType` in the first `server/discover` replyForse già presa @Tidehyc l’ha presa 7 giorni fa. Apertav2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/typescript-sdk#3235 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
UriTemplate.match() throws a TypeError on an empty expression it acceptsForse già presa @yunusemrejs l’ha presa 12 giorni fa. Apertav1 v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
modelcontextprotocol/typescript-sdk#3221 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/typescript-sdk
Issue simili
-
clawsweeper:intake:bug clawsweeper:intake:needs-environment
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
openclaw/openclaw#212827 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
KT-2245 e2e specs that call the backend directly fall back to the developer's own Kronn on :3140Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Use one constant for the 10,000-character input limitForse già presa @NginxL l’ha presa oggi. Apertagood first issue refactor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
aniru-dh21/snap-validate#51 ·
I maintainer di solito rispondono entro 1 giorno
-
dependencies effort: small good first issue priority: low
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
TMHSDigital/screencast-mcp#509 ·
I maintainer di solito rispondono entro 1 giorno
-
from-review tech-debt testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
blamechris/chroxy#9520 ·
I maintainer di solito rispondono entro 1 giorno