Chunk 1: MCP Host Plumbing (fix test suite)

↗ view on GitHub · Gadoes · 2026-05-02 · 735c9261

- Fixed StdioClientTransport mock to use class constructor (arrow fn can't be used with `new`)
- Fixed callTool() to catch spawn errors and return structured source_unavailable error
- Fixed afterEach to use resetAllMocks() instead of clearAllMocks() to prevent mockImplementationOnce queue leakage between tests
- Fixed dispose() test to clear mockClose call count before the assertion

All 10 Chunk 1 tests pass.

Acceptance criteria:
[x] listTools() returns at least one tool from a running MCP server
[x] No spawn occurs on second warm call within idle TTL
[x] Child process exit triggers reconnect within 1s (fake timers)
[x] 3 consecutive spawn failures → permanently_failed state
[x] dispose() kills all spawned processes (spy verification)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository Gadoes/dispumike
Author Gadoes <62180984+Gadoes@users.noreply.github.com>
Authored
Parents d9690965
Stats 2 files changed , +581
Part of MCP Host Plumbing & Agent Loop Integration

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-735c9261.md from inside the repo you want the change in.

⬇ Download capture-commit-735c9261.md