LearnNewsExamplesServices
Frontmatter
id10183
titleMCP Server Integration Testing Harness for CallToolRequestSchema
stateClosed
labels
enhancementaitestingneeds-re-triage
assignees[]
createdAtApr 22, 2026, 6:06 PM
updatedAtJun 6, 2026, 9:34 AM
githubUrlhttps://github.com/neomjs/neo/issues/10183
authorneo-gemini-pro
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[x] 10190 Implement chosen shared caching substrate for Memory Core
closedAtJun 6, 2026, 9:34 AM

MCP Server Integration Testing Harness for CallToolRequestSchema

Closed v13.0.0/archive-v13-0-0-chunk-5 enhancementaitestingneeds-re-triage
neo-gemini-pro
neo-gemini-pro commented on Apr 22, 2026, 6:06 PM

Context During the resolution of the identity binding race condition in #10181 (merged via PR #10182), we successfully implemented a self-heal hook inside ai/mcp/server/memory-core/Server.mjs directly on the CallToolRequestSchema dispatch path. However, we could not add a unit test for this specific logic because simulating the "node added to SQLite after first binding attempt" scenario requires the full MCP Server harness (MCP protocol transport + dispatch path), which no current test exercises.

The Problem Our current test coverage (e.g., MailboxService.spec.mjs) primarily tests the underlying service logic in isolation, mocking or bypassing the actual MCP transport layer. We currently lack a dedicated test scaffolding that exercises the CallToolRequestSchema dispatch path end-to-end within the unit testing harness. This prevents us from testing transport-layer middleware, dispatch hooks, and context-scoping mechanics reliably.

The Architectural Reality The ai/mcp/server/*/Server.mjs classes handle the raw MCP protocol. We need a Playwright testing fixture/utility that can stand up an instance of the MCP Server in-memory, mock the Stdio/WebSocket transport streams, and allow test files to dispatch CallToolRequestSchema requests exactly as the IDE/Claude Desktop would.

The Fix

  • Create a reusable MCP test harness utility (likely in test/playwright/unit/ai/mcp/utils/ or similar).
  • The harness should instantiate a target Server class, attach a mock transport, and provide an API for sending JSON-RPC messages and asserting on the responses.
  • Implement the first consuming test: migrate or add the scenario from #10181 to verify the CallToolRequestSchema self-heal logic end-to-end.

Acceptance Criteria

  • An McpTestHarness utility is created that can instantiate and interact with an MCP server via mocked transport.
  • The utility is capable of emitting raw JSON-RPC CallToolRequestSchema payloads and capturing the results/errors.
  • A new test file (e.g., Server.spec.mjs or similar) is created for memory-core that successfully uses the harness.
  • The specific "late node seeding" self-heal scenario from #10181 is explicitly tested and passes.

Out of Scope

  • We are not replacing existing service-level unit tests.
  • We are not building a full E2E system testing against live Claude Desktop instances. This is purely for the Playwright unit testing layer.

Related

  • Resolves the missing test AC from #10181
  • PR #10182 (shipped the fix that needs this test)

Origin Session ID: 984150f3-3aab-4a25-b623-d6e7472b4dd3