MCP instrumentation retries synchronously failing handlers
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
- Domínio
- observability
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 8.7k
- Forks
- 1.9k
- Merge médio
- 1d 16h
- PRs com merge (30d)
- 576
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 getsentry/sentry-javascript
-
Browser Bug Next.js Traces Waiting for: Product Owner
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
getsentry/sentry-javascript#24672 · 1 comentário ·
-
javascript
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
getsentry/sentry-javascript#24200 · 2 comentários ·
-
javascript Task
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
getsentry/sentry-javascript#24134 · 1 comentário ·
-
Cloudflare Workers javascript Tests
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
getsentry/sentry-javascript#24051 · 1 comentário ·
-
Bug Bun javascript
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 92/100
getsentry/sentry-javascript#24045 · 1 comentário ·
Todas as issues de getsentry/sentry-javascript
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
bcgov/bc-wallet-mobile#4761 · 1 comentário ·
-
external-issue to-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
area-deployment area-integrations triage:bot-seen
Dificuldade 2/5 Meio dia Facilidade para iniciantes 86/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
-
refactor
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100