`createMcpHandler` is validation-free; bare fetch mounts can skip the Host/Origin guards the framework helpers install |
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nodejs, typescript
- Área
- backend-api-design, security
Línea de trabajo
The issue is about adding Host/Origin validation to createMcpHandler in packages/server/src/server/createMcpHandler.ts. Start by reading the existing JSDoc and the docs/serving/http.md guide to understand the current validation-free behavior. Look at the hostHeaderValidationResponse and originValidationResponse utilities to see how validation is applied. The goal is to design an API option or wrapper that adds these guards, while keeping an escape hatch for reverse-proxy deployments. Test by mounting the handler in a fetch-native runtime like Workers or Deno.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Static review of public source at commit 603217008710. No traffic was sent to any MCP environment.
createMcpHandler intentionally performs no Host/Origin (or token) checks — documented in the JSDoc and in docs/serving/http.md. Framework helpers (createMcpExpressApp / Hono / Fastify) arm those checks for loopback. The bare fetch entry does not:
packages/server/src/server/createMcpHandler.ts (doc comment on the export):
* When mounting bare on a fetch-native runtime,
* put Origin/Host validation in front of the handler — the entry itself is
* deliberately validation-free:
*
* const rejected =
* hostHeaderValidationResponse(request, localhostAllowedHostnames()) ??
* originValidationResponse(request, localhostAllowedOrigins());
* return rejected ?? handler.fetch(request);
On Workers / Deno / Bun, export default handler (as shown earlier in the same guide for “Mount it on your runtime”) is a one-liner that never installs those guards unless the reader continues to the later section. That is a footgun relative to the Express path, where loopback protection is automatic.
Suggested change:
- Offer
createMcpHandler(factory, { allowedHosts, allowedOrigins })(or awithLocalhostProtection(handler)wrapper) that applieshostHeaderValidationResponse/originValidationResponsebeforefetch. - Or make the quickstart
export defaultexample always show the validation wrapper first. - Keep a documented escape hatch for authenticated reverse-proxy deployments.
Severity: low–medium / API footgun and defense-in-depth (complements finding #1 on non-loopback Express/Hono binds). No proof-of-concept.
Happy to send a focused PR if useful.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13.6k
- Forks
- 2.3k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 51
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de modelcontextprotocol/typescript-sdk
-
Stateless 405 response omits the Allow headerPosiblemente ocupada @Hugo-DDT la tomó hace 1 día. Abiertov2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
modelcontextprotocol/typescript-sdk#2970 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
[v2] @modelcontextprotocol/server inlines fast-uri 3.1.0, which has 9 published advisoriesPosiblemente ocupada @Andiii208 la tomó hace 3 días. Abiertov2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/typescript-sdk#2966 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
v1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/typescript-sdk#2946 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
[v2] URI template reserved expansions encode existing %HH sequences againPosiblemente ocupada @takagibit18 la tomó hace 10 días. Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/typescript-sdk#2920 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[v2] URI template strict expansions leave !'()* unencodedPosiblemente ocupada @takagibit18 la tomó hace 10 días. Abiertov1 v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
modelcontextprotocol/typescript-sdk#2919 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/typescript-sdk
Issues similares
-
🐛 Bug: Calendar work items cannot be opened on mobilePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
[Bug]: [A11y] Missing accessible name on icon-only standalone links (WCAG 2.1 SC 2.4.4, 4.1.2)Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
jaegertracing/jaeger-ui#4596 ·
Los mantenedores suelen responder en 1 día
-
area:tui enhancement platform:macos
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
anthropics/claude-code#101490 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
netlify/netlify-mcp#75 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día