Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

MCP instrumentation retries synchronously failing handlers

Cerrado
#24,504 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
typescript

Línea de trabajo

Start at the wrapMcpServerWithSentry entry point and reproduce the synchronous handler example with the official MCP SDK. Trace the inner and outer wrappers to confirm why the same error causes a second callback invocation. Done means a throwing synchronous handler runs once and its error reaches the MCP client, with coverage for tools, resources, or prompts as appropriate.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug Core javascript

Wrapping an MCP server with wrapMcpServerWithSentry can execute a synchronous handler twice when its first invocation throws. This repeats application side effects. If the second invocation succeeds, the MCP client receives that success instead of the original failure.

Reproduced on develop at ceb8517523 with the official TypeScript SDK 1.30.0 and 2.0.0 clients and servers, including in a deployed Cloudflare Worker. Tools, resources, and prompts registered after wrapping are affected; resource callbacks registered before wrapping are also affected. Unwrapped callbacks and asynchronous rejections execute once.

For example, register this tool after wrapping, then call it once through an MCP client:

let calls = 0;
const server = wrapMcpServerWithSentry(new McpServer({ name: 'example', version: '1.0.0' }));

server.registerTool('example', {}, () => {
  calls += 1;
  if (calls === 1) {
    throw new Error('operation failed');
  }
  return { content: [{ type: 'text', text: 'unexpected retry' }] };
});

Expected: calls === 1 and the tool error reaches the client. Actual: calls === 2 and the client receives unexpected retry as a successful result.

The inner handler wrapper captures and rethrows the application error. The outer fallback catches that same error and invokes the original callback again, treating it as an instrumentation failure.

Lenguaje dominante
TypeScript
Estrellas
8.7k
Forks
1.9k
Merge medio
1 d 16 h
PR fusionados (30 d)
576

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/sentry-javascript

Todos los issues de getsentry/sentry-javascript

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.