Skip to main content
Glama
k8s-telemetry-mcp

k8s-telemetry-mcp

by kubeopsai

K8s Telemetry MCP Server

Give your AI assistant read-only access to your Kubernetes cluster's observability stack.

Connect Amazon Q, Claude, Kiro, Cursor, or any MCP-compatible AI assistant to Loki, Prometheus, Tempo, and the Kubernetes API — via a single Helm install.

License Version Helm


How It Works

You ──► AI Assistant (Amazon Q / Claude / Kiro / Cursor)
              │
              ▼  MCP tool calls (stdio via kubectl exec)
        K8s Telemetry MCP Server
              │
        ┌─────┼──────┬──────────┬──────┐
        ▼     ▼      ▼          ▼      ▼
      Loki  Prom   Tempo    K8s API   AWS

The server runs as a pod inside your cluster. Your AI assistant connects via kubectl exec — no ingress, no exposed ports, no API keys.


Related MCP server: mcp-devops-server

Quick Start

1. Install via Helm

helm repo add k8s-telemetry-mcp https://kubeopsai.github.io/k8s-telemetry-mcp
helm repo update

helm install k8s-telemetry-mcp k8s-telemetry-mcp/k8s-telemetry-mcp \
  --namespace monitoring --create-namespace \
  --set config.lokiUrl=http://loki.monitoring:3100 \
  --set config.prometheusUrl=http://prometheus-server.monitoring:9090 \
  --set config.tempoUrl=http://tempo.monitoring:3200

Label your observability namespace. The bundled NetworkPolicy only allows egress to a namespace labelled name: <namespace>. Kubernetes does not add that label for you, and without it every query is blocked:

kubectl label namespace monitoring name=monitoring

2. Configure Your AI Assistant

Prerequisites: Your AI assistant runs kubectl exec locally. Ensure kubectl is in your PATH and your active kubeconfig context points to the cluster where the MCP server is installed.

Amazon Q Developer — ~/.aws/amazonq/mcp.json:

{
  "mcpServers": {
    "k8s-telemetry": {
      "command": "kubectl",
      "args": ["exec", "-i", "-n", "monitoring", "deploy/k8s-telemetry-mcp", "--", "k8s-telemetry-mcp"]
    }
  }
}

Claude Desktop / Kiro / Cursor — claude_desktop_config.json:

{
  "mcpServers": {
    "k8s-telemetry": {
      "command": "kubectl",
      "args": ["exec", "-i", "-n", "monitoring", "deploy/k8s-telemetry-mcp", "--", "k8s-telemetry-mcp"]
    }
  }
}

3. Start Asking Questions

"Why did the payment pod crash in the last hour?"
"Is the checkout service meeting its 99.9% SLO this week?"
"Which namespace is consuming the most resources?"
"Who deleted the payment-service deployment?"
"Which ECR images have critical vulnerabilities?"
"Why is my pod pending? Show me the Kubernetes events."
"What deployments went out in the last 30 minutes?"
"Is my RDS instance showing slow queries?"

23 tools Across 6 Categories

Logs

Tool

Description

query_pod_logs

Query logs from a pod or regex pattern. PII/secrets auto-redacted.

query_logs_custom

Execute a raw LogQL / Datadog / CloudWatch Insights query.

Metrics

Tool

Description

get_pod_metrics

CPU, memory, restarts, network for a pod.

query_prometheus

Execute a raw PromQL query (instant or range).

get_cluster_health

Node count, pod status, CPU/memory utilization snapshot.

Traces

Tool

Description

get_trace

Retrieve a full distributed trace by ID from Tempo.

search_traces

Search traces by service, operation, tags, or duration.

Analytics

Tool

Description

analyze_logs

Pattern detection, error categorization, and recommendations.

build_incident_timeline

Correlate logs, metrics, and traces into a chronological timeline.

enrich_alert

Full context for a firing alert: logs + metrics + traces + suggestions.

get_resource_costs

Cost attribution by namespace with optimization suggestions.

check_slo_status

Error budget, burn rate, and SLO compliance status.

Kubernetes

Tool

Description

get_k8s_events

Events for a namespace or pod — answers OOMKilled/Pending/CrashLoop questions.

get_scaling_history

HPA scaling history and current autoscaler status.

get_node_pressure

