Vitest-native testing for MCP servers
Matchers, snapshots, interaction doubles, and real external servers, on both MCP SDK majors.
server.test.ts
SDK v12025-11-25
- connects and lists tools12ms
- echo round-trips4ms
- answers an elicitation7ms
- collects progress notifications9ms
1 file 4 passed (4)
SDK v22026-07-28
- connects and lists tools12ms
- echo round-trips4ms
- answers an elicitation7ms
- collects progress notifications9ms
1 file 4 passed (4)
The matrix
Every SDK major, every protocol revision
| Lane | 2025-11-25 | 2026-07-28 |
|---|---|---|
| v1 | the only revision it negotiates | throws - the v1 SDK cannot serve it |
| v2 | legacy mode, no doubles available | default, full support |
| stdio | the only revision it negotiates | throws - stdio is driven by v1 |
| url | legacy mode, no doubles available | pinned, otherwise auto-negotiated |
Coverage
What mcp-vitest covers
- Both SDK majors
- v1 and v2 servers, detected automatically. No adapter to write.
- Lifecycle coverage
- Run the same tests against the 2025 and 2026-07-28 protocol revisions.
- Interaction doubles
- Answer a server's sampling, elicitation, and roots requests from your test.
- Typed matchers
- Seven of them, with TypeScript augmentation and did-you-mean suggestions.
- External servers
- Spawn one over stdio or point at a running URL. Everything else works unchanged.
- Regression safety
- Snapshot manifests normalized so key order and absent optionals never churn them.