OpenTelemetry MCP server
The OpenTelemetry MCP Server is a Model Context Protocol server for operating the OpenTelemetry Operator and Collector pipelines on Kubernetes. It exposes 19 tools, 9 otel:// resources, and 5 guided operational prompts for intent-driven Collector provisioning, 4-tier polyglot auto-instrumentation, processor ordering validation, SpanMetrics cardinality governance, and eBPF security auditing.
Provision OpenTelemetryCollector CRDs, inject zero-touch Instrumentation, validate processor chains, and generate OTTL drop rules.
Inspect cluster collector topologies (otel://), language support matrices, processor ordering rules, and health states.
Step-by-step runbooks for workload auto-instrumentation, pipeline safety audits, cardinality mitigation, and head/tail sampling alignment.
Configure Kubernetes RBAC permissions, CRD API versions (v1beta1 / v1alpha1), and server-side dry-run defaults.
Core capabilities
| Capability Domain | What the Server Provides |
|---|---|
| Intent-Driven Collector Provisioning | Discovers in-cluster telemetry backends (Tempo, Jaeger, Mimir, Prometheus, Loki, OpenSearch), synthesizes OpenTelemetryCollector CRDs (DaemonSet, StatefulSet, or Deployment), and provisions k8sattributes RBAC automatically. |
| 4-Tier Polyglot Auto-Instrumentation | Detects workload languages across Java, Python, Node.js, .NET, Go, and Rust (via annotations, images, container names, and runtime env vars), generates Instrumentation CRDs, and checks for conflicting OTEL_* environment variables. |
| Pipeline Safety Validation | Verifies canonical processor ordering (memory_limiter → k8sattributes → resourcedetection → transform → batch), audits filelog receivers for self-collection loops, and inspects Target Allocator hashing strategies. |
| SpanMetrics & Cardinality Governance | Detects high-cardinality SpanMetrics dimensions, estimates time-series multiplication risk, and generates OTTL delete_key() transform rules. |
| Sampling & eBPF Auditing | Reconciles SDK head sampling with Collector tail sampling policies and audits eBPF agents (OTel eBPF, Beyla) for CAP_SYS_ADMIN, hostPID, and privileged container exposure. |
Architecture
Tool summary
| Tool | Category | Description |
|---|---|---|
otel_provision_collector | Collector Management | Intent-driven provisioning with backend auto-discovery, RBAC generation, and resource sizing |
otel_patch_collector | Collector Management | Create or patch OpenTelemetryCollector CRDs with YAML validation and dry_run=True safety |
otel_list_collectors | Discovery | List OpenTelemetryCollector CRDs across namespaces with label selectors |
otel_get_collector | Discovery | Inspect full collector configuration, pipeline topology, and raw YAML specs |
otel_query_a2ui | Discovery | Format collector pipeline health and metrics for A2UI status tables |
otel_list_instrumented_services | Discovery | Audit workload auto-instrumentation status and 4-tier language detection |
otel_lookup_instrumentation | Instrumentation | Query the language and framework support matrix for auto-instrumentation |
otel_patch_instrumentation | Instrumentation | Create or patch Instrumentation CRDs with propagators, samplers, and custom images |
otel_annotate_deployment | Instrumentation | Annotate Deployments for auto-instrumentation with conflicting env var detection |
otel_validate_k8sattributes_order | Validation | Validate processor chain sequence against OpenTelemetry best practices |
otel_check_filelog_safety | Validation | Audit filelog receivers for self-collection loops and checkpoint storage |
otel_inspect_target_allocator_state | Validation | Inspect Target Allocator hashing strategies, selectors, and Prometheus CR integration |
otel_recommend_collector_topology | Validation | Recommend collector architecture (DaemonSet + gateway) based on cluster scale |
otel_detect_cardinality | Governance | Detect high-cardinality SpanMetrics dimensions and estimate series explosion risk |
otel_gen_drop_attribute_rules | Governance | Generate OTTL transform processor rules to drop high-cardinality or PII attributes |
otel_analyze_ebpf_footprint | Governance | Audit eBPF agent security contexts, privileged containers, and Linux capabilities |
otel_inspect_sampling_configuration | Sampling | Cross-reference SDK head sampling against Collector tail sampling policies |
otel_toggle_sampling_strategy | Sampling | Generate config patches to switch or tune head and tail sampling policies |
otel_inspect_spanmetrics_config | SpanMetrics | Inspect SpanMetrics connector configuration and pipeline wiring |
otel_enable_spanmetrics_for_service | SpanMetrics | Generate SpanMetrics connector YAML with bounded dimensions and histogram buckets |
Quickstart
Mount your ~/.kube/config read-only and expose port 8771:
docker run --rm -it \
-p 8771:8771 \
-e MCP_TRANSPORT=http \
-e K8S_IN_CLUSTER=false \
-v ~/.kube/config:/root/.kube/config:ro \
talkopsai/opentelemetry-mcp-server:latest
Register the HTTP endpoint or launch via uvx over stdio:
{
"mcpServers": {
"opentelemetry": {
"url": "http://localhost:8771/mcp",
"description": "TalkOps OpenTelemetry MCP Server for Kubernetes Observability"
}
}
}
Security considerations
- Dry-run by default: All mutating tools (
otel_provision_collector,otel_patch_instrumentation,otel_annotate_deployment) default todry_run=Trueso operators review the exact CRD diff before applying. - Least-privilege RBAC: Scope the server's
ClusterRoleusing the manifests in Kubernetes RBAC Requirements. - Sensitive attribute redaction: Use
otel_gen_drop_attribute_rulesto striphttp.request.header.authorizationand PII attributes at the Collector layer before exporting spans or logs.