Node MemoryPressure, DiskPressure, PIDPressure, and eviction status.

get_recent_deployments

What was rolled out in the last N minutes.

get_alertmanager_history

Recent alerts and active silences from Alertmanager.

AWS

Tool

Description

query_cloudtrail

Search CloudTrail events by keyword, event name, user, or resource.

get_resource_history

Full audit trail for a specific AWS resource ID or ARN.

get_resource_compliance

AWS Config compliance status — drift and non-compliant rules.

get_configuration_history

What actually changed on a resource, with field-level before/after diffs.

get_image_vulnerabilities

ECR image vulnerability findings via Inspector v2 or basic scan.

get_database_insights

RDS Performance Insights and ElastiCache CloudWatch metrics.


Configuration

All settings use the MCP_ prefix:

Variable

Default

Description

MCP_LOKI_URL

""

Loki endpoint

MCP_PROMETHEUS_URL

""

Prometheus endpoint

MCP_TEMPO_URL

""

Tempo endpoint

MCP_ALERTMANAGER_URL

""

Alertmanager endpoint

MCP_ALERTMANAGER_URL

""

Alertmanager endpoint (required for get_alertmanager_history)

MCP_AWS_REGION

us-east-1

AWS region for CloudTrail/Config/ECR/RDS tools

MCP_DATADOG_API_KEY

""

Datadog API key (overrides Loki/Prometheus)

MCP_CLOUDWATCH_LOG_GROUP

""

CloudWatch log group (overrides Loki)

MCP_ENABLE_SANITIZATION

true

Auto-redact PII and secrets

MCP_MAX_LOG_LINES

500

Max log lines per query

MCP_MAX_QUERY_RANGE_HOURS

24

Max query time range

MCP_LOG_LEVEL

INFO

Log level


Security

  • Read-only: All 23 tools are strictly read-only. No write, delete, or mutation operations anywhere in the codebase.

  • No ingress: Communicates over stdio via kubectl exec. No exposed ports, no load balancers, no API key to rotate. Note the corollary: exec access to the pod is equivalent to read access to your telemetry, so restrict it accordingly.

  • RBAC: A scoped ClusterRole grants get/list on events, nodes, deployments, replicasets, and HPAs. No watch, no wildcards, no secrets, no pods/exec, no pods/log.

  • NetworkPolicy: Restricts egress to your observability stack, DNS, and — only when the AWS tools are enabled — outbound HTTPS. Set networkPolicy.allowAwsApiEgress=false to remove that last rule.

  • Redaction: Best-effort regex scrubbing of AWS access keys, JWTs, bearer tokens, password=-style assignments, database URIs, emails, and card/SSN patterns before output reaches your assistant. It catches the textbook cases; it does not catch modern token formats (ghp_, xoxb-, sk_live_), unlabelled secrets, or Prometheus label values and RDS Performance Insights SQL text. Treat it as defence in depth rather than a compliance boundary — see the Security wiki page for the full list of what is and is not covered.

  • Container: non-root (uid 1001), read-only root filesystem, all capabilities dropped.

What runs in the pod

The MCP protocol here is stdio-based, and your assistant starts its own server process through kubectl exec. The pod's own process is a small host (k8s-telemetry-mcp-host) that keeps the pod alive for those sessions and answers the health probes. If you were expecting a long-running server listening on a port, there isn't one — that is by design.


Backends Supported

Backend

Logs

Metrics

Traces

Loki + Prometheus + Tempo

✓

✓

✓

Datadog

✓

✓

—

CloudWatch

✓

✓

—


Local Development

pip install -e ".[dev]"

MCP_LOKI_URL=http://localhost:3100 \
MCP_PROMETHEUS_URL=http://localhost:9090 \
python -m k8s_telemetry_mcp.server

The server reads MCP requests on stdin, so run it from a terminal and paste a request, or point a local assistant at it. A quick handshake check:

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | python -m k8s_telemetry_mcp.server

Before opening a PR:

ruff check k8s_telemetry_mcp/ tests/
pytest

⚡ From Free Tool to 3 AM Hero

Tuesday 2:00 PM — The Free Win

You're tracking down a staging issue. You type into Claude Desktop:

"Why did the checkout pod restart 10 minutes ago?"

Claude calls get_k8s_events and query_pod_logs. In seconds:

