observe-instrument-mcp
Supports automatic instrumentation of agents built with the CrewAI framework, adding OpenTelemetry tracing.
Allows the MCP server to use Google Gemini models for generating instrumentation code.
Supports automatic instrumentation of agents built with the LangGraph framework, adding OpenTelemetry tracing.
Allows the MCP server to use local LLMs via Ollama for generating instrumentation code with no API key required.
Allows the MCP server to use OpenAI's models for generating instrumentation code, and supports instrumenting agents built with the OpenAI SDK.
The instrumented agents emit OpenTelemetry-compatible traces, metrics, and logs for observability.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@observe-instrument-mcpAdd observe SDK instrumentation to my_agent.py"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
observe-instrument-mcp
An MCP server that automatically instruments Python AI agents with the ioa-observe-sdk — adding OpenTelemetry-based tracing, metrics, and logs with zero manual effort.
Works with any MCP-compatible AI coding assistant: Claude Desktop, Cursor, Windsurf, and others.
What it does
Two tools:
instrument_agent — reads a Python agent file, applies full observe SDK instrumentation, writes it back, and returns a summary of changes. Creates a .bak backup before modifying.
check_instrumentation — audits a file for missing instrumentation without modifying it.
Supported frameworks: LlamaIndex, LangGraph, CrewAI, raw OpenAI SDK.
Installation
pip install observe-instrument-mcp
# or
uv add observe-instrument-mcpRequires an API key for your chosen LLM provider. Defaults to Claude (ANTHROPIC_API_KEY). See supported providers below.
Configuration
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"observe-instrument": {
"command": "uvx",
"args": ["observe-instrument-mcp"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
}Cursor
Add to .cursor/mcp.json in your project:
{
"mcpServers": {
"observe-instrument": {
"command": "uvx",
"args": ["observe-instrument-mcp"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
}Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"observe-instrument": {
"command": "uvx",
"args": ["observe-instrument-mcp"],
"env": {
"ANTHROPIC_API_KEY": "sk-ant-..."
}
}
}
}Examples
Ready-to-use uninstrumented agent files are included in the examples/ folder:
examples/
single-agent/
openai-sdk-example.py # OpenAI SDK customer support agent
langgraph-example.py # LangGraph currency converter
llama-index-example.py # LlamaIndex math agent
crewai-example.py # CrewAI research crew
multi-agent/
openai-sdk-multi-agent-example.py # OpenAI SDK orchestrator pipeline
langgraph-multi-agent-example.py # LangGraph supervisor pattern
llama-index-multi-agent-example.py # LlamaIndex research + writing pipeline
crewai-multi-agent-example.py # CrewAI research + publishing crewsUsage
Once configured, ask your AI assistant:
Instrument my agent with the observe SDK: path/to/my_agent.pyCheck what observe SDK instrumentation is missing from path/to/my_agent.pyEnvironment variables
Variable | Description |
| Model to use (default: |
| Required for Anthropic models |
| Required for OpenAI models |
| Required for Google Gemini models |
| Required for Groq models |
Supported providers
Provider | Key variable |
|
Anthropic |
|
|
OpenAI |
|
|
Google Gemini |
|
|
Groq |
|
|
Ollama (local, free) | none |
|
After instrumentation
Install the SDK in your project:
pip install ioa-observe-sdk
# or
uv add ioa-observe-sdkStart the observability stack (OTel Collector + ClickHouse):
cd path/to/observe/deploy
docker compose up -dRun your agent:
OPENAI_API_KEY=sk-... OTLP_HTTP_ENDPOINT=http://localhost:4318 python my_agent.pyQuery traces:
docker exec -it clickhouse-server clickhouse-client --user admin --password adminSELECT SpanName, ServiceName, Duration / 1000000. AS ms, Timestamp
FROM otel_traces
ORDER BY Timestamp DESC
LIMIT 20;Development
git clone https://github.com/alanzha2/observe-instrument-mcp
cd observe-instrument-mcp
pip install -e .
# Test the server locally
mcp dev observe_instrument_mcp/server.pyLicense
Apache-2.0
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/alanzha2/observe-instrument-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server