Expand description
Deterministic offline validation of recorded MCP protocol traces.
The validator replays a trace (JSON Lines of
mcp_conformance_core::trace::TraceEvent) against a requirement registry and
produces a report::Report with one outcome per requirement and a precise
report::Finding for every violation: requirement ID, offending event seq, and
an actionable detail string.
Three properties are load-bearing and tested, not aspirational:
- Determinism — same trace bytes, same registry: byte-identical report. The engine touches no clock, no randomness, no environment.
- No I/O in the engine —
engine::validateis a pure function over parsed events; reading files and rendering output happen at the CLI edge. - Honest accounting — requirements the registry excludes are reported as excluded (never as passed), and registry entries referencing checks this build does not implement are reported as unsupported (never silently skipped).
§Example
use mcp_conformance_core::requirement::Registry;
use mcp_trace_validator::{engine, reader};
let trace = r#"{"seq":0,"direction":"client-to-server","transport":"stdio","kind":"message","payload":{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"x","version":"0"}}}}
{"seq":1,"direction":"server-to-client","transport":"stdio","kind":"message","payload":{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{},"serverInfo":{"name":"y","version":"0"}}}}
{"seq":2,"direction":"client-to-server","transport":"stdio","kind":"message","payload":{"jsonrpc":"2.0","method":"notifications/initialized"}}
"#;
let registry = Registry::builtin_2025_11_25().expect("embedded registry is valid");
let events = reader::parse_trace(trace, &reader::Limits::default()).expect("valid trace");
let report = engine::validate(®istry, &events);
assert!(!report.has_errors(), "{report:#?}");Modules§
- checks
- Checks: what one is, and what every one of them promises.
- context
- Precomputed per-trace context shared by all checks.
- declared
- What protocol revision a session says it is, read from the session itself.
- engine
- The validation engine: registry × trace → report.
- junit
JUnitXML rendering of validation reports, for CI systems that ingest test result files.- multi
- Multi-revision judgment: one trace against several protocol revisions in a single pass, with per-clause applicability differences made visible.
- reader
- Trace parsing with hard resource limits.
- report
- Validation reports: per-requirement outcomes with actionable findings.