"The pod was OOMKilled. It hit its 512Mi limit after processing a large JSON payload."

Fixed in 3 minutes. You would have spent 20 minutes tabbing between Lens, Grafana, and CloudWatch.


Saturday 3:15 AM — The Pain

PagerDuty fires. High Latency — Payment Gateway.

You roll out of bed. VPN. Okta. AWS Console. Grafana. Loki. Prometheus. 25 minutes of manual digging to find that a bad database migration locked a table. You roll back the deployment. It's 4:30 AM. Sleep is gone.

The tool that diagnosed your OOMKilled pod in 3 minutes on Tuesday had all the access it needed to find this too — it just needed someone at a keyboard to ask.


Monday 9:00 AM — The Realization

In the incident review, you remember Tuesday. You open the GitHub README and scroll to the bottom.

What if the tool ran itself when the alert fired?

That's exactly what KubeOpsAI Agent does.


🤖 KubeOpsAI Agent — Automated Incident Response

KubeOpsAI hooks into your Alertmanager webhooks. When an alert fires at 3 AM, it investigates using 18 of these collectors and posts a root-cause analysis to your Slack incident channel — before PagerDuty even wakes your engineer up.

Read-only by design. The agent investigates and explains. Your engineer makes the call and runs the fix. This is exactly why security teams approve it in 5 minutes instead of 6 months.

Alerting fires at 3:14 AM
        │
        ▼
  KubeOpsAI Agent
  ├── get_k8s_events      → OOMKilled × 3 in 10 min
  ├── query_pod_logs      → cache.put() called 12,000×/min
  ├── get_recent_deployments → checkout-api v2.4.1 at 03:00 UTC
  └── get_pod_metrics     → memory 180Mi → 512Mi limit
        │
        ▼
  Slack #incidents at 3:15 AM
  "Root cause: unbounded cache in v2.4.1.
   Recommended action: rollback to v2.4.0."
        │
        ▼
  Engineer wakes up to answer, not questions.
  Back to sleep by 3:20 AM.
  • Zero human interaction required

  • Runs inside your cluster — your data never leaves your VPC

  • Bring your own LLM key (AWS Bedrock, Anthropic, OpenAI)

  • A separate commercial product, sold on AWS Marketplace. This MCP server is free and open source, and stays that way — KubeOpsAI builds on it.

👉 kubeopsai.net


License

Apache License 2.0 — see LICENSE for details.

Support

Available Tools

23 tools
analyze_logsA

Analyze logs for a service — detects errors, anomalies, and patterns with recommendations.

Args: service_name: Service/pod name or regex pattern namespace: Kubernetes namespace timeframe_minutes: How many minutes of logs to analyze (1-1440) limit: Maximum log lines to analyze (1-500)

Inputs: service_name (required), limit, namespace, timeframe_minutes. Returns: result

build_incident_timelineA

Build a chronological incident timeline combining logs, metrics, and traces.

Args: service_name: Affected service name namespace: Kubernetes namespace timeframe_minutes: Time window to analyze (1-1440)

Inputs: service_name (required), namespace, timeframe_minutes. Returns: result

check_slo_statusA

Check SLO compliance — error budgets, burn rate, and availability vs. latency targets.

Args: service_name: Service to check namespace: Kubernetes namespace availability_target: Target availability (0.0-1.0, default 99.9%) latency_target_ms: Target latency in milliseconds latency_percentile: Latency percentile to measure (default p99) window_hours: Measurement window in hours (1-720)

Inputs: service_name (required), namespace, window_hours, latency_target_ms, +2 more. Returns: result

enrich_alertA

Enrich an alert with full context: recent logs, metrics, traces, and recommendations.

Args: alert_name: Name of the alert that fired service_name: Affected service name namespace: Kubernetes namespace timeframe_minutes: Context window in minutes (1-60)

Inputs: alert_name (required), service_name (required), namespace, timeframe_minutes. Returns: result

get_alertmanager_historyA

Get recent alerts and active silences from Prometheus Alertmanager. Requires MCP_ALERTMANAGER_URL to be configured.

Args: service_name: Filter alerts by service name (optional) namespace: Filter alerts by namespace label (optional) timeframe_minutes: How far back to look (1-1440) include_silences: Whether to include active silences (default: true)

Inputs: namespace, service_name, include_silences, timeframe_minutes. Returns: result

