
The 3 test framework I use for MCP servers
MCP servers are easy to wire up. You export a tool, define a schema, connect a client, done. Then Claude generates the wrong arguments, the handler silently misroutes an edge case, and the judge returns 0.9 for an empty string response. The protocol layer rarely gets tested properly. Here's the 3 test framework I use. Each one catches a different class of failure. 1. Schema Contract — Did someone rename a field? What breaks: A developer changes groundTruth to ground_truth in the tool schema. Every MCP caller breaks silently. No type error at runtime, no warning, just wrong behaviour. How to test: Import the exported schema object directly and assert on its shape. No server boot, no network call, no mocks. Pure property assertions on the contract. expect ( schema . type ). toBe ( ' object ' ); expect ( schema . properties ). toHaveProperty ( ' llm_response ' ); expect ( schema . properties ). toHaveProperty ( ' groundTruth ' ); expect ( schema . properties . criteria . type ). toBe ( '
Continue reading on Dev.to Tutorial
Opens in a new tab

