Intermediate·Concept·2 min read

Testing, Inspector, Logging, and Evaluation

Practice this question

Test pyramid

  1. Unit: Service policy, validation, and mapping.
  2. Protocol integration: List/call behavior through an in-memory client-server connection.
  3. Transport integration: The real stdio or HTTP boundary.
  4. End-to-end: A compatible host with approval and a model loop.
  5. Security: Cross-tenant access, injection payloads, path traversal, and oversized input.

Inspector workflow

Shell
npx @modelcontextprotocol/inspector node dist/index.js

Use the Inspector to examine capabilities, tools, schemas, inputs, results, and logs. Also test actual target clients to verify production client compatibility.

Observability fields

  • Request/correlation ID, tool name, authenticated subject, duration, and result status.
  • Dependency timing and retry count.
  • Approval outcome for sensitive actions.
  • Never log tokens, secrets, complete personal records, or raw confidential prompts by default.

Agent evaluation

Do not measure only server uptime. Also evaluate correct tool selection, argument accuracy, rejection of unauthorized calls, loop rate, recovery success, latency, and user approval rate.

Adapted from 20_MCP_SERVER.md · “14. Testing, Inspector, Logging, and Evaluation”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.