ops-agent-mcp
Reads Kubernetes pod status, events, logs, and allowlisted resource objects; can propose and, after human CLI approval, apply bounded rollout restarts or scaling changes.
Reads firing and pending Prometheus alerts and runs capped instant PromQL queries.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
ops-agent-mcp
An MCP server that lets an AI agent (any MCP client) help with on-call. It can investigate Kubernetes and Prometheus on its own. It can only change something after a human approves that exact change, outside the agent's reach.
This is the pattern I run in production for a team on-call assistant: let the model read everything it needs, keep every write behind a person.
Tools the agent gets
Tool | Kind | What it does |
| read | Firing and pending Prometheus alerts, newest first |
| read | Instant PromQL, capped at |
| read | One line per pod: phase, ready, restarts, waiting reason ( |
| read | Namespace events, newest first |
| read | Log tail (max 2,000 lines), optionally the previous crashed container |
| read | Objects as JSON from an allowlist of kinds, |
| propose |
|
| read | Where a proposal stands |
| write | Runs an approved change once. Anything not approved, expired, rejected or already used is refused |
There is deliberately no approve tool. Approval lives only in the CLI:
$ ops-agent-mcp pending
3f9a1c2e: rollout_restart(namespace=shop, deployment=api) - workers stuck after config reload [pending]
$ ops-agent-mcp approve 3f9a1c2e
3f9a1c2e: rollout_restart(namespace=shop, deployment=api) - workers stuck after config reload [pending]
approved by istvanRelated MCP server: mimiops-mcp
Guardrails
Namespace allowlists for reads (
OPS_AGENT_READ_NAMESPACES) and writes (OPS_AGENT_WRITE_NAMESPACES, empty by default, so a fresh install is read-only).Bounded actions: only restart and scale, replicas capped by
OPS_AGENT_MAX_REPLICAS.Approvals expire (
OPS_AGENT_APPROVAL_TTL, 15 minutes) and run once.Audit log: every tool call, proposal, decision and result goes to
audit.jsonlin the state directory (ops-agent-mcp audit).Tool annotations: read tools are marked read-only and
apply_changedestructive, so MCP clients can ask for confirmation on their side too.Errors come back as
{"error": ...}the model can read, not as stack traces.
Run it
pip install .
export KUBECONFIG=~/.kube/config
export OPS_AGENT_PROMETHEUS_URL=http://127.0.0.1:9090
export OPS_AGENT_READ_NAMESPACES=s3-slo-probe,storage,monitoring
export OPS_AGENT_WRITE_NAMESPACES=s3-slo-probe
ops-agent-mcp serveMCP client config (mcp.json or your client's equivalent):
{
"mcpServers": {
"ops": {
"command": "ops-agent-mcp",
"args": ["serve"],
"env": {
"OPS_AGENT_PROMETHEUS_URL": "http://127.0.0.1:9090",
"OPS_AGENT_READ_NAMESPACES": "s3-slo-probe,storage,monitoring",
"OPS_AGENT_WRITE_NAMESPACES": "s3-slo-probe"
}
}
}
}k8s-platform-lab gives you a cluster with Prometheus and the s3-slo-probe SLO alerts to try it on: break the S3 gateway, then ask the agent why the error budget is burning.
Tests
pip install -e '.[dev]'
pytest -q && ruff check . && mypy srcRun against k8s-platform-lab over a real stdio MCP session, the agent saw the S3ProbeErrorBudgetSlowBurn alert left by an injected S3 outage, read the probe's metrics and pods, was refused Secrets and namespaces outside the allowlist, proposed a restart, was refused until ops-agent-mcp approve ran, restarted the deployment once, and was refused a second time.
The tests cover the guarantees, not only the happy path: no tool can approve, Secrets cannot be read, an approval runs once, approvals expire, rejected changes never run, writes outside the allowlist are refused, and a full propose → human approve (CLI) → apply round trip through the MCP tool interface.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Read-only finance and operations controls for AI agents with evidence and safe next actions.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI agents to inspect and operate a Kubernetes cluster safely, with read-only mode and namespace allowlist for mutations.1029 PyPI2MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to safely observe and troubleshoot Kubernetes workloads, with limited recovery actions like pod deletion and Helm rollbacks, while preventing dangerous modifications.18Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to safely interact with Kubernetes clusters through scoped, redacted tools, with credentials kept local and write operations requiring human approval.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to perform safe, auditable Kubernetes write actions such as scaling, restarting and rolling back Deployments through a plan → policy-check → approve → apply → audit flow, with server-side guards, single-use plans and scoped RBAC. Read-only planning and Prometheus SLO/alert tools support the same guarded workflow.Apache 2.0