Chunk 2: Mock MCP Server for Tests

↗ view on GitHub · Gadoes · 2026-05-02 · da93e2e5

- Created backend/src/__mocks__/mockMcpServer.ts - in-process MCP server
  using @modelcontextprotocol/sdk's InMemoryTransport + Server
- Pre-defined tool set: search_cases, retrieve_case
- respondWith(toolName, response) for scripted responses
- createMockMcpServer() returns started server + connected McpClientManager
- 5 unit tests: scripted responses, listTools, respondWith overrides,
  default responses, unknown tool error

Acceptance criteria:
[x] createMockMcpServer() usable in any Vitest test file without spawning child processes
[x] Returns deterministic responses per respondWith() config

Tests: 15 pass (10 Chunk 1 + 5 Chunk 2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Repository Gadoes/dispumike
Author Gadoes <62180984+Gadoes@users.noreply.github.com>
Authored
Parents 8af29ffc
Stats 2 files changed , +278
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-da93e2e5.md from inside the repo you want the change in.

⬇ Download capture-commit-da93e2e5.md