otel-instrumentation-mcp

otel-instrumentation-mcp

Bridges AI coding assistants with the OpenTelemetry ecosystem, providing real-time access to repositories, documentation, examples, semantic conventions, and instrumentation scoring for high-quality observability.

Category
访问服务器

README


<p align="center"> <a href="https://github.com/liatrio-labs/otel-instrumentation-mcp/actions/workflows/build.yml?query=branch%3Amain"> <img alt="Build Status" src="https://img.shields.io/github/actions/workflow/status/liatrio-labs/otel-instrumentation-mcp/build.yml?branch=main&style=for-the-badge"> </a> <a href="https://codecov.io/gh/liatrio-labs/otel-instrumentation-mcp/branch/main" > <img alt="Codecov Status" src="https://img.shields.io/codecov/c/github/liatrio-labs/otel-instrumentation-mcp?style=for-the-badge"/> </a> <a href="https://github.com/liatrio-labs/otel-instrumentation-mcp/releases"> <img alt="GitHub release" src="https://img.shields.io/github/v/release/liatrio-labs/otel-instrumentation-mcp?include_prereleases&style=for-the-badge"> </a> <a href="https://api.securityscorecards.dev/projects/github.com/liatrio-labs/otel-instrumentation-mcp/badge"> <img alt="OpenSSF Scorecard" src="https://img.shields.io/ossf-scorecard/github.com/liatrio-labs/otel-instrumentation-mcp?label=openssf%20scorecard&style=for-the-badge"> </a> </p>

OpenTelemetry MCP Server

A Model Context Protocol (MCP) server that bridges AI coding assistants (like ClaudeCode, OpenCode, Windsurf, and Cursor) with the OpenTelemetry ecosystem. It provides real-time access to OpenTelemetry repositories, documentation, examples, semantic conventions, and the instrumentation score specification to help engineers implement high-quality observability in their applications.

Why use this?

OpenTelemetry has extensive documentation and many implementation patterns. This MCP server helps AI assistants:

  • Navigate the complexity of OpenTelemetry documentation
  • Provide accurate, up-to-date instrumentation code
  • Follow best practices and semantic conventions
  • Generate instrumentation that scores qualitatively high
  • Avoid common pitfalls and anti-patterns

Features

The MCP server provides tools and prompts to help AI assistants with OpenTelemetry tasks:

  • Repository & Issue Access - Browse OpenTelemetry repositories and search issues
  • Examples & Documentation - Language-specific examples and documentation
  • Semantic Conventions - Access to standardized attribute definitions
  • Instrumentation Scoring - Evaluate telemetry quality based on best practices
  • AI Prompts - Analyze code and generate instrumentation suggestions

Additional capabilities:

  • Self-Instrumented - Full distributed tracing with OpenTelemetry
  • Multi-Transport - Supports stdio (local), HTTP, and SSE protocols
  • Production Ready - Kubernetes manifests, health checks, graceful shutdown
  • GitHub Integration - Authenticated API access via GitHub App or Personal Access Token

Security Notice

Currently supported authentication methods:

  • GitHub Personal Access Token (PAT) - For individual, local use.
  • GitHub App - For hosted deployments.

IMPORTANT: OAuth support is planned for future implementations. Ensure your credentials are properly secured and never commit them to version control.

Quick Start

Prerequisites

  • Python 3.13+
  • uv package manager
  • GitHub authentication (Personal Access Token or GitHub App credentials)

Installation

  1. Clone the repository:
git clone https://github.com/liatrio-labs/otel-instrumentation-mcp.git
cd otel-instrumentation-mcp
  1. Install dependencies:
uv sync
  1. Set up GitHub authentication (choose one):

Option A: Personal Access Token

export GITHUB_TOKEN="github_pat_..."

Option B: GitHub App (recommended for production)

export GITHUB_APP_ID="123456"
export GITHUB_INSTALLATION_ID="654321"
export GITHUB_APP_PRIVATE_KEY_PATH="/path/to/private-key.pem"

NOTE: Additional environment variables can be set, like the OTEL_EXPORTER_OTLP_ENDPOINT. For a list of available environment variables, see .env.examples

  1. Run the MCP server:
uv run otel-instrumentation-mcp

Local Development

For development with hot reload and local Kubernetes:

# Install development dependencies
task install

# Run with Tilt (includes local Kubernetes, OpenTelemetry Collector, hot reload)
tilt up

# Or run development server standalone with hot reload
task dev

# Run tests
task test

# Run linting and formatting
task lint

# Run all checks (test + lint)
task checks

Usage Examples

Configuration with AI Assistants

Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "otel-instrumentation-mcp": {
      "command": "uv",
      "args": ["run", "otel-instrumentation-mcp"],
      "cwd": "/path/to/otel-instrumentation-mcp",
      "env": {
        "GITHUB_TOKEN": "your_github_token"
      }
    }
  }
}

VS Code

VS Code supports MCP servers through the GitHub Copilot extension (requires Copilot Chat). Add to your workspace's .vscode/mcp.json file:

{
  "servers": {
    "otel-instrumentation-mcp": {
      "command": "uv",
      "args": ["run", "otel-instrumentation-mcp"],
      "cwd": "/path/to/otel-instrumentation-mcp",
      "env": {
        "GITHUB_TOKEN": "your_github_token"
      }
    }
  }
}

Alternatively, add to your VS Code settings.json for global configuration:

