As MCP (Model Context Protocol) servers become a standard interface for AI agents to interact with external tools, observability is critical for debugging and performance monitoring. This article shows how to integrate OpenTelemetry with Elastic APM to trace tool calls within MCP servers. The approach leverages OpenTelemetry's instrumentation libraries to capture spans for each tool invocation, then sends them to Elastic APM for visualization and analysis. This setup enables developers to monitor latency, error rates, and dependencies of MCP tool calls in production. The combination is particularly valuable for teams building AI agent systems that rely on multiple MCP servers, as it provides end-to-end visibility into the tool execution pipeline. While the article is tutorial-like, the underlying pattern—instrumenting MCP servers with OpenTelemetry—is a timely signal for the observability and AI infrastructure community.
This article demonstrates how to use OpenTelemetry and Elastic APM to trace tool calls in MCP (Model Context Protocol) servers. It provides a practical guide for adding observability to AI agent tooling, which is increasingly important as MCP adoption grows.