OpenTelemetry MCP Server
Connects to a Grafana Tempo trace backend to search traces and spans, retrieve full trace details, list services, find errors, and analyze LLM token usage and model performance.
Connects to a Jaeger trace backend to search traces and spans, retrieve full trace details, list services, find errors, and analyze LLM token usage and model performance.
Provides tools for querying and analyzing OpenTelemetry traces and spans, including LLM token usage, model statistics, error discovery, and expensive-trace analysis.
Click on "Deploy 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., "@OpenTelemetry MCP Server show me traces with errors from the last hour"
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.
OpenTelemetry MCP Server
Query and analyze LLM traces with AI assistance. Ask Claude to find expensive API calls, debug errors, compare model performance, or track token usage—all from your IDE.
An MCP (Model Context Protocol) server that connects AI assistants to OpenTelemetry trace backends (Jaeger, Tempo, Traceloop), with specialized support for LLM observability through OpenLLMetry semantic conventions.
See it in action:
https://github.com/user-attachments/assets/e2106ef9-0a58-4ba0-8b2b-e114c0b8b4b9
Table of Contents
Related MCP server: otel-mcp-server
Quick Start
No installation required! Configure your client to run the server directly from PyPI:
// Add to claude_desktop_config.json:
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Or use uvx (alternative):
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "uvx",
"args": ["opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}That's it! Ask Claude: "Show me traces with errors from the last hour"
Installation
For End Users (Recommended)
# Run without installing (recommended)
pipx run opentelemetry-mcp --backend jaeger --url http://localhost:16686
# Or with uvx
uvx opentelemetry-mcp --backend jaeger --url http://localhost:16686This approach:
✅ Always uses the latest version
✅ No global installation needed
✅ Isolated environment automatically
✅ Works on all platforms
Per Client Integration
Configure the MCP server in your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Using pipx (recommended):
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Using uvx (alternative):
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "uvx",
"args": ["opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}For Traceloop backend:
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "traceloop",
"BACKEND_URL": "https://api.traceloop.com",
"BACKEND_API_KEY": "your_traceloop_api_key_here"
}
}
}
}If you're developing locally with the cloned repository, use one of these configurations:
Option 1: Wrapper script (easy backend switching)
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "/absolute/path/to/opentelemetry-mcp-server/start_locally.sh"
}
}
}Option 2: UV directly (for multiple backends)
{
"mcpServers": {
"opentelemetry-mcp-jaeger": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/opentelemetry-mcp-server",
"run",
"opentelemetry-mcp"
],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Claude Code works with MCP servers configured in your Claude Desktop config. Once configured above, you can use the server with Claude Code CLI:
# Verify the server is available
claude-code mcp list
# Use Claude Code with access to your OpenTelemetry traces
claude-code "Show me traces with errors from the last hour"Open Windsurf
Navigate to Settings → MCP Servers
Click Add New MCP Server
Add this configuration:
Using pipx (recommended):
{
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}Using uvx (alternative):
{
"opentelemetry-mcp": {
"command": "uvx",
"args": ["opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}{
"opentelemetry-mcp": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/opentelemetry-mcp-server",
"run",
"opentelemetry-mcp"
],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}Open Cursor
Navigate to Settings → MCP
Click Add new MCP Server
Add this configuration:
Using pipx (recommended):
{
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}Using uvx (alternative):
{
"opentelemetry-mcp": {
"command": "uvx",
"args": ["opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}{
"opentelemetry-mcp": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/opentelemetry-mcp-server",
"run",
"opentelemetry-mcp"
],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}Configure the MCP server in your Gemini CLI config file (~/.gemini/config.json):
Using pipx (recommended):
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "pipx",
"args": ["run", "opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Using uvx (alternative):
{
"mcpServers": {
"opentelemetry-mcp": {
"command": "uvx",
"args": ["opentelemetry-mcp"],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Then use Gemini CLI with your traces:
gemini "Analyze token usage for gpt-4 requests today"{
"mcpServers": {
"opentelemetry-mcp": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/opentelemetry-mcp-server",
"run",
"opentelemetry-mcp"
],
"env": {
"BACKEND_TYPE": "jaeger",
"BACKEND_URL": "http://localhost:16686"
}
}
}
}Prerequisites:
If you prefer to install the command globally:
# Install with pipx
pipx install opentelemetry-mcp
# Verify
opentelemetry-mcp --help
# Upgrade
pipx upgrade opentelemetry-mcpOr with pip:
pip install opentelemetry-mcpFeatures
Core Capabilities
🔌 Multiple Backend Support - Connect to Jaeger, Grafana Tempo, or Traceloop
🤖 LLM-First Design - Specialized tools for analyzing AI application traces
🔍 Advanced Filtering - Generic filter system with powerful operators
📊 Token Analytics - Track and aggregate LLM token usage across models and services
⚡ Fast & Type-Safe - Built with async Python and Pydantic validation
Tools
Tool | Description | Use Case |
| Search traces with advanced filters | Find specific requests or patterns |
| Search individual spans | Analyze specific operations |
| Get complete trace details | Deep-dive into a single trace |
| Aggregate token usage metrics | Track costs and usage trends |
| List available services | Discover what's instrumented |
| Find traces with errors | Debug failures quickly |
| Discover models in use | Track model adoption |
| Get model performance stats | Compare model efficiency |
| Find highest token usage | Optimize costs |
| Find slowest operations | Improve performance |
Backend Support Matrix
Feature | Jaeger | Tempo | Traceloop |
Search traces | ✓ | ✓ | ✓ |
Advanced filters | ✓ | ✓ | ✓ |
Span search | ✓* | ✓ | ✓ |
Token tracking | ✓ | ✓ | ✓ |
Error traces | ✓ | ✓ | ✓ |
LLM tools | ✓ | ✓ | ✓ |
* Jaeger requires service_name parameter for span search
For Developers
If you're contributing to the project or want to make local modifications:
# Clone the repository
git clone https://github.com/traceloop/opentelemetry-mcp-server.git
cd opentelemetry-mcp-server
# Install dependencies with UV
uv sync
# Or install in development mode with editable install
uv pip install -e ".[dev]"Configuration
Supported Backends
Backend | Type | URL Example | Notes |
Jaeger | Local |
| Popular open-source option |
Tempo | Local/Cloud |
| Grafana's trace backend |
Traceloop | Cloud |
| Requires API key |
Quick Configuration
Option 1: Environment Variables (Create .env file - see .env.example)
BACKEND_TYPE=jaeger
BACKEND_URL=http://localhost:16686Option 2: CLI Arguments (Override environment)
opentelemetry-mcp --backend jaeger --url http://localhost:16686
opentelemetry-mcp --backend traceloop --url https://api.traceloop.com --api-key YOUR_KEYConfiguration Precedence: CLI arguments > Environment variables > Defaults
Variable | Type | Default | Description |
| string |
| Backend type: |
| URL | - | Backend API endpoint (required) |
| string | - | API key (required for Traceloop) |
| integer |
| Request timeout in seconds |
| string |
| Logging level: |
| integer |
| Maximum traces to return per query (1-1000) |
Complete .env example:
# Backend configuration
BACKEND_TYPE=jaeger
BACKEND_URL=http://localhost:16686
# Optional: API key (mainly for Traceloop)
BACKEND_API_KEY=
# Optional: Request timeout (default: 30s)
BACKEND_TIMEOUT=30
# Optional: Logging level
LOG_LEVEL=INFO
# Optional: Max traces per query (default: 100)
MAX_TRACES_PER_QUERY=100Jaeger
BACKEND_TYPE=jaeger
BACKEND_URL=http://localhost:16686Grafana Tempo
BACKEND_TYPE=tempo
BACKEND_URL=http://localhost:3200Traceloop
BACKEND_TYPE=traceloop
BACKEND_URL=https://api.traceloop.com
BACKEND_API_KEY=your_api_key_hereNote: The API key contains project information. The backend uses a project slug of
"default"and Traceloop resolves the actual project/environment from the API key.
Usage
Quick Start with start_locally.sh (Recommended)
The easiest way to run the server:
./start_locally.shThis script handles all configuration and starts the server in stdio mode (perfect for Claude Desktop integration). To switch backends, simply edit the script and uncomment your preferred backend.
Manual Running
For advanced use cases or custom configurations, you can run the server manually.
stdio Transport (for Claude Desktop)
Start the MCP server with stdio transport for local/Claude Desktop integration:
# If installed with pipx/pip
opentelemetry-mcp
# If running from cloned repository with UV
uv run opentelemetry-mcp
# With backend override (pipx/pip)
opentelemetry-mcp --backend jaeger --url http://localhost:16686
# With backend override (UV)
uv run opentelemetry-mcp --backend jaeger --url http://localhost:16686HTTP Transport (for Network Access)
Start the MCP server with HTTP/SSE transport for remote access:
# If installed with pipx/pip
opentelemetry-mcp --transport http
# If running from cloned repository with UV
uv run opentelemetry-mcp --transport http
# Specify custom host and port (pipx/pip)
opentelemetry-mcp --transport http --host 127.0.0.1 --port 9000
# With UV
uv run opentelemetry-mcp --transport http --host 127.0.0.1 --port 9000The HTTP server will be accessible at http://localhost:8000/sse by default.
Transport Use Cases:
stdio transport: Local use, Claude Desktop integration, single process
HTTP transport: Remote access, multiple clients, network deployment, sample applications
Tools Reference
1. search_traces
Search for traces with flexible filtering:
{
"service_name": "my-app",
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-01-01T23:59:59Z",
"gen_ai_system": "openai",
"gen_ai_model": "gpt-4",
"min_duration_ms": 1000,
"has_error": false,
"limit": 50
}Parameters:
service_name- Filter by serviceoperation_name- Filter by operationstart_time/end_time- ISO 8601 timestampsmin_duration_ms/max_duration_ms- Duration filtersgen_ai_system- LLM provider (openai, anthropic, etc.)gen_ai_model- Model name (gpt-4, claude-3-opus, etc.)has_error- Filter by error statustags- Custom tag filterslimit- Max results (1-1000, default: 100)
Returns: List of trace summaries with token counts
2. get_trace
Get complete trace details including all spans and OpenLLMetry attributes:
{
"trace_id": "abc123def456"
}Returns: Full trace tree with:
All spans with attributes
Parsed OpenLLMetry data for LLM spans
Token usage per span
Error information
3. get_llm_usage
Get aggregated token usage metrics:
{
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-01-01T23:59:59Z",
"service_name": "my-app",
"gen_ai_system": "openai",
"limit": 1000
}Returns: Aggregated metrics with:
Total prompt/completion/total tokens
Breakdown by model
Breakdown by service
Request counts
4. list_services
List all available services:
{}Returns: List of service names
5. find_errors
Find traces with errors:
{
"start_time": "2024-01-01T00:00:00Z",
"service_name": "my-app",
"limit": 50
}Returns: Error traces with:
Error messages and types
Stack traces (truncated)
LLM-specific error info
Error span details
Example Queries
Find Expensive OpenAI Operations
Natural Language: "Show me OpenAI traces from the last hour that took longer than 5 seconds"
Tool Call: search_traces
{
"service_name": "my-app",
"gen_ai_system": "openai",
"min_duration_ms": 5000,
"start_time": "2024-01-15T10:00:00Z",
"limit": 20
}Response:
{
"traces": [
{
"trace_id": "abc123...",
"service_name": "my-app",
"duration_ms": 8250,
"total_tokens": 4523,
"gen_ai_system": "openai",
"gen_ai_model": "gpt-4"
}
],
"count": 1
}Analyze Token Usage by Model
Natural Language: "How many tokens did we use for each model today?"
Tool Call: get_llm_usage
{
"start_time": "2024-01-15T00:00:00Z",
"end_time": "2024-01-15T23:59:59Z",
"service_name": "my-app"
}Response:
{
"summary": {
"total_tokens": 125430,
"prompt_tokens": 82140,
"completion_tokens": 43290,
"request_count": 487
},
"by_model": {
"gpt-4": {
"total_tokens": 85200,
"request_count": 156
},
"gpt-3.5-turbo": {
"total_tokens": 40230,
"request_count": 331
}
}
}Find Traces with Errors
Natural Language: "Show me all errors from the last hour"
Tool Call: find_errors
{
"start_time": "2024-01-15T14:00:00Z",
"service_name": "my-app",
"limit": 10
}Response:
{
"errors": [
{
"trace_id": "def456...",
"service_name": "my-app",
"error_message": "RateLimitError: Too many requests",
"error_type": "openai.error.RateLimitError",
"timestamp": "2024-01-15T14:23:15Z"
}
],
"count": 1
}Compare Model Performance
Natural Language: "What's the performance difference between GPT-4 and Claude?"
Tool Call 1: get_llm_model_stats for gpt-4
{
"model_name": "gpt-4",
"start_time": "2024-01-15T00:00:00Z"
}Tool Call 2: get_llm_model_stats for claude-3-opus
{
"model_name": "claude-3-opus-20240229",
"start_time": "2024-01-15T00:00:00Z"
}Investigate High Token Usage
Natural Language: "Which requests used the most tokens today?"
Tool Call: get_llm_expensive_traces
{
"limit": 10,
"start_time": "2024-01-15T00:00:00Z",
"min_tokens": 5000
}Common Workflows
Cost Optimization
Identify expensive operations:
Use get_llm_expensive_traces to find high-token requestsAnalyze by model:
Use get_llm_usage to see which models are costing the mostInvestigate specific traces:
Use get_trace with the trace_id to see exact prompts/responses
Performance Debugging
Find slow operations:
Use get_llm_slow_traces to identify latency issuesCheck for errors:
Use find_errors to see failure patternsAnalyze finish reasons:
Use get_llm_model_stats to see if responses are being truncated
Model Adoption Tracking
Discover models in use:
Use list_llm_models to see all models being calledCompare model statistics:
Use get_llm_model_stats for each model to compare performanceIdentify shadow AI:
Look for unexpected models or services in list_llm_models results
Development
Running Tests
# With UV
uv run pytest
# With coverage
uv run pytest --cov=openllmetry_mcp --cov-report=html
# With pip
pytestCode Quality
# Format code
uv run ruff format .
# Lint
uv run ruff check .
# Type checking
uv run mypy src/Troubleshooting
Backend Connection Issues
# Test backend connectivity
curl http://localhost:16686/api/services # Jaeger
curl http://localhost:3200/api/search/tags # TempoAuthentication Errors
Make sure your API key is set correctly:
export BACKEND_API_KEY=your_key_here
# Or use --api-key CLI flag
opentelemetry-mcp --api-key your_key_hereNo Traces Found
Check time range (use recent timestamps)
Verify service names with
list_servicesCheck backend has traces:
curl http://localhost:16686/api/servicesTry searching without filters first
Token Usage Shows Zero
Ensure your traces have OpenLLMetry instrumentation
Check that
gen_ai.usage.*attributes exist in spansVerify with
get_traceto see raw span attributes
Future Enhancements
Cost calculation with built-in pricing tables
Model performance comparison tools
Prompt pattern analysis
MCP resources for common queries
Caching layer for frequent queries
Support for additional backends (SigNoz, ClickHouse)
Contributing
Contributions are welcome! Please ensure:
All tests pass:
pytestCode is formatted:
ruff format .No linting errors:
ruff check .Type checking passes:
mypy src/
License
Apache 2.0 License - see LICENSE file for details
Related Projects
OpenLLMetry - OpenTelemetry instrumentation for LLMs
Model Context Protocol - MCP specification
Claude Desktop - AI assistant with MCP support
Support
For issues and questions:
GitHub Issues: https://github.com/traceloop/opentelemetry-mcp-server/issues
PyPI Package: https://pypi.org/project/opentelemetry-mcp/
Traceloop Community: https://traceloop.com/slack
Available Tools
11 toolsfind_errorsFind ErrorsB
Find traces with errors.
Including detailed error messages, stack traces, and LLM-specific error information.
Inputs: limit, end_time, start_time, service_name. Returns: result
get_llm_expensive_tracesGet Llm Expensive TracesB
Find traces with highest LLM token usage.
Useful for cost optimization and identifying inefficient prompts.
Inputs: limit, end_time, min_tokens, start_time, +3 more. Returns: result
get_llm_model_statsGet Llm Model StatsB
Get detailed performance statistics for a specific LLM model.
Analyzes request count, latency percentiles (p50, p95, p99), token usage statistics, error rates, and finish reason distributions.
Inputs: model_name (required), end_time, start_time, service_name. Returns: result
get_llm_slow_tracesGet Llm Slow TracesB
Find slowest LLM traces by duration.
Useful for performance optimization and identifying latency bottlenecks.
Inputs: limit, end_time, start_time, service_name, +3 more. Returns: result
get_llm_usageGet Llm UsageA
Get aggregated LLM usage metrics (token counts) for a time period.
Provides breakdowns by model and service.
Inputs: limit, end_time, start_time, service_name, +3 more. Returns: result
get_traceGet TraceA
Get complete trace details by trace ID.
Returns all spans with attributes, including parsed Opentelemetry data for LLM operations.
Inputs: trace_id (required). Returns: result
list_llm_modelsList Llm ModelsC
List all LLM models being used with usage statistics.
Discovers what models are deployed and tracks their usage patterns.
Inputs: limit, end_time, start_time, service_name, +1 more. Returns: result
list_llm_tools_toolList Llm Tools ToolB
List all LLM tools being used by identifying traceloop.span.kind == tool.
Discovers which tools/functions LLM applications are calling, grouped by tool name with usage statistics.
Inputs: limit, end_time, start_time, service_name, +1 more. Returns: result
list_servicesList ServicesB
List all available services in the OpenTelemetry backend.
Inputs: no named parameters. Returns: result
search_spans_toolSearch Spans ToolA
Search for individual OpenTelemetry spans with optional filters.
Unlike search_traces, this returns individual spans rather than grouped traces, which is useful for analyzing specific operations or finding spans with certain characteristics (e.g., LLM tool calls with traceloop.span.kind == tool).
Inputs: tags, limit, filters, end_time, +9 more. Returns: result
search_tracesSearch TracesB
Search for OpenTelemetry traces with filters.
Supports both simple parameters and advanced generic filter system.
Inputs: tags, limit, filters, end_time, +9 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Most tools have clearly distinct purposes: trace retrieval vs. filtered search vs. individual span search, and the LLM tools split cleanly into usage, per-model stats, expensive, slow, and tools listing. The boundary between search_traces and search_spans_tool is explained explicitly, and find_errors vs. the LLM performance tools differ by filter intent. A few pairs (get_llm_usage vs. get_llm_model_stats, get_llm_slow_traces vs. get_llm_expensive_traces) require reading the description to separate.
Nearly all names follow a verb_noun snake_case pattern (get_trace, search_traces, list_services, find_errors, get_llm_model_stats). The 'llm' infix is applied consistently within the LLM group. Minor deviation: search_spans_tool and list_llm_tools_tool carry a redundant '_tool' suffix that breaks the pattern.
Eleven tools is well within the ideal range for an observability/tracing server. Each tool maps to a distinct query workflow (trace lookup, search, service discovery, error hunting, LLM cost/latency/tool analytics) with no filler.
The read-only observability surface is well covered for traces, spans, services, errors, and LLM-specific analytics, with no dead ends for the primary investigation flows. Minor gaps: no span-by-ID fetch, no general metric or log retrieval, and no attribute/key discovery to help construct advanced filters.
Maintenance
Related MCP Connectors
AI agent observability for production traces, natural-language insights, and improvement loops.
Connects AI assistants to TrackingTime for querying time entries, projects, tasks, customers, and team data using natural language.
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
LLM Orchestration Agent (Opentelemetry Api)
Related MCP Servers
- AlicenseAqualityCmaintenanceBridges AI coding assistants with the OpenTelemetry ecosystem, providing real-time access to repositories, documentation, examples, semantic conventions, and instrumentation scoring for high-quality observability.920Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables natural language querying and analysis of OpenTelemetry traces, metrics, and logs stored in Elasticsearch/OpenSearch, allowing AI assistants to investigate performance issues, find root causes, and explore system behavior.14MIT

SigNoz MCP Serverofficial
AlicenseNot gradedqualityBmaintenanceEnables AI assistants and LLMs to query SigNoz observability data (metrics, traces, logs, alerts, dashboards) using natural language.132Apache 2.0- AlicenseAqualityBmaintenanceConnects AI assistants to OpenTelemetry trace backends (Jaeger, Grafana Tempo, Traceloop, Datadog, Sentry, AWS X-Ray, New Relic and Honeycomb) for natural-language trace and span search, error triage, cross-backend correlation, and LLM analytics such as token usage, model performance and the most expensive or slowest traces.19138 PyPI1Apache 2.0