kubernetes-observability-mcp-server
Provides tools to pull live Dynatrace problems and correlate Davis AI alerts with Kubernetes events, and to retrieve entity health and metadata. It also ships OpenTelemetry traces, metrics, and logs to Dynatrace for self-monitoring via OTLP.
Provides tools for interacting with a Kubernetes cluster, including listing pods, fetching pod logs, describing pods and deployments, retrieving namespace events and health, and debugging networking (network policies, DNS config, CoreDNS health, ingress routing, service endpoints, orphaned services, service mesh configuration, and node network status).
kubernetes-observability-mcp-server
A production-grade Model Context Protocol (MCP) server that gives AI assistants (Claude, Cursor, Windsurf, etc.) direct, structured access to your Kubernetes cluster for operations, network debugging, and Dynatrace observability correlation — with full OpenTelemetry self-monitoring that ships traces, metrics, and logs to Dynatrace automatically.
What This Does
Instead of copy-pasting kubectl output into a chat window, this MCP server lets your AI assistant:
List pods, check logs, describe deployments — directly, without leaving the conversation
Debug network policies, DNS, ingress routing, and service mesh configuration
Pull live Dynatrace problems and correlate them with Kubernetes events
View its own performance in Dynatrace via OTel self-monitoring
Related MCP server: k8s-mcp-server
Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ AI Assistant (Claude Desktop / Cursor) │
│ MCP Client │
└────────────────────────────┬────────────────────────────────────────┘
│ stdio (JSON-RPC)
▼
┌─────────────────────────────────────────────────────────────────────┐
│ kubernetes-observability-mcp-server │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │
│ │ K8s Management │ │ Network Debugging│ │ Dynatrace │ │
│ │ │ │ │ │ Correlation │ │
│ │ • list_pods │ │ • analyze_ │ │ │ │
│ │ • get_pod_logs │ │ network_policy │ │ • get_dynatrace_ │ │
│ │ • describe_pod │ │ • check_service_ │ │ problems │ │
│ │ • list_ │ │ endpoints │ │ • correlate_ │ │
│ │ deployments │ │ • find_orphaned_ │ │ alerts_with_ │ │
│ │ • describe_ │ │ services │ │ k8s │ │
│ │ deployment │ │ • debug_dns_ │ │ • get_entity_ │ │
│ │ • get_namespace_ │ │ config │ │ health │ │
│ │ events │ │ • coredns_health_│ │ │ │
│ │ • get_namespace_ │ │ check │ │ │ │
│ │ health │ │ • inspect_ │ │ │ │
│ │ │ │ ingress_routing│ │ │ │
│ │ │ │ • trace_service_ │ │ │ │
│ │ │ │ to_pods │ │ │ │
│ │ │ │ • node_network_ │ │ │ │
│ │ │ │ status │ │ │ │
│ │ │ │ • check_service_ │ │ │ │
│ │ │ │ mesh_config │ │ │ │
│ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ withTelemetry() middleware (OTel wrapper) │ │
│ │ span per call • invocation counter • latency histogram │ │
│ └───────────────────────────┬─────────────────────────────────┘ │
└──────────────────────────────│──────────────────────────────────────┘
│ OTLP/HTTP
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Dynatrace │
│ Distributed Traces • Metrics Dashboard • Structured Logs │
└─────────────────────────────────────────────────────────────────────┘
▲
│ API v2 (problems, entities, metrics)
│
┌─────────┴───────────────────────────────────────────────────────────┐
│ Kubernetes Cluster (@kubernetes/client-node) │
│ ~/.kube/config or in-cluster ServiceAccount token │
└─────────────────────────────────────────────────────────────────────┘Prerequisites
Node.js 20+ —
node --versionmust show v20 or highernpm 9+ — comes with Node 20
kubectl configured — run
kubectl cluster-infoand confirm it shows your cluster; the server reads~/.kube/configby defaultDynatrace account — free trial at dynatrace.com works; Dynatrace tools are optional if you only want K8s features
Quick Start
# 1. Clone the repository
git clone https://github.com/mrafay7655/kubernetes-observability-mcp-server.git
cd kubernetes-observability-mcp-server
# 2. Install dependencies
npm install
# 3. Configure environment
cp .env.example .env
# Open .env in your editor and fill in the values (see "Environment Variables" below)
# 4. Build
npm run build
# 5. Verify the server starts (Ctrl+C to exit)
npm start
# Expected output: [mcp] kubernetes-observability-mcp-server running on stdioClaude Desktop Setup
Step 1 — Find your config file
OS | Path |
macOS |
|
Windows |
|
Linux |
|
Step 2 — Add the server entry
Open the config file and add (or merge) the mcpServers block:
{
"mcpServers": {
"kubernetes-observability": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/kubernetes-observability-mcp-server/dist/index.js"],
"env": {
"DT_ENV_URL": "https://YOUR_ENV_ID.live.dynatrace.com",
"DT_API_TOKEN": "dt0c01.YOUR_TOKEN_HERE",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://YOUR_ENV_ID.live.dynatrace.com/api/v2/otlp",
"OTEL_EXPORTER_OTLP_HEADERS": "Authorization=Api-Token dt0c01.YOUR_TOKEN_HERE",
"OTEL_SERVICE_NAME": "kubernetes-observability-mcp-server"
}
}
}
}Replace /ABSOLUTE/PATH/TO/ with the full path to the cloned repository.
Windows path example:
"args": ["C:\\Users\\YourName\\Projects\\kubernetes-observability-mcp-server\\dist\\index.js"]macOS/Linux path example:
"args": ["/Users/yourname/projects/kubernetes-observability-mcp-server/dist/index.js"]Step 3 — Restart Claude Desktop
Fully quit Claude Desktop (system tray → Quit) and reopen it.
Step 4 — Verify tools are loaded
In a new conversation, click the + button (or the connectors icon) in the chat input bar. You should see kubernetes-observability listed under Integrations or Connected tools. If it shows a connection error, check that the path in args is correct and that npm run build has been run.
Step 5 — Test
Type: List pods in the default namespace
The assistant will call list_pods and return results from your cluster.
Claude Code (CLI) Setup
# Add to your user-level MCP config (persists across projects)
claude mcp add -s user kubernetes-observability \
node /absolute/path/to/dist/index.js \
-e DT_ENV_URL=https://YOUR_ENV_ID.live.dynatrace.com \
-e DT_API_TOKEN=dt0c01.YOUR_TOKEN
# Verify it was added
claude mcp list
# Test a tool call
claude "list all pods in the kube-system namespace"Environment Variables
Variable | Required | Description |
| Yes (for DT tools) | Your Dynatrace environment base URL, e.g. |
| Yes (for DT tools) | API token — must start with |
| No | OTLP endpoint for self-monitoring telemetry |
| No | Auth header: |
| No | Service name in Dynatrace (default: |
| No | Service version tag (default: |
| No |
|
| No | Override kubeconfig path (default: |
K8s-only mode (no Dynatrace): Leave DT_ENV_URL and DT_API_TOKEN unset. All 17 Kubernetes and network tools work without them; only the 3 Dynatrace tools will return an error.
Dynatrace Setup
Creating an API Token
Open your Dynatrace environment:
https://YOUR_ENV_ID.live.dynatrace.comGo to Settings → Integration → Dynatrace API → API tokens
Click Generate new token
Name it
kubernetes-observability-mcp-serverEnable the following scopes:
Scope | Purpose |
| Send custom metrics via OTLP |
| Send structured logs via OTLP |
| Send distributed traces via OTLP |
| Read Davis AI problems |
| Read entity health and metadata |
| Query service metrics (optional — not available on all plans) |
Note: If your Dynatrace plan does not include
metrics.read, skip it. Theget_entity_healthtool gracefully falls back and returns entity metadata without metrics.
Copy the generated token — it will not be shown again.
Verify Your Token Type
Your token must start with dt0c01. — this is an API token.
Tokens starting with dt0s are personal access tokens and will return 401.
OTLP Endpoint Format
https://YOUR_ENV_ID.live.dynatrace.com/api/v2/otlpThe server appends /v1/traces, /v1/metrics, and /v1/logs automatically.
Running Inside a Kubernetes Cluster
To run the server as a Pod inside the cluster (instead of from your laptop), create a ServiceAccount with appropriate RBAC:
apiVersion: v1
kind: ServiceAccount
metadata:
name: mcp-server
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: mcp-server-reader
rules:
- apiGroups: [""]
resources: ["pods", "pods/log", "services", "endpoints", "events", "namespaces", "nodes", "configmaps"]
verbs: ["get", "list"]
- apiGroups: ["apps"]
resources: ["deployments"]
verbs: ["get", "list"]
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies", "ingresses", "ingressclasses"]
verbs: ["get", "list"]
- apiGroups: ["discovery.k8s.io"]
resources: ["endpointslices"]
verbs: ["get", "list"]
- apiGroups: ["networking.istio.io", "security.istio.io"]
resources: ["virtualservices", "destinationrules", "peerauthentications"]
verbs: ["get", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: mcp-server-reader
subjects:
- kind: ServiceAccount
name: mcp-server
namespace: default
roleRef:
kind: ClusterRole
name: mcp-server-reader
apiGroup: rbac.authorization.k8s.ioTools Reference
Tool | Description | Category | Required Permissions |
| List pods in a namespace with status, readiness, and restart counts | Kubernetes |
|
| Fetch logs from a pod (max 1,000 lines) | Kubernetes |
|
| Full pod description: DNS policy, containers, IPs, conditions | Kubernetes |
|
| List deployments with replica counts and conditions | Kubernetes |
|
| Describe a deployment with full container specs | Kubernetes |
|
| K8s events filtered by type or reason (max 200) | Kubernetes |
|
| Health score rollup — pod counts, warnings, overall status | Kubernetes |
|
| Which NetworkPolicies apply to a pod and their risk | Network |
|
| Detect services with no ready backends | Network |
|
| Services whose selectors match no running pods | Network |
|
| CoreDNS health, Corefile config, pod DNS policy | Network |
|
| CoreDNS pod status and restart rate | Network |
|
| IngressClass validation and backend endpoints | Network |
|
| Full path: Service → EndpointSlices → Pods → NetworkPolicies | Network |
|
| Node NetworkUnavailable conditions, PodCIDR allocations | Network |
|
| Istio/Linkerd detection, VirtualServices, mTLS mode | Network |
|
| Dynatrace Davis AI problems, filtered by namespace | Dynatrace |
|
| Correlate Dynatrace alerts with K8s events | Dynatrace |
|
| Dynatrace entity metrics — response time, error rate | Dynatrace |
|
Troubleshooting
Server not appearing in Claude Desktop
Confirm the path in
argsis absolute and the file exists:node /path/to/dist/index.jsCheck for JSON syntax errors in
claude_desktop_config.jsonFully quit and restart Claude Desktop (menu bar → Quit, not just close the window)
CONNECT_TIMEOUT in Claude Code
The server may time out if the OTLP endpoint is unreachable on startup. Ensure OTEL_EXPORTER_OTLP_ENDPOINT points to a valid Dynatrace URL, or leave it unset to disable telemetry.
401 Unauthorized from Dynatrace tools
Token must start with
dt0c01.— personal access tokens (dt0s) are rejectedVerify
problems.readandentities.readscopes are enabled on the token
kubectl / kubeconfig errors
Run
kubectl get podsfrom the same terminal to confirm kubeconfig is validSet
KUBECONFIG=/path/to/configif your config is not at the default location
Tool returns empty results
Kubernetes namespaces default to
"default"— specifynamespaceif your resources are elsewhereCheck
kubectl get pods -n YOUR_NAMESPACEdirectly to confirm resources exist
Security
No credentials in source code — all secrets are loaded from environment variables
No exec or shell commands — uses the
@kubernetes/client-nodelibrary API directly; nokubectlsubprocessRead-only by default — all tools only read cluster state; no writes, no deletes
Input validation — namespace names, event types, entity names, and entity types are validated before being used in API calls
Log limits —
get_pod_logsis capped at 1,000 lines regardless of the requested valueNever commit
.env—.gitignoreexcludes it; rotate any token that was committed
Contributing
Contributions are welcome! Areas for improvement:
Additional Kubernetes resource support (StatefulSets, DaemonSets, Jobs)
Dynatrace SLO querying tool
Prometheus metrics integration
Helm release inspection tool
Kubernetes events streaming
Please open an issue first to discuss major changes.
License
MIT License — see LICENSE for details.
Available Tools
19 toolsanalyze_network_policyA
Analyze which NetworkPolicies apply to a pod and detect traffic restrictions
Inputs: pod_name (required), namespace.
check_service_endpointsB
Check if service endpoints are ready — detects services with no ready backends
Inputs: namespace, service_name.
check_service_mesh_configB
Inspect Istio/Linkerd mesh config — VirtualServices, mTLS mode, sidecar injection status
Inputs: namespace.
coredns_health_checkA
Quick CoreDNS health check — pod status, replica count, restart rate
Inputs: no named parameters.
correlate_alerts_with_k8sC
Correlate Dynatrace alerts with Kubernetes events in a time window
Inputs: time_to, namespace, time_from.
debug_dns_configB
Debug DNS — checks CoreDNS health, Corefile config, and pod DNS policy
Inputs: pod_name, namespace.
describe_deploymentB
Describe a deployment with full container specs and rollout conditions
Inputs: name (required), namespace.
describe_podB
Full pod description including DNS policy, network config, containers, and conditions
Inputs: name (required), namespace.
find_orphaned_servicesB
Find services whose label selectors match no running pods
Inputs: namespace.
get_dynatrace_problemsB
Fetch Dynatrace Davis AI problems, optionally filtered by Kubernetes namespace
Inputs: status, namespace, time_from.
get_entity_healthC
Get Dynatrace health metrics for a service/entity — response time, error rate
Inputs: entity_name (required), entity_type.
get_namespace_eventsB
Get Kubernetes events filtered by type or reason — great for spotting OOMKills, BackOffs
Inputs: limit, reason, namespace, event_type.
get_namespace_healthB
Health score rollup for a namespace — pod counts, warnings, overall status
Inputs: namespace.
get_pod_logsB
Fetch logs from a pod container with optional tail line limit
Inputs: name (required), container, namespace, tail_lines.
inspect_ingress_routingB
Validate ingress routing — IngressClass existence, backend service endpoints
Inputs: namespace, ingress_name.
list_deploymentsB
List deployments with replica counts and conditions
Inputs: namespace.
list_podsB
List pods in a namespace with status, readiness, and restart counts
Inputs: namespace, label_selector.
node_network_statusA
Check network status of all nodes — NetworkUnavailable conditions, PodCIDR allocations
Inputs: no named parameters.
trace_service_to_podsB
Trace full path: Service → EndpointSlices → Pods → NetworkPolicies
Inputs: service_name (required), namespace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools target a distinct resource+action (list_pods vs describe_pod vs get_pod_logs, namespace events vs namespace health), so selection is generally clear. The main overlap is between debug_dns_config and coredns_health_check, which both cover CoreDNS pod health and could be confused, and the service trio (find_orphaned_services, check_service_endpoints, trace_service_to_pods) sits close together though descriptions differentiate them.
17 of 19 tools follow a verb_noun pattern (list_pods, get_pod_logs, describe_deployment, check_service_endpoints, trace_service_to_pods). Only coredns_health_check and node_network_status break the pattern with noun-first phrasing, a minor deviation that stays readable.
19 tools covers a genuinely broad surface (pods, deployments, events, DNS, network policy, ingress, mesh, Dynatrace), so each largely earns its place. It sits at the heavy end of the comfortable range, and the near-duplicate CoreDNS pair is the one spot that looks like padding.
The observability/network-debugging niche is well covered: pods, deployments, logs, events, health rollups, DNS, ingress, mesh, and Dynatrace correlation. Noticeable gaps are a plain list_services, basic node listing beyond node_network_status, and resource-usage metrics (CPU/memory) that agents would expect from an observability server, though most are workable around via describe commands.
Maintenance
Related MCP Connectors
The Google GKE MCP server is a managed Model Context Protocol server that provides AI applications with tools to manage Google Kubernetes Engine (GKE) clusters and Kubernetes resources. It exposes a structured, discoverable interface that allows AI agents to interact with GKE and Kubernetes APIs, enabling them to inspect cluster configurations, retrieve Kubernetes resource YAMLs, monitor operations like cluster upgrades, diagnose issues, and optimize costs—all without needing to parse text output or use complex kubectl commands.
MCP server for building and testing AI agents with multi-model experimentation and insights.
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI assistants to interact with Kubernetes clusters by translating natural language into kubectl and Helm operations. It allows users to query, manage, and diagnose Kubernetes resources and cluster states through a seamless integration.20Apache 2.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets AI assistants safely inspect and operate on Kubernetes clusters through natural conversation.13 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceAn open source MCP server empowering SREs with intelligent observability, predictive analytics, and AI-driven automation across Kubernetes, OpenShift, and Tekton environments.78 PyPI11Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA powerful Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to Dynatrace's observability platform. Features dual authentication architecture, Davis CoPilot AI integration, and 24 specialized tools for monitoring, automation, and operational intelligence.23 npm5MIT