{
  "mcp": {
    "servers": {
      "otel-instrumentation-mcp": {
        "command": "uv",
        "args": ["run", "otel-instrumentation-mcp"],
        "cwd": "/path/to/otel-instrumentation-mcp",
        "env": {
          "GITHUB_TOKEN": "your_github_token"
        }
      }
    }
  }
}

Note: Ensure uv is in your PATH or use the full path to the uv executable. After adding the configuration, reload VS Code and the MCP server should appear in Copilot Chat's available tools.

Windsurf or Cursor

Add to your MCP configuration file:

{
  "mcpServers": {
    "otel-instrumentation-mcp": {
      "command": "uv",
      "args": ["run", "otel-instrumentation-mcp"],
      "cwd": "/path/to/otel-instrumentation-mcp",
      "env": {
        "GITHUB_TOKEN": "your_github_token"
      }
    }
  }
}

Testing and Development

MCP Inspector

npx @modelcontextprotocol/inspector uv run otel-instrumentation-mcp

Using HTTP/SSE Transports (Remote Access)

For network-accessible deployments:

# HTTP Transport
SERVICE_PORT=8080 uv run otel-instrumentation-mcp
# Access at: http://localhost:8080/mcp/

# SSE Transport
MCP_TRANSPORT=sse MCP_PORT=8080 uv run otel-instrumentation-mcp
# Access at: http://localhost:8080/

Note: Remote access currently requires GitHub authentication configured via environment variables. OAuth support for client authentication is coming soon.

Real-World Example: Instrumenting Your Code

Once configured, you can ask your AI assistant to help with OpenTelemetry instrumentation:

User: Help me add OpenTelemetry instrumentation to my Python Flask application

AI Assistant: I'll help you add OpenTelemetry instrumentation to your Flask
application. Let me first check the latest OpenTelemetry documentation and
examples for Python.

[Uses get_opentelemetry_docs_by_language tool]
[Uses get_opentelemetry_examples_by_language tool]
[Uses get_semantic_conventions tool]

Based on the latest OpenTelemetry documentation, here's how to properly
instrument your Flask application...

[Provides relatively accurate* up-to-date instrumentation code following best
practices]

Production Deployment

Kubernetes

The repository includes Kubernetes manifests with:

  • Deployment with health checks and resource limits
  • Service for internal communication
  • OpenTelemetry Collector integration
  • ConfigMaps for feature flags
  • Support for different environments via the Kustomize overlay pattern (dev, local, prod)
# Example
kubectl apply -k manifests/overlays/prod

Configuration

Environment Variables

Variable Description Default
SERVICE_NAME Service name for telemetry otel-instrumentation-mcp-server
SERVICE_VERSION Service version 0.15.0
SERVICE_INSTANCE_ID Instance identifier local
SERVICE_PORT Port for HTTP transport (overrides MCP_PORT) -
MCP_TRANSPORT Transport type (stdio, http, sse) stdio
MCP_HOST Host binding for HTTP/SSE Auto-detected
MCP_PORT Port for HTTP/SSE transport 8080
OTEL_EXPORTER_OTLP_ENDPOINT OTLP collector endpoint http://localhost:4317

GitHub Authentication

Choose one authentication method:

GitHub App (Recommended):

  • GITHUB_APP_ID - GitHub App ID
  • GITHUB_INSTALLATION_ID - Installation ID
  • GITHUB_APP_PRIVATE_KEY_PATH - Path to private key

Personal Access Token:

  • GITHUB_TOKEN - GitHub personal access token

Development

Running Tests

# Run all tests
task test

# Run specific test
task test-single -- tests/test_main.py::test_list_opentelemetry_repos_tool

# Run with coverage
task test-coverage

Linting and Formatting

# Run all checks
task checks

# Format code
task lint

Development Server

# Start with hot reload
task dev

# Custom port
SERVICE_PORT=3000 task dev

Observability

The MCP server is fully instrumented with OpenTelemetry, providing:

  • Distributed tracing for MCP operations
  • Custom semantic conventions for MCP and GenAI specific attributes
  • Integration with standard OpenTelemetry collectors
  • High instrumentation quality (measured with Instrumentation Score)

View traces in your preferred backend (Jaeger, Honeycomb, Datadog, Dash0, etc.) by configuring OTEL_EXPORTER_OTLP_ENDPOINT.

Architecture

  • FastMCP Framework - Provides MCP protocol implementation
  • OpenTelemetry SDK - Full observability with auto-instrumentation
  • Async Python - High-performance async/await patterns
  • GitHub GraphQL API - Efficient data fetching from repositories
  • Multi-transport - Flexible deployment options (stdio, HTTP, SSE)

Roadmap

Coming Soon

  • OAuth Support - Full OAuth flow for MCP authentication
  • Caching Layer - Native caching for GitHub API responses to improve performance
  • Weaver Custom Semantic Conventions - Support for custom semantic convention registries through Weaver.

Known Limitations

  • OAuth flow for MCPs isn't implemented yet.
  • GitHub API rate limits apply organizationally when self-hosting through an app.
  • Currently optimized for OpenTelemetry repositories only.

Contributing

We welcome contributions! Please submit issues and pull requests on GitHub. See CONTRIBUTING.md to get started.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Support

Notice of Attribution

This is a derived worked from @sgsharma's original otel-instrumentation-mcp at this commit.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选