Unit-test the tool classes directly as ordinary C# (they are plain methods with DI dependencies), including edge cases: invalid formats, out-of-range numbers, missing records, over-long strings, and inputs that look like instructions. For the protocol, host the server in WebApplicationFactory and connect an McpClient over the test server's HTTP handler, then snapshot ListToolsAsync (names, descriptions, schemas, annotations) so accidental schema changes fail CI, and call tools to assert on result content and error messages, not just shape. Add authorisation tests (no token → 401, wrong scope → 403, another user's data → refused). Load-test the HTTP endpoint (for example with k6 or NBomber) against a latency target, since hosts call tools inside a user's wait. Finally run an evaluation set of user tasks against a real model to check tool selection, because a description change can break the model's choices without breaking any code.
Checks automated testing of MCP tools and schema stability
Last updated 23 Nov 2026.