Skip to main content

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.

Core capabilities​

Capability DomainWhat the Server Provides
Intent-Driven Collector ProvisioningDiscovers 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-InstrumentationDetects 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 ValidationVerifies canonical processor ordering (memory_limiter → k8sattributes → resourcedetection → transform → batch), audits filelog receivers for self-collection loops, and inspects Target Allocator hashing strategies.
SpanMetrics & Cardinality GovernanceDetects high-cardinality SpanMetrics dimensions, estimates time-series multiplication risk, and generates OTTL delete_key() transform rules.
Sampling & eBPF AuditingReconciles 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​

ToolCategoryDescription
otel_provision_collectorCollector ManagementIntent-driven provisioning with backend auto-discovery, RBAC generation, and resource sizing
otel_patch_collectorCollector ManagementCreate or patch OpenTelemetryCollector CRDs with YAML validation and dry_run=True safety
otel_list_collectorsDiscoveryList OpenTelemetryCollector CRDs across namespaces with label selectors
otel_get_collectorDiscoveryInspect full collector configuration, pipeline topology, and raw YAML specs
otel_query_a2uiDiscoveryFormat collector pipeline health and metrics for A2UI status tables
otel_list_instrumented_servicesDiscoveryAudit workload auto-instrumentation status and 4-tier language detection
otel_lookup_instrumentationInstrumentationQuery the language and framework support matrix for auto-instrumentation
otel_patch_instrumentationInstrumentationCreate or patch Instrumentation CRDs with propagators, samplers, and custom images
otel_annotate_deploymentInstrumentationAnnotate Deployments for auto-instrumentation with conflicting env var detection
otel_validate_k8sattributes_orderValidationValidate processor chain sequence against OpenTelemetry best practices
otel_check_filelog_safetyValidationAudit filelog receivers for self-collection loops and checkpoint storage
otel_inspect_target_allocator_stateValidationInspect Target Allocator hashing strategies, selectors, and Prometheus CR integration
otel_recommend_collector_topologyValidationRecommend collector architecture (DaemonSet + gateway) based on cluster scale
otel_detect_cardinalityGovernanceDetect high-cardinality SpanMetrics dimensions and estimate series explosion risk
otel_gen_drop_attribute_rulesGovernanceGenerate OTTL transform processor rules to drop high-cardinality or PII attributes
otel_analyze_ebpf_footprintGovernanceAudit eBPF agent security contexts, privileged containers, and Linux capabilities
otel_inspect_sampling_configurationSamplingCross-reference SDK head sampling against Collector tail sampling policies
otel_toggle_sampling_strategySamplingGenerate config patches to switch or tune head and tail sampling policies
otel_inspect_spanmetrics_configSpanMetricsInspect SpanMetrics connector configuration and pipeline wiring
otel_enable_spanmetrics_for_serviceSpanMetricsGenerate SpanMetrics connector YAML with bounded dimensions and histogram buckets

Quickstart​

1
Start the OpenTelemetry MCP Server container

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
2
Connect your MCP client

Register the HTTP endpoint or launch via uvx over stdio:

mcp.json
{
"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 to dry_run=True so operators review the exact CRD diff before applying.
  • Least-privilege RBAC: Scope the server's ClusterRole using the manifests in Kubernetes RBAC Requirements.
  • Sensitive attribute redaction: Use otel_gen_drop_attribute_rules to strip http.request.header.authorization and PII attributes at the Collector layer before exporting spans or logs.