
opsgate
한국어
Let AI assistants help operate your clusters, without handing them a shell.
opsgate is an open-source MCP server written in Go. It gives clients such as
Claude, ChatGPT, Claude Code and Cursor a fixed set of operations tools for Kubernetes, with explicit policy, human-approved changes and
an audit log.
Status: early release; notes, the dev provider, watch and the analyzer are
experimental. Changes require user authorization, allowed targets and human approval. Read restrictions
and output redaction reduce sensitive data exposure. Third-party security review
is pending; the security policy explains the protections and
remaining limitations.
Why opsgate
No arbitrary commands
Only purpose-built tools exist. There is no shell
tool and no Kubernetes Secrets tool.
Everything starts off
Providers, write actions and allowlists are disabled
until you enable them in configuration.
Changes need a person
Write tools first plan the exact change, then wait
for human approval in the browser by default when web approval is available.
Optional approval windows are explained below.
Remote access is authenticated
A builtin OAuth 2.1 server works with
claude.ai and ChatGPT connectors. Sign in with passkeys, GitHub or OIDC
(Google included), or verify external JWTs.
Results are data for analysis
AI clients are instructed not to follow
instructions embedded in logs or other results. Returned results are redacted
and size-limited. The audit log records who called each tool and its outcome,
with one JSON object per line.
It remembers what happened
The optional note provider keeps runbooks and
past incidents in plain Markdown. Assistants are instructed to consult past
records and offer to record the outcome. See notes.
Alerts can arrive with an investigation
opsgate watch sends Kubernetes alerts directly to Discord, webhooks or email.
The optional analyzer then investigates with read-only tools and reports the
likely cause. For a failed image it can offer a restore link, which still needs a
person's approval. See watch alerts.
What it can do
Providers are groups of tools; enable only the groups you need.
| Provider |
Read tools |
Write tools (approval required) |
| Kubernetes |
clusters, overview, list, get, environment, service check, events, pod logs, remediation options |
rollout restart, scale, delete pod, restore a previous image |
| Notes: runbooks and memory, Markdown folder or Obsidian vault (experimental) |
search, read, list, recent, links, tags |
create, append, replace, move to .trash |
| Dev (experimental) |
projects, task status, log, diff, list |
start a coding agent (Codex or Claude) in a Git worktree; cancelling your own task needs no new approval |
Scopes define the kinds of work a user can perform through opsgate: ops:read for inspection,
ops:write for operations and note changes, and dev:run for coding-agent tasks.
Allowlists restrict tools and targets such as Kubernetes workloads.
A scope alone does not enable an operation prohibited by configuration.
Notes can be created only inside the configured notes folder. There is no tool
for creating general files at arbitrary server paths or changing Kubernetes CPU
and memory requests or limits. Those resource settings can be inspected with
Kubernetes detail tools. See the tool reference for arguments
and limits.
How it works
The AI client analyzes results and chooses the next operation. The opsgate MCP
server does not run or call an AI model; it checks and executes requested tools.
Only the optional, separate opsgate-analyzer calls a model you configure.
Kubernetes tools connect to the Kubernetes API using kubeconfig or in-cluster credentials.
A local instance can therefore inspect a remote cluster when network access
and permissions allow it.
Clients connect over local stdio (the client starts opsgate and communicates
through standard input/output) or HTTPS through a TLS reverse proxy. opsgate
checks identity and policy, plans and approves writes, then handles output and
auditing. OS accounts and Kubernetes RBAC constrain access to the providers.
Details: architecture · approval ·
authentication.
How approval works
Write tools first prepare a plan showing the target and change. By default,
a person reviews and approves it on a web approval page when web approval is
available. Explicit approval.require_web: false opts in to in-client elicitation;
a compromised client can then approve its own writes. External/static auth and
stdio keep elicitation because they have no web channel. An omitted require_web
also allows elicitation with -transport stdio for mode-based files; explicit
true denies stdio writes. One-call approval binds the exact arguments and plan.
Optional approval windows let a person approve a particular tool for a limited
time. During that window, subsequent calls by the same user can skip a new
approval prompt, including calls with different targets or arguments. Permission
and target checks still run on every call. Windows are disabled by default, and
k8s_restore_image never uses one.
Notes: runbooks and memory
With the note provider enabled, assistants are instructed to search past
incidents before acting and offer to record the outcome afterward. The AI client
decides whether to follow this guidance; it is not an enforced workflow. Note
changes require approval, and saved records can inform later investigations. See notes.
Quick start: local (stdio)
Download an archive from releases
after verifying it, or build
with Go 1.26 or later:
go install github.com/gkdis6/opsgate/cmd/opsgate@latest # or: make build
This go install builds only opsgate. The optional analyzer is the separate
command ./cmd/opsgate-analyzer.
Save a configuration using the current kubeconfig, for example /path/opsgate.yaml:
stdio:
scopes: [ops:read]
providers:
kubernetes:
enabled: true
namespaces: [default]
Register it with Claude Code (use absolute paths):
claude mcp add opsgate -- /path/to/opsgate -config /path/opsgate.yaml
Stdio runs with the permissions of the account that launches it. Run it
unprivileged. Other clients: client setup.
Quick start: remote (HTTP with passkeys)
Passkeys need no identity provider: people sign in with Face ID, Touch ID,
Windows Hello, a phone or a security key.
opsgate init asks for the public URL, who signs in and the namespaces, then writes
a short configuration:
opsgate init # writes opsgate.yaml; flags answer ahead, see -h
mode: kubernetes
http:
public_url: "https://mcp.example.com"
auth:
builtin:
users:
- subject: "passkey:alice"
scopes: [ops:read]
admins: ["passkey:alice"]
allowed_redirect_hosts: [claude.ai, chatgpt.com, localhost]
unknown_redirect_hosts: approve
providers:
kubernetes:
namespaces: ["*"]
deny_namespaces: ["kube-system", "kube-public", "kube-node-lease", "opsgate"]
allow_logs: true
The mode fills in the rest: HTTP on 0.0.0.0:8787,
builtin passkey sign-in, state in /var/lib/opsgate, browser approval links and
the pod’s ServiceAccount. opsgate config show -config opsgate.yaml prints every
effective value.
Put this file in the opsgate ConfigMap of deploy/kubernetes/opsgate-deployment.yaml and apply it. The manifest’s sample uses Google sign-in; passkeys do not need its optional opsgate-upstream Secret. Follow deployment for Secret provisioning, image verification, RBAC and probe configuration.
kubectl apply -f deploy/kubernetes/opsgate-deployment.yaml
- On first start, opsgate logs a one-time setup link (valid 24 hours) for each
user without a passkey. Open it and press Create passkey. Later links:
kubectl -n opsgate exec deploy/opsgate -- /opsgate passkey invite -config /etc/opsgate/opsgate.yaml -subject passkey:alice.
- Put a TLS ingress or reverse proxy in front that preserves the
Host header. The public
host must match public_url; other hosts get 421.
- Connect a client to
https://mcp.example.com/mcp, for example
claude mcp add --transport http opsgate https://mcp.example.com/mcp, or add
it as a connector in claude.ai or ChatGPT.
The generated file already limits client redirect hosts
(allowed_redirect_hosts); review them before exposing the server. GitHub, Google and other sign-in options are covered
in authentication. Proxy routes and
release verification are in deployment. Run opsgate -h to list
commands and flags.
Watch alerts
Run opsgate watch alongside the MCP server to receive Kubernetes problem and
change notifications. It watches the Kubernetes API and sends alerts directly
to Discord, custom JSON webhooks or SMTP email. n8n is optional.
Delivery configuration
Add the following to a configuration with the Kubernetes provider enabled:
watch:
problems_only: true # optional: warnings only
outputs:
- name: discord
type: discord
language: ko # ko or en
url_file: /etc/opsgate/discord-webhook-url
- name: custom
type: webhook
url: https://alerts.example.com/ingest
header_files:
Authorization: /etc/opsgate/alerts-authorization
body_template: |
{"message": {{json .Text}}, "sent_at": {{json .SentAt}}, "alerts": {{json .Alerts}}}
Keep the destinations you need. Store the Discord channel's incoming webhook URL
in url_file; the authorization file contains the full header value, such as
Bearer TOKEN. Files are read at startup, so restart watch after changing them.
In Kubernetes, mount these files from Secrets.
opsgate watch -config opsgate.yaml
watch.problems_only: true keeps warnings such as restarts, OOMKilled, image
pull failures and stalled rollouts. It drops change notices for every destination:
images, replicas, ConfigMap keys, objects added or removed, and node recovery. Set
it on one output to limit only that destination. Individual reasons cannot be
filtered.
Each destination has its own queue, cooldown and retries. Discord embeds include
UTC occurrence times, cluster, namespace/resource, reason and summary; long
batches are visibly truncated to fit Discord's limit. Custom templates use the
json helper to escape values and must produce valid JSON. Existing
watch.webhook_url and watch.email settings remain supported alongside outputs.
See watch alerts for delivery limits, HMAC signatures and all
configuration options.
Investigating an alert
Paste an alert into your MCP client with a request such as:
Investigate this alert using opsgate MCP. Check operational records, resource
status and events, and current and previous container logs. Separate confirmed
causes, hypotheses and checks that still need to be made.
The client's AI does the investigation with read tools. Available evidence depends
on enabled providers and access policy, and deleted Pods or expired logs and events
can prevent a conclusive diagnosis. Changes follow the usual approval process.
Automatic investigation (optional)
The separate, experimental opsgate-analyzer receives signed watch alerts, has a
model investigate through an allowlist of read-only MCP tools, and sends a report
to Discord. Alerts go out first; the report is a separate message, so analysis does
not delay them. It groups repeated alerts, enforces investigation limits, never
calls write tools and never executes its own proposals. Select an OpenAI-compatible
API or an installed Claude Code or Codex CLI with model.backend. Normal watch and
MCP use need no model.
Data leaves your cluster. Alert text and tool output, including logs and notes
the analyzer can read, go to the model provider you select, and reports go to
Discord and optionally a configured forward receiver. Alert string values are masked before JSON encoding for every model backend; reports are masked before either notification sink. Redaction cannot detect every secret. Allow
access only to data you intend those services to receive.
Report language and action proposals are set with report.language and
report.suggest_actions. See automatic investigation.
Restoring a failed image (optional)
Set restore_image (a namespace/deployment allowlist) and action_approval_url
on a Kubernetes cluster to enable this. For a Pod failing with ImagePullBackOff,
ErrImagePull or InvalidImageName, k8s_remediation_options returns an approval
link when a non-deleting ReplicaSet of the same Deployment has a ready owned Pod whose target container is ready and running the proposed image. Readiness does not guarantee application health, and image tags can change in the registry. The analyzer can attach the link to its report.
Opening the link needs sign-in and shows a fresh plan. Nothing changes until a
person approves, and the plan is checked again before the patch. Only that
container's image changes; configuration is not rolled back.
Security model in brief
- One instance is one trust group:
ops:read covers every enabled provider. Use
separate instances and OS accounts for things with different trust levels,
such as production operations, personal notes and coding agents.
- Permission checks stack: scopes, server tool policy, per-user tool lists,
provider allowlists, then OS permissions and Kubernetes RBAC.
- HTTP requires browser approval by default when
approval.web is enabled.
Explicit approval.require_web: false opts in to elicitation, allowing a
compromised client to approve its own writes; HTTP startup logs a warning.
- The optional analyzer sends alerts and the evidence it reads to the model provider
you select. Redaction reduces this exposure but does not guarantee it.
Full details: SECURITY.md.
Documentation
| Document |
Contents |
| Architecture |
Request flow, packages, design principles |
| Authentication |
Passkey, GitHub, OIDC, external JWT, static tokens, stdio |
| Approval |
Plan/apply, approval channels, approval windows |
| Client setup |
Claude Code, Claude Desktop, claude.ai, ChatGPT, Cursor |
| Configuration |
Every configuration key, defaults and audit log format |
| Tools |
Tool arguments, limits, redaction |
| Notes |
Runbooks and incident memory in a Markdown folder |
| Deployment |
Release verification, Kubernetes, reverse proxy |
| Dev provider |
Running coding agents through the separate runner |
| Watch alerts |
Kubernetes alerts to Discord, custom JSON webhooks and email through a separate opsgate watch process |
| Automatic investigation |
Optional model worker, read-only MCP authentication and investigation limits |
| Roadmap |
What is done and what may come |
Contributing and license
See CONTRIBUTING.md, the Code of Conduct
and changelog. Licensed under Apache-2.0,
copyright 2026 The opsgate Authors.