mcpField
O
observe-instrument-mcp

observe-instrument-mcp

Local
github.com/alanzha2Developer Tools0Updated 32w ago

About observe-instrument-mcp

observe-instrument-mcp is an MCP server for Python AI agent developers. It instruments supported agent files with OpenTelemetry tracing, metrics, and logs, or audits them without changes.

Key features

  1. 01Instrument agent files with observe SDK
  2. 02Create a backup before editing
  3. 03Audit instrumentation without editing
  4. 04Support LangGraph, LlamaIndex, CrewAI, and OpenAI SDK

Use cases

  1. 01Add observability to a Python agent
  2. 02Check an agent file for missing instrumentation

MCP support

It exposes `instrument_agent` and `check_instrumentation` tools to MCP clients for modifying or auditing Python agent files.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"alanzha2-observe-instrument": {
"command": "uvx",
"args": [
"observe-instrument-mcp"
],
"env": {
"ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>",
"LLM_MODEL": "<LLM_MODEL>",
"OPENAI_API_KEY": "<OPENAI_API_KEY>",
"GEMINI_API_KEY": "<GEMINI_API_KEY>",
"GROQ_API_KEY": "<GROQ_API_KEY>"
}
}
}
}
Run commanduvx observe-instrument-mcp
Environment variables to set
ANTHROPIC_API_KEYSecretAPI key for Anthropic Claude (default LLM provider)
LLM_MODELLLM model to use (default: claude-sonnet-4-6). Supports Anthropic, OpenAI, Gemini, Groq, Ollama via LiteLLM.
OPENAI_API_KEYSecretAPI key for OpenAI models
GEMINI_API_KEYSecretAPI key for Google Gemini models
GROQ_API_KEYSecretAPI key for Groq models

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypiobserve-instrument-mcp0.1.2

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

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-..."
      }
    }
  }
}

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 crews

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

VariableDescription
LLM_MODELModel to use (default: claude-sonnet-4-6). See provider table below.
ANTHROPIC_API_KEYRequired for Anthropic models
OPENAI_API_KEYRequired for OpenAI models
GEMINI_API_KEYRequired for Google Gemini models
GROQ_API_KEYRequired for Groq models
Supported providers
ProviderKey variableLLM_MODEL example
AnthropicANTHROPIC_API_KEYclaude-sonnet-4-6
OpenAIOPENAI_API_KEYgpt-4o
Google GeminiGEMINI_API_KEYgemini/gemini-2.0-flash
GroqGROQ_API_KEYgroq/llama-3.3-70b
Ollama (local, free)noneollama/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

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.