Protocol Conformance Test
Test the wire protocol directly, so a client bug and a server bug are distinguishable
Use when: a client reports a failure and the server's own behaviour is unproven
Avoid when: the server is a thin library wrapper with no wire protocol of its own
Procedure
- Write the exact JSON-RPC lines the client should send
- Pipe them into the server process with a bounded timeout
- Assert the response shape, not only the presence of a reply
- Check the jsonrpc field, id echo and error codes
- Repeat for a malformed line and for an unknown method
- Keep the transcript as a fixture so the test is reproducible
Signals
- every response echoes the request id
- malformed input produces a parse error, not a crash
- an unknown method produces method-not-found
- the server keeps serving after an error line
Patterns
1. Piped transcript
printf '%s\n' '{"jsonrpc":"2.0",...}' | python -m skillmcp serve
2. Shape assertion
jsonrpc == '2.0' and id == sent id
3. Survival check
send a bad line, then a good one, expect two replies
Pitfalls
- Testing through the client library, which hides the raw response
- Asserting only that some output appeared
- Forgetting that a server which crashes on a bad line fails every later call
Done when
- happy path, malformed line and unknown method each have a fixture
- the server is shown to survive an error line