monitoringTechArticle

MCP Observability Practices

Apply observability best practices to MCP servers with traces, logs, redaction, metrics, and incidents.

Quick Answer / TL;DR

MCP observability should trace every tool call across auth, validation, protocol dispatch, downstream systems, redaction, and response delivery.

Key Takeaways

  • Trace full tool lifecycle.
  • Redact logs.
  • Use incident-friendly request IDs.
  • Alert on error-rate and latency thresholds, not raw request counts.

Lifecycle tracing

A tool call has several phases: authentication, schema validation, approval policy, execution, redaction, and response. Instrument each phase so incidents are diagnosable.

json
{
  "requestId": "req_123",
  "tool": "settlements.read",
  "phase": "redaction",
  "durationMs": 4,
  "redactedFields": 2
}

Instrumenting requests with Prometheus

Wrap the tool-call handler with a counter and a duration histogram, labeled by tool name and status, then expose them on a metrics endpoint for Prometheus to scrape.

typescript
import { Counter, Histogram, Registry } from "prom-client";

const register = new Registry();
const requestDuration = new Histogram({
  name: "mcp_request_duration_seconds",
  help: "Duration of MCP tool calls in seconds",
  labelNames: ["tool"],
  buckets: [0.01, 0.05, 0.1, 0.5, 1, 2, 5],
  registers: [register],
});
const requestCounter = new Counter({
  name: "mcp_requests_total",
  help: "Total MCP tool calls",
  labelNames: ["tool", "status"],
  registers: [register],
});

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const end = requestDuration.startTimer({ tool: request.params.name });
  try {
    const result = await executeTool(request);
    requestCounter.inc({ tool: request.params.name, status: "success" });
    return result;
  } catch (error) {
    requestCounter.inc({ tool: request.params.name, status: "error" });
    throw error;
  } finally {
    end();
  }
});

Alerting thresholds

Page immediately on sustained error-rate or latency spikes; only notify the team for softer warning-level thresholds so paging stays meaningful.

SeverityConditionWindow
Critical (page)Error rate above 5%5 minutes
Critical (page)P99 latency above 10s5 minutes
Warning (notify)Error rate above 1%15 minutes
Warning (notify)P95 latency above 2s10 minutes

MCP Observability Practices FAQs

Direct answers for developers, operators, and Indian teams evaluating MCP.

M
MCPserver Team

MCP documentation and protocol implementation team

Published: 2026-07-16
Updated: 2026-07-21

References & Technical Specifications