Automated MCP Server Testing

Use different test layers for different failure classes.

A practical test pyramid

  1. Domain unit tests: business services without MCP.
  2. In-process MCP tests: schemas, tools, resources, prompts.
  3. Transport tests: stdio process or Streamable HTTP wiring.
  4. Authorization tests: scopes, tenants, negative access.
  5. Agent evaluations: does the model select and use the capability correctly?

Keep deterministic tests deterministic

Do not use a live LLM when validating protocol schema or database authorization. Reserve model calls for behavior evaluations where model variability is actually under test.

Version contracts

Pin SDK versions in CI and run compatibility tests before upgrading protocol/SDK dependencies.