Skip to main content
Records the MCP client and server. Also verified: mcp 1.24.0 with instrumentor 2.0.10. The extra no longer installs that older instrumentor. See supported frameworks for how verification works.

In code

Call tracing.init(), attach the framework instrumentor to the provider it returns, and wrap the work in tracing.turn() and tracing.agent().
In this sample an LLM, through the OpenAI SDK, calls a tool on an MCP server running in the same process. The [mcp] extra traces the MCP client and server, and [openai] traces the LLM calls.
1

Install

terminal
2

Add the code

app.py
3

Run

terminal
Needs BOTGAUGE_API_KEY, OPENAI_API_KEY, OPENAI_MODEL. Set OPENAI_BASE_URL too if your LLM isn’t api.openai.com.

Zero-code

Leave your app unchanged and start it with botgauge instrument. The sample still wraps the work in tracing.turn() and tracing.agent() so spans carry session and agent ids.
In this sample an LLM, through the OpenAI SDK, calls a tool on an MCP server running in the same process. The [mcp] extra traces the MCP client and server, and [openai] traces the LLM calls.
1

Install

terminal
2

Add the code

app.py
3

Run

terminal
Needs BOTGAUGE_API_KEY, OPENAI_API_KEY, OPENAI_MODEL. Set OPENAI_BASE_URL too if your LLM isn’t api.openai.com.

View MCP spans live

Watch your MCP client, server, and LLM tool calls appear in BotGauge.

Try BotGauge →
See versions not verified if you run a different version, capture and redaction to control exported content, and troubleshooting if spans are missing.