get_cluster_healthA

Get overall Kubernetes cluster health: node count, pod status, CPU/memory utilization.

Inputs: no named parameters. Returns: result

get_configuration_historyA

Get the configuration-change history for one AWS resource, with field-level diffs.

Answers "what actually changed on this resource, and when". CloudTrail records that an API call happened; AWS Config records the resulting state, so this is what tells you a security group's ingress rules went from one value to another.

Each change carries a capture time and a config_item_id for citation, plus the resources AWS Config considers related — useful for establishing whether a changed resource is actually connected to a failing one.

Requires AWS Config to be enabled and config:GetResourceConfigHistory.

Args: resource_type: AWS Config resource type, e.g. 'AWS::EC2::SecurityGroup' resource_id: Resource ID, e.g. 'sg-0123456789abcdef0' timeframe_hours: How far back to look (1-720) limit: Maximum configuration snapshots to retrieve (1-100)

Inputs: resource_id (required), resource_type (required), limit, timeframe_hours. Returns: result

get_database_insightsA

Get database performance insights for RDS or ElastiCache.

Args: db_identifier: RDS instance/cluster ID or ElastiCache cluster ID db_type: 'rds' or 'elasticache' timeframe_minutes: Time window to analyze (1-1440)

Inputs: db_identifier (required), db_type, timeframe_minutes. Returns: result

get_image_vulnerabilitiesA

Get vulnerability findings for a container image in ECR. Uses AWS Inspector v2 if enabled, falls back to ECR basic scan. Requires ecr:DescribeImageScanFindings and inspector2:ListFindings IAM permissions.

Args: repository_name: ECR repository name image_tag: Image tag to check (default: latest) severity_filter: Severities to include e.g. ['CRITICAL', 'HIGH']

Inputs: repository_name (required), image_tag, severity_filter. Returns: result

get_k8s_eventsA

Get Kubernetes events for a namespace or pod. Answers 'why is my pod pending/OOMKilled/CrashLoopBackOff?' Requires rbac.enabled=true in Helm values.

Args: namespace: Kubernetes namespace pod_name: Filter events for a specific pod (optional) event_type: Filter by 'Warning' or 'Normal' (optional) timeframe_minutes: How far back to look (1-1440) limit: Maximum events to return (1-500)

Inputs: limit, pod_name, namespace, event_type, +1 more. Returns: result

get_node_pressureA

Get Kubernetes node pressure conditions, resource capacity, and eviction status. Identifies nodes with MemoryPressure, DiskPressure, or PIDPressure.

Inputs: no named parameters. Returns: result

get_pod_metricsB

Get metrics for a Kubernetes pod (CPU, memory, restarts, network).

Args: pod_name: Pod name or regex pattern namespace: Kubernetes namespace metric_type: One of: cpu, memory, restarts, network_rx, network_tx

Inputs: pod_name (required), namespace, metric_type. Returns: result

get_recent_deploymentsA

Get recent Kubernetes deployment changes — what was rolled out in the last N minutes. Useful for correlating deployments with incidents.

Args: namespace: Kubernetes namespace timeframe_minutes: How far back to look (1-1440)

Inputs: namespace, timeframe_minutes. Returns: result

get_resource_complianceA

Get AWS Config compliance status for resources. Shows drift and non-compliant rules. Requires AWS Config to be enabled and config:Describe* IAM permissions.

Args: resource_id: Specific resource ID (optional — omit for all rules summary) resource_type: AWS resource type e.g. 'AWS::EC2::Instance' (optional) compliance_filter: Filter by COMPLIANT, NON_COMPLIANT, or NOT_APPLICABLE

Inputs: resource_id, resource_type, compliance_filter. Returns: result

get_resource_costsA

Get resource cost attribution by namespace with optimization suggestions. Note: Requires Prometheus backend. Cost estimates are approximate.

Args: namespace: Filter by namespace (optional — omit for all namespaces) timeframe_minutes: Usage averaging window (1-1440)

Inputs: namespace, timeframe_minutes. Returns: result

get_resource_historyA

Get the full CloudTrail audit trail for a specific AWS resource. Shows who created, modified, and deleted it. Requires cloudtrail:LookupEvents IAM permission.

Args: resource_id: AWS resource ID or ARN timeframe_days: How many days back to search (1-90) limit: Maximum events to return (1-50)

