Back to feed
Dev.to
Dev.to
7/21/2026
MCP Deep Dive, Part 10: When the Agent Feels Off — Debugging and Observability for MCP in Production

MCP Deep Dive, Part 10: When the Agent Feels Off — Debugging and Observability for MCP in Production

Short summary

Part 10 of an MCP deep dive covers production observability for AI agents. The core insight is that agents fail softly — extra turns, wrong tools, subtle errors — without throwing exceptions. The solution is treating the agent run (not the request) as the unit of observability, using OpenTelemetry spans nested across host, model, and MCP servers, correlated by trace ID, with structured logs and per-tool per-tenant metrics.

  • Agent failures are soft — wrong tools, extra turns, subtle errors — and don't show up in standard request logs
  • Use one root span per agent run propagated across MCP transport so all server spans nest under it
  • Track per-tool per-tenant latency, error rate, turns per run, and tokens per run instead of requests per second

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more