MCP server that instruments Python AI agents with the ioa-observe-sdk
Project description
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-mcp
Requires 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-..."
}
}
}
}
Usage
Once configured, ask your AI assistant:
Instrument my agent with the observe SDK: path/to/my_agent.py
Check what observe SDK instrumentation is missing from path/to/my_agent.py
Environment variables
| Variable | Description |
|---|---|
LLM_MODEL |
Model to use (default: claude-sonnet-4-6). See provider table below. |
ANTHROPIC_API_KEY |
Required for Anthropic models |
OPENAI_API_KEY |
Required for OpenAI models |
GEMINI_API_KEY |
Required for Google Gemini models |
GROQ_API_KEY |
Required for Groq models |
Supported providers
| Provider | Key variable | LLM_MODEL example |
|---|---|---|
| Anthropic | ANTHROPIC_API_KEY |
claude-sonnet-4-6 |
| OpenAI | OPENAI_API_KEY |
gpt-4o |
| Google Gemini | GEMINI_API_KEY |
gemini/gemini-2.0-flash |
| Groq | GROQ_API_KEY |
groq/llama-3.3-70b |
| Ollama (local, free) | none | ollama/llama3.2 |
After instrumentation
Install the SDK in your project:
pip install ioa-observe-sdk
# or
uv add ioa-observe-sdk
Start the observability stack (OTel Collector + ClickHouse):
cd path/to/observe/deploy
docker compose up -d
Run your agent:
OPENAI_API_KEY=sk-... OTLP_HTTP_ENDPOINT=http://localhost:4318 python my_agent.py
Query traces:
docker exec -it clickhouse-server clickhouse-client --user admin --password admin
SELECT 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.py
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file observe_instrument_mcp-0.1.2.tar.gz.
File metadata
- Download URL: observe_instrument_mcp-0.1.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7214e66d03dfd9aeaad34ca02e47b15091acbb4153700e97879dc164deffd81c
|
|
| MD5 |
ef7176147b593706b60fc9d7a4125468
|
|
| BLAKE2b-256 |
0e121eecb0f1b6abd8d67e8bc6b744f39798ed38eb3e8c6457e9e9aa325d78a4
|
Provenance
The following attestation bundles were made for observe_instrument_mcp-0.1.2.tar.gz:
Publisher:
publish.yml on alanzha2/observe-instrument-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
observe_instrument_mcp-0.1.2.tar.gz -
Subject digest:
7214e66d03dfd9aeaad34ca02e47b15091acbb4153700e97879dc164deffd81c - Sigstore transparency entry: 1098570549
- Sigstore integration time:
-
Permalink:
alanzha2/observe-instrument-mcp@dc798af9c4fb391b626ad00a3e026af4db63fe9c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/alanzha2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc798af9c4fb391b626ad00a3e026af4db63fe9c -
Trigger Event:
push
-
Statement type:
File details
Details for the file observe_instrument_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: observe_instrument_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bf926455182c0016295bdc91c9693b3819446ae4ae539e01183a5a91a91280c
|
|
| MD5 |
0888cacca0ee1e1b49cc037577150dfc
|
|
| BLAKE2b-256 |
00a694845edd82b696d979769b46fdbe83572dea8c50d5467aa3a6361027b27f
|
Provenance
The following attestation bundles were made for observe_instrument_mcp-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on alanzha2/observe-instrument-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
observe_instrument_mcp-0.1.2-py3-none-any.whl -
Subject digest:
7bf926455182c0016295bdc91c9693b3819446ae4ae539e01183a5a91a91280c - Sigstore transparency entry: 1098570602
- Sigstore integration time:
-
Permalink:
alanzha2/observe-instrument-mcp@dc798af9c4fb391b626ad00a3e026af4db63fe9c -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/alanzha2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dc798af9c4fb391b626ad00a3e026af4db63fe9c -
Trigger Event:
push
-
Statement type: