Sign inSign up

talkopsai/opentelemetry-mcp-server

By talkopsai

Updated 3 months ago

MCP Server for OpenTelemetry collector provisioning, auto-instrumentation, and pipeline governance

Image
Developer tools
Monitoring & observability
0

162

talkopsai/opentelemetry-mcp-server repository overview

OpenTelemetry MCP Server by TalkOps.ai

An MCP server that gives AI assistants the power to discover, provision, instrument, validate, and govern OpenTelemetry pipelines on Kubernetes — from intent-driven collector provisioning to cardinality control, sampling optimization, and security auditing.

✨ Features

  • Intent-Driven Collector Provisioning: Express what you need (signals, namespace) — the tool auto-discovers backends (Jaeger, Tempo, Prometheus, Loki, and 6 more), generates best-practice configs with correct processor ordering, selects deployment mode, sizes resources from cluster scale, and creates RBAC automatically.
  • Zero-to-Instrumented Onboarding: Look up language support, create Instrumentation CRDs, annotate Deployments for auto-instrumentation injection, and verify the rollout — all with dry-run-first safety.
  • Pipeline Investigation & Validation: Deep-inspect any OTel Collector's config, validate processor ordering against best practices, audit filelog receiver safety, and check k8sattributes enrichment profiles.
  • Metric Cardinality Governance: Detect high-cardinality dimensions from SpanMetrics connectors, generate transform processor YAML to drop attributes, and estimate series counts before they explode.
  • Sampling Strategy Optimization: Cross-reference head sampling (Instrumentation CRDs) with tail sampling (collector config), detect conflicts, and generate config patches to switch strategies.
  • Security Posture Auditing: Scan eBPF instrumentation pods for privileged mode, SYS_ADMIN capabilities, and hostPID access. Risk-assess the entire observability footprint.

🚀 How to Use This Image

This Docker image runs an MCP server that connects to your Kubernetes cluster to manage OpenTelemetry resources. AI assistants (Claude, Cline, Cursor, or any MCP client) connect to the server over HTTP, SSE, or stdio.

Running Standalone (HTTP Transport)
docker run --rm -it \
  -p 8771:8771 \
  -v ~/.kube:/app/.kube:ro \
  -e K8S_KUBECONFIG=/app/.kube/config \
  -e MCP_TRANSPORT=http \
  talkopsai/opentelemetry-mcp-server:latest

The server is now listening on http://localhost:8771/mcp.

Tip: Mount the full ~/.kube directory (not just config) so certificate paths referenced in your kubeconfig (e.g. minikube, kind) are available inside the container.

Then configure your MCP client to connect:

{
  "mcpServers": {
    "opentelemetry": {
      "url": "http://localhost:8771/mcp",
      "description": "MCP Server for OpenTelemetry Kubernetes observability"
    }
  }
}
In-Cluster Deployment

When running inside a Kubernetes pod, use in-cluster config:

docker run --rm -it \
  -p 8771:8771 \
  -e MCP_TRANSPORT=http \
  -e K8S_IN_CLUSTER=true \
  talkopsai/opentelemetry-mcp-server:latest
Important: RBAC Requirements

The OpenTelemetry Operator must be installed in the cluster. The server's service account needs:

  • get, list, watch on OpenTelemetryCollector and Instrumentation CRDs
  • create, patch on OpenTelemetryCollector and Instrumentation CRDs (for provisioning)
  • create, patch, get on ClusterRole and ClusterRoleBinding (for k8sattributes RBAC)

🛠️ Configuration (Claude Desktop — Stdio)

To use this image over stdio transport directly inside Claude Desktop:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "opentelemetry-mcp-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-v", "/Users/YOUR_USERNAME/.kube:/app/.kube:ro",
        "-e", "K8S_KUBECONFIG=/app/.kube/config",
        "-e", "MCP_TRANSPORT=stdio",
        "-e", "MCP_LOG_LEVEL=INFO",
        "talkopsai/opentelemetry-mcp-server:latest"
      ]
    }
  }
}

Replace /Users/YOUR_USERNAME/.kube with your actual kubeconfig path (e.g. C:\Users\YourUser\.kube on Windows).


⚙️ Environment Variables

Server Configuration
VariableDefaultDescription
MCP_TRANSPORTstdioTransport protocol: http, sse, streamable-http, or stdio
MCP_HOST0.0.0.0Host interface to bind to
MCP_PORT8771Port for HTTP server
MCP_PATH/mcpMCP endpoint path
MCP_LOG_LEVELINFOLog level: DEBUG, INFO, WARNING, ERROR
MCP_LOG_FORMATjsonLog format: json or text
MCP_HTTP_TIMEOUT300HTTP server timeout (seconds)
Kubernetes
VariableDefaultDescription
K8S_KUBECONFIG(empty)Path to kubeconfig file inside the container
K8S_IN_CLUSTERfalseSet true when running inside a Kubernetes pod
K8S_ENABLEDtrueEnable/disable Kubernetes features entirely
OTel Operator CRD
VariableDefaultDescription
OTEL_CRD_GROUPopentelemetry.ioAPI group for OTel CRDs
OTEL_CRD_API_VERSIONv1beta1API version for Collector CRDs
OTEL_INSTRUMENTATION_API_VERSIONv1alpha1API version for Instrumentation CRDs
Prometheus Integration
VariableDefaultDescription
PROMETHEUS_BASE_URL(empty)Prometheus HTTP API base URL (for cardinality queries)
PROMETHEUS_TIMEOUT30HTTP timeout for Prometheus API calls (seconds)

🔧 Available Tools (19 Total)

Discovery
ToolDescription
otel_list_collectorsList OpenTelemetryCollector CRDs with namespace filtering, label selectors, and pagination
otel_query_a2uiRetrieve collector status and pipeline metrics formatted for A2UI Status Datatables
otel_get_collectorGet detailed collector info — pipelines, status, raw YAML config
otel_list_instrumented_servicesList workloads with auto-instrumentation status, annotations, and 4-tier language detection
Collector Management
ToolDescription
otel_provision_collectorSmart, intent-driven collector provisioning with backend auto-discovery, best-practice configs, and auto-RBAC
otel_patch_collectorExpert-level CRD management — create or replace OpenTelemetryCollector CRDs with full spec
Instrumentation
ToolDescription
otel_lookup_instrumentationMap language and framework to OTel instrumentation support
otel_patch_instrumentationCreate or patch an Instrumentation CRD with dry-run safety
otel_annotate_deploymentApply auto-instrumentation annotation to Deployments
Validation
ToolDescription
otel_validate_k8sattributes_orderValidate processor ordering against recommended order
otel_check_filelog_safetyCheck filelog receiver for safety issues
otel_inspect_target_allocator_stateInspect Target Allocator configuration
otel_recommend_collector_topologyRecommend collector deployment mode and resource sizing
Governance
ToolDescription
otel_detect_cardinalityDetect metric cardinality issues from SpanMetrics
otel_gen_drop_attribute_rulesGenerate transform processor YAML to drop high-cardinality attributes
otel_analyze_ebpf_footprintScan eBPF pods for security posture
Sampling
ToolDescription
otel_inspect_sampling_configurationInspect head + tail sampling config with conflict detection
otel_toggle_sampling_strategyGenerate config patches to switch sampling strategies
SpanMetrics
ToolDescription
otel_inspect_spanmetrics_configInspect SpanMetrics connector configuration and cardinality
otel_enable_spanmetrics_for_serviceGenerate SpanMetrics connector YAML with custom dimensions

📖 Available Resources (9 URIs)

ResourceDescription
otel://system/healthServer health: K8s connectivity, OTel CRD availability, version
otel://collector/{namespace}/{name}Full collector config: pipelines, receivers, processors, exporters
otel://k8s-enrichment/{namespace}/{collector}k8sattributes processor profile
otel://logs-profile/{namespace}/{collector}Filelog receiver config and safety analysis
otel://spanmetrics/{namespace}/{collector}SpanMetrics connector profile and cardinality estimates
otel://instrumentation/{namespace}/{name}Instrumentation CRD details
otel://target-allocator/{namespace}/{name}Target Allocator state and configuration
otel://lang/{language}Per-language instrumentation capabilities
otel://registry/languagesFull language support matrix

🔐 Security Best Practices

  1. Never expose the MCP server to the public internet without proper authentication.
  2. Read-Only Mount: Always mount kubeconfig with :ro so the container cannot modify your credentials.
  3. RBAC Least Privilege: Ensure the kubeconfig identity has only the permissions needed for OTel CRD management.
  4. Dry-Run First: All mutating tools (otel_provision_collector, otel_patch_collector, otel_patch_instrumentation, otel_annotate_deployment) default to dry_run=True. Review output before applying.
  5. Review RBAC Resources: otel_provision_collector creates ClusterRole/ClusterRoleBinding for k8sattributes — review the spec before applying with dry_run=False.

🐳 Docker Compose Example

services:
  opentelemetry-mcp-server:
    image: talkopsai/opentelemetry-mcp-server:latest
    ports:
      - "8771:8771"
    environment:
      - MCP_TRANSPORT=http
      - K8S_IN_CLUSTER=true
      - MCP_LOG_LEVEL=INFO

If you find this MCP server useful, consider leaving a ⭐ on the GitHub repository!

Tag summary

Content type

Image

Digest

sha256:39347fa91

Size

82.1 MB

Last updated

3 months ago

docker pull talkopsai/opentelemetry-mcp-server