[Bug] MCP tool calls double-dispatched with different tool_use_ids
Bug Description
Claude Code Double-Dispatches Every MCP Tool Call
Environment: Claude Code 2.1.79, Windows 11, MCP server via cmd /c npx -y @k-system/tickr-mcp (stdio transport)
Problem: Every single MCP tool call is executed exactly twice with identical parameters, ~2-4ms apart. This affects ALL tools (read, write, create, update,
delete) — not just specific ones.
Evidence from MCP debug log:
[09:57:25.661Z] [create_ticket] params={...} → ok (555ms)
[09:57:25.794Z] [create_ticket] params={...} → ok (689ms) ← DUPLICATE
[09:57:33.409Z] [update_ticket] params={...} → error (406ms)
[09:57:34.010Z] [update_ticket] params={...} → ok (1008ms) ← DUPLICATE (causes concurrency error)
[09:41:25.195Z] [create_implementation_item] params={...} → ok (226ms)
[09:41:25.203Z] [create_implementation_item] params={...} → ok (234ms) ← DUPLICATE
Impact:
- CREATE operations produce duplicate records (two tickets, two comments, two relations)
- UPDATE operations cause DbUpdateConcurrencyException — first call succeeds, second fails because entity was already modified
- DELETE operations cause DbUpdateConcurrencyException — first deletes, second finds nothing
What we ruled out:
- Not a retry (retries have 100ms+ delay, these are 2-4ms apart)
- Not duplicate MCP server registration (verified single registration in .claude.json)
- Not agent/team configuration (happens with and without agent features)
- Not MCP server bug (server receives two separate calls — confirmed by debug logging)
- Colleague with identical setup on different machine does NOT have duplicates
Related GitHub issues:
- https://github.com/anthropics/claude-code/issues/22658 — "MCP tool calls duplicated multiple times when using parallel subagents" (closed as duplicate)
- https://github.com/anthropics/claude-code/issues/13897 — "Agent calls tools twice after permission approval" (closed as NOT PLANNED)
- https://github.com/anthropics/claude-code/issues/14253 — "Messages sent during Task agent execution are delivered twice"
Workaround attempted: MCP server-side dedup using tool_use_id cache. However, both duplicate calls appear to have different tool_use_ids, so the dedup only
catches Claude Code's subsequent retries, not the initial double-dispatch.
Current mitigation: API-side DedupHash with UNIQUE constraint on create endpoints + graceful catch of DbUpdateException. This prevents duplicate records but
doesn't stop the unnecessary second API call.
Environment Info
- Platform: win32
- Terminal: WezTerm
- Version: 2.1.79
- Feedback ID: f4a1a330-4233-4856-bd0d-c1bee7e5828d
Errors
[{"error":"Error: Tool mcp__tickr__list_tickets not found\n at CY8 (B:/~BUN/root/src/entrypoints/cli.js:2802:48341)\n at _K (B:/~BUN/root/src/entrypoints/cli.js:698:20995)\n at MK (B:/~BUN/root/src/entrypoints/cli.js:698:39537)\n at oO (B:/~BUN/root/src/entrypoints/cli.js:698:50228)\n at zkH (B:/~BUN/root/src/entrypoints/cli.js:698:86972)\n at OkH (B:/~BUN/root/src/entrypoints/cli.js:698:85934)\n at PkH (B:/~BUN/root/src/entrypoints/cli.js:698:85756)\n at qsH (B:/~BUN/root/src/entrypoints/cli.js:698:82114)\n at vH (B:/~BUN/root/src/entrypoints/cli.js:698:6492)\n at VH (B:/~BUN/root/src/entrypoints/cli.js:698:4974)","timestamp":"2026-03-19T09:03:04.140Z"},{"error":"Error: Tool mcp__tickr__list_tickets not found\n at CY8 (B:/~BUN/root/src/entrypoints/cli.js:2802:48341)\n at _K (B:/~BUN/root/src/entrypoints/cli.js:698:20995)\n at MK (B:/~BUN/root/src/entrypoints/cli.js:698:39537)\n at oO (B:/~BUN/root/src/entrypoints/cli.js:698:50228)\n at zkH (B:/~BUN/root/src/entrypoints/cli.js:698:86972)\n at OkH (B:/~BUN/root/src/entrypoints/cli.js:698:85934)\n at PkH (B:/~BUN/root/src/entrypoints/cli.js:698:85756)\n at qsH (B:/~BUN/root/src/entrypoints/cli.js:698:82114)\n at vH (B:/~BUN/root/src/entrypoints/cli.js:698:6492)\n at VH (B:/~BUN/root/src/entrypoints/cli.js:698:4974)","timestamp":"2026-03-19T09:03:04.140Z"},{"error":"Error: Tool mcp__tickr__list_tickets not found\n at CY8 (B:/~BUN/root/src/entrypoints/cli.js:2802:48341)\n at _K (B:/~BUN/root/src/entrypoints/cli.js:698:20995)\n at MK (B:/~BUN/root/src/entrypoints/cli.js:698:39537)\n at oO (B:/~BUN/root/src/entrypoints/cli.js:698:50228)\n at zkH (B:/~BUN/root/src/entrypoints/cli.js:698:86972)\n at OkH (B:/~BUN/root/src/entrypoints/cli.js:698:85934)\n at PkH (B:/~BUN/root/src/entrypoints/cli.js:698:85756)\n at qsH (B:/~BUN/root/src/entrypoints/cli.js:698:82114)\n at vH (B:/~BUN/root/src/entrypoints/cli.js:698:6492)\n at VH (B:/~BUN/root/src/entrypoints/cli.js:698:4974)","timestamp":"2026-03-19T09:03:04.140Z"},{"error":"Error: To…
Note: Content was truncated.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