k8s-telemetry-mcp
Supports Datadog as a backend for querying logs and metrics in place of Loki and Prometheus.
Provides read-only access to the Kubernetes API, enabling queries about cluster events, deployments, scaling history, node pressure, and resource usage.
Enables querying Prometheus metrics using PromQL for pod metrics, cluster health, SLO status, and alert enrichment.
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.
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 AWSThe 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:3200Label 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 execlocally. Ensurekubectlis in yourPATHand 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 logs from a pod or regex pattern. PII/secrets auto-redacted. |
| Execute a raw LogQL / Datadog / CloudWatch Insights query. |
Metrics
Tool | Description |
| CPU, memory, restarts, network for a pod. |
| Execute a raw PromQL query (instant or range). |
| Node count, pod status, CPU/memory utilization snapshot. |
Traces
Tool | Description |
| Retrieve a full distributed trace by ID from Tempo. |
| Search traces by service, operation, tags, or duration. |
Analytics
Tool | Description |
| Pattern detection, error categorization, and recommendations. |
| Correlate logs, metrics, and traces into a chronological timeline. |
| Full context for a firing alert: logs + metrics + traces + suggestions. |
| Cost attribution by namespace with optimization suggestions. |
| Error budget, burn rate, and SLO compliance status. |
Kubernetes
Tool | Description |
| Events for a namespace or pod — answers OOMKilled/Pending/CrashLoop questions. |
| HPA scaling history and current autoscaler status. |
| Node MemoryPressure, DiskPressure, PIDPressure, and eviction status. |
| What was rolled out in the last N minutes. |
| Recent alerts and active silences from Alertmanager. |
AWS
Tool | Description |
| Search CloudTrail events by keyword, event name, user, or resource. |
| Full audit trail for a specific AWS resource ID or ARN. |
| AWS Config compliance status — drift and non-compliant rules. |
| What actually changed on a resource, with field-level before/after diffs. |
| ECR image vulnerability findings via Inspector v2 or basic scan. |
| RDS Performance Insights and ElastiCache CloudWatch metrics. |
Configuration
All settings use the MCP_ prefix:
Variable | Default | Description |
|
| Loki endpoint |
|
| Prometheus endpoint |
|
| Tempo endpoint |
|
| Alertmanager endpoint |
|
| Alertmanager endpoint (required for |
|
| AWS region for CloudTrail/Config/ECR/RDS tools |
|
| Datadog API key (overrides Loki/Prometheus) |
|
| CloudWatch log group (overrides Loki) |
|
| Auto-redact PII and secrets |
|
| Max log lines per query |
|
| Max query time range |
|
| 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:execaccess to the pod is equivalent to read access to your telemetry, so restrict it accordingly.RBAC: A scoped
ClusterRolegrantsget/liston events, nodes, deployments, replicasets, and HPAs. Nowatch, no wildcards, nosecrets, nopods/exec, nopods/log.NetworkPolicy: Restricts egress to your observability stack, DNS, and — only when the AWS tools are enabled — outbound HTTPS. Set
networkPolicy.allowAwsApiEgress=falseto 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.serverThe 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.serverBefore 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.
License
Apache License 2.0 — see LICENSE for details.
Support
Issues: GitHub Issues
Documentation: GitHub Wiki
Email: hello@kubeopsai.net
Available Tools
23 toolsanalyze_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
Scored across 23 tools
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.
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.
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.
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
Related MCP Connectors
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI assistants with direct access to Red Hat OpenShift AI observability data, enabling querying of Prometheus metrics, Alertmanager alerts, Loki logs, Grafana dashboards, and Kubernetes cluster state to troubleshoot vLLM inference workloads.5MIT
- AlicenseBqualityBmaintenanceEnables AI agents to execute read-only DevOps operations including kubectl, terraform, helm, docker, and AWS cost analysis through natural language.11MIT
- FlicenseNot gradedqualityDmaintenanceProvides 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.-
- AlicenseNot gradedqualityDmaintenanceLets 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