Claude Ops Investigator
Enables read-only Kubernetes incident investigation through MCP tools for listing pods, describing resources, fetching logs, and searching runbooks.
README
Claude Ops Investigator
A context-aware Kubernetes incident investigation assistant built with Claude Code, MCP, live cluster signals, Prometheus, log search, runbooks, evidence memory, and structured incident reports.
Claude Ops Investigator helps engineers investigate Kubernetes incidents safely by combining read-only operational tools, external evidence storage, compact investigation memory, and human-controlled remediation boundaries.
The goal is not to give an AI unrestricted production access. The goal is to expose narrow, auditable, read-only interfaces that help engineers gather evidence, form hypotheses, rule out causes, and produce reliable incident reports faster.
What this project provides
- Narrow MCP-style tools instead of generic
kubectl - Read-only live Kubernetes investigation
- Claude Code project instructions
- MCP resources, tools, and prompts
- Skills, slash commands, and scoped project rules
- Coordinator/subagent-style investigation workflows
- Structured tool errors
- Hooks and gates for destructive actions
- Structured incident-report output
- Human escalation for risky or ambiguous actions
Safety rule
Start read-only. Do not give Claude unrestricted shell, kubectl, Helm, or production mutation permissions.
Allowed operations in this scaffold:
kubectl getkubectl describekubectl logskubectl top
Blocked operations include:
kubectl deletekubectl applykubectl patchkubectl scalekubectl rollout restarthelm upgradekubectl execby default
Quick start
cd claude-ops-investigator
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
Check Kubernetes access:
kubectl config current-context
kubectl auth can-i get pods -n si
kubectl auth can-i get pods/log -n si
Run a read-only snapshot:
python -m claude_ops.main investigate --namespace si --service event-data --since-minutes 60
Run tests:
pytest
Claude Code slash command
The main interactive workflow is the /investigate-incident slash command:
/investigate-incident namespace=<namespace> service=<service> symptom="<specific symptom>" since_minutes=<minutes>
symptom is required — this workflow is symptom-driven, not a generic
service health check. If no symptom is given, Claude asks for one before
investigating anything.
Examples:
/investigate-incident namespace=si service=multi-system-processor symptom="readiness probe failures during recent rollout" since_minutes=60
/investigate-incident namespace=si service=event-data symptom="KafkaConsumerCommitRateLow alert fired" since_minutes=120
/investigate-incident namespace=si service=multi-system-processor symptom="OOMKilled restarts observed" since_minutes=180
What it does:
- Delegates to the
incident-coordinatorsubagent (falls back to a single agent, with that fallback stated explicitly, only if subagents aren't available) - The coordinator reads the service catalog and runbook catalog, then routes
the symptom to the narrowest relevant specialist subagents:
k8s-evidence-collector— pod listing, describe, live logs, namespace events, current resource usageprometheus-analyst— restart counts/increase, CPU, memory, HTTP error rate, latency p95log-analyst— historical IBM Cloud Logs search (errors, probe failures, arbitrary text) spanning restarts/deploymentsrunbook-analyst— matches the symptom against local runbooks
- Every specialist stores raw evidence as an
evidence_refand hands back only summaries/findings — the coordinator never gathers evidence directly incident-reporterruns last, synthesizing all subagents' findings (never its own) into a single evidence-grounded, schema-valid report- The final output includes a "Subagent usage audit" table: which subagent ran, what it did, which tools/evidence_refs it used, and its result
What it does not do:
- Does not mutate Kubernetes resources
- Does not restart pods
- Does not apply fixes
- Does not run destructive commands
- Does not fetch raw evidence detail unless needed
Environment for optional tools
Prometheus:
PROMETHEUS_URLPROMETHEUS_AUTO_PORT_FORWARDPROMETHEUS_PF_SERVICEPROMETHEUS_PF_NAMESPACE
IBM Cloud Logs:
IBM_LOGS_ENDPOINTIBM_CLOUD_API_KEY
Copy .env.example to .env and fill in local values. Never commit .env.
The MCP server loads it automatically at startup so these tools have access
without any secrets going into .mcp.json.
No-token local tests
These exercise the tools and structured error paths without any real Prometheus, IBM Cloud, or Kubernetes credentials:
python -m pytest
python scripts/mcp_smoke_client.py
Direct tool checks:
python - <<'PY'
from claude_ops.tools.prometheus_preflight import ensure_prometheus
import json
print(json.dumps(ensure_prometheus(), indent=2))
PY
python - <<'PY'
from claude_ops.tools.ibm_logs_tools import ibm_logs_search_errors
import json
print(json.dumps(ibm_logs_search_errors("si", "multi-system-processor", limit=1), indent=2))
PY
Local environment
The MCP server needs environment variables for the optional Prometheus and
IBM Cloud Logs tools (PROMETHEUS_URL, IBM_LOGS_ENDPOINT,
IBM_CLOUD_API_KEY, etc.). Configure them locally with a .env file — it is
gitignored and loaded automatically, no secrets ever need to go in
.mcp.json.
cp .env.example .env
# edit .env with your local values
source .venv/bin/activate
claude
src/claude_ops/mcp/server.py calls load_dotenv() at startup, so the MCP
server picks up .env automatically when Claude Code launches it — no
manual export needed. Missing .env is fine; tools that need a variable
that still isn't set return a structured config error instead of failing
silently.
Recommended first live use
Use a non-production namespace first.
python -m claude_ops.main investigate --namespace si --service multi-system-processor --since-minutes 120
Then paste the generated JSON snapshot into Claude/Claude Code and ask it to produce an incident report using the schema in src/claude_ops/schemas/incident_report_schema.py.
MCP client/server map
In this project:
Claude Code = MCP client
src/claude_ops/mcp/server.py = local MCP server
.mcp.json = project-level MCP client configuration for Claude Code
Start the MCP server manually for a quick syntax check:
python -m claude_ops.mcp.server
For Claude Code, keep .mcp.json in the project root. Claude Code reads the config and launches the server over STDIO.
Optional smoke test:
pip install -e ".[dev,mcp]"
python scripts/mcp_smoke_client.py
The MCP server exposes:
Resources:
ops://runbook-catalogops://service-catalog
Tools:
k8s_list_podsk8s_describe_podk8s_get_pod_logsk8s_get_recent_namespace_eventsk8s_top_podsrunbook_searchprom_query_instantprom_get_pod_restart_countsprom_get_pod_restart_increaseprom_get_pod_cpu_usageprom_get_pod_memory_usageprom_get_http_error_rateprom_get_latency_p95prom_ensure_connectionibm_logs_searchibm_logs_search_errorsibm_logs_search_probe_failuresibm_logs_search_textevidence_get_detail
Prompt:
investigate_incident
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.