In-memory test harness: invoke MCP tools without spinning stdio/HTTP #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-05-13T14:23:50Z - https://github.com/coilysiren/cli-mcp/issues/41
FastMCP provides an in-memory client that connects directly to a
FastMCPinstance without going through stdio or HTTP. This is the single biggest DX win for testing - no subprocess, no transport, justclient.call_tool("name", args)against a server object in the same process.cli-mcp today has unit tests at the projection-mechanics level but no canonical pattern for an integration test that says "build a server, call this tool by name, assert on the result." Today you'd have to spin a real
ServeStdioorStreamableHTTPHandler, both of which add framing overhead and make assertions verbose.Proposal: ship a
climcp/climcptest(or similar) helper exposing a direct invoker:Should hit the same code path as a real stdio invocation (input validation, tool dispatch, output capture) but without the framing layer. The in-process execution architecture (issue #36) makes this almost free - the Action already runs in the test goroutine.
Open questions:
IsError+StructuredContent(issue #34) once those land?ListTools/ capability negotiation?