Inputs: resource_id (required), limit, timeframe_days. Returns: result

get_scaling_historyA

Get HPA scaling history and current autoscaler status for deployments. Requires kube-state-metrics for historical data.

Args: namespace: Kubernetes namespace deployment_name: Filter to a specific deployment (optional) timeframe_minutes: How far back to look (1-1440)

Inputs: namespace, deployment_name, timeframe_minutes. Returns: result

get_traceA

Retrieve a distributed trace by ID from Tempo.

Args: trace_id: Hexadecimal trace ID (16-32 characters)

Inputs: trace_id (required). Returns: result

query_cloudtrailA

Search AWS CloudTrail events by keyword, event name, username, or resource. Requires cloudtrail:LookupEvents IAM permission.

Args: keyword: Search term matched against event name event_name: Exact CloudTrail event name (e.g. 'DeleteDeployment') username: Filter by IAM username or role session name resource_name: Filter by AWS resource name or ID timeframe_minutes: How far back to search (1-1440) limit: Maximum events to return (1-50)

Inputs: limit, keyword, username, event_name, +2 more. Returns: result

query_logs_customA

Execute a custom log query (LogQL for Loki, Datadog syntax, or CloudWatch Insights).

Args: query: Backend-native query string timeframe_minutes: How many minutes of logs to retrieve (1-1440) limit: Maximum number of log lines (1-500)

Inputs: query (required), limit, timeframe_minutes. Returns: result

query_pod_logsA

Query logs from a Kubernetes pod. Returns sanitized logs with PII/secrets redacted.

Args: pod_name: Pod name or regex pattern (e.g. 'payment-service' or 'payment-.*') namespace: Kubernetes namespace container: Container name filter (optional) timeframe_minutes: How many minutes of logs to retrieve (1-1440) limit: Maximum number of log lines (1-500)

Inputs: pod_name (required), limit, container, namespace, +1 more. Returns: result

query_prometheusA

Execute a raw PromQL query against Prometheus.

Args: query: PromQL expression range_query: Set to true for a time-series range query timeframe_minutes: Time range for range queries (1-1440) step: Step interval for range queries (e.g. '1m', '5m', '1h')

Inputs: query (required), step, range_query, timeframe_minutes. Returns: result

search_tracesA

Search for distributed traces in Tempo by service, operation, or tags.

Args: service_name: Filter by service name operation: Filter by operation name tags: Filter by span tags (key-value pairs) min_duration: Minimum trace duration (e.g. '100ms', '1s') max_duration: Maximum trace duration timeframe_minutes: How far back to search (1-1440) limit: Maximum traces to return (1-100)

Inputs: tags, limit, operation, max_duration, +3 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 23 tools

    Disambiguation4/5

    Most tools have clearly distinct targets—logs, metrics, traces, cluster health, AWS Config, CloudTrail, alerts—so an agent can usually pick correctly. A few pairs overlap in raw inputs or sources (query_pod_logs vs analyze_logs, query_cloudtrail vs get_resource_history), but the descriptions clarify the different purposes.

    Naming Consistency5/5

    All tools follow a consistent operation_object snake_case pattern: query_* for raw backend queries, get_* for fetching known telemetry, and search/analyze/build/enrich/check for higher-level analysis. There is no stylistic mixing or unpredictable naming.

    Tool Count4/5

    23 tools is on the high side, but the server covers Kubernetes logs, metrics, traces, events, alerts, SLOs, cost, and AWS audit/config/inspection data, so each tool has a distinct role. It feels slightly over-packed rather than bloated, and the breadth justifies the count.

    Completeness4/5

    The surface covers the full observability workflow: raw queries, pod logs, metrics, traces, cluster health, events, deployments, alerts, SLOs, cost, and AWS audit/config/compliance. The main gap is resource discovery—there is no explicit list_pods/list_namespaces tool, so agents must already know target names or infer them from other tools.

    Maintenance

    ActivityStale
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides a read-only interface to Kubernetes clusters, enabling LLMs to list pods, get pod status and logs, fetch deployment manifests, and perform pod health analysis with resource trend tracking.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Lets AI agents inspect Kubernetes clusters in plain English, exposing read-only tools for pods, deployments, services, events, and logs, with mock and real backend support.
      MIT