We traced an MCP server calling an LLM — both sides, one trace
Last article we opened the MCP black box. One line of middleware, and every tool call gets a span, metrics, and privacy controls. Problem solved. Except it wasn't. We had traces. We had metrics. Bu...

Source: DEV Community
Last article we opened the MCP black box. One line of middleware, and every tool call gets a span, metrics, and privacy controls. Problem solved. Except it wasn't. We had traces. We had metrics. But we couldn't see them — no dashboard, no demo, and the most interesting MCP feature was completely invisible. MCP servers don't just receive tool calls. They can also call LLMs themselves — through a feature called sampling. Your server asks the client's LLM to generate a response. The request goes out. The response comes back. And the trace? Silent. This article is about the four follow-ups that turned "we have observability" into "here's what it actually looks like — try it yourself in 5 minutes." The missing piece: sampling Most MCP tutorials show tools as pure functions. Input goes in, output comes out. But the MCP spec has a feature called sampling/createMessage — the server can ask the client to run an LLM call on its behalf. Why? Because MCP servers don't have API keys. They don't tal