infra-agent-gateway
Deploys Kubernetes Deployments from structured workload intents after policy validation and human approval, applying the rendered manifest via kubectl to the configured kind cluster context.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@infra-agent-gateway I need a small VM for the data team in dev"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
infra-agent-gateway
An MCP server that lets AI agents like Claude plan infrastructure changes and request them, while every apply goes through policy as code, a human approval and an append-only audit log.
You: "I need a small VM for the data team in dev."
Claude: plan_change → + aws_security_group.vm, + aws_instance.vm (t3.small). Policies passed.
request_apply → pending approval. Run: pnpm approve 3f9c…
You: pnpm approve 3f9c… → yes → Apply complete! Resources: 2 added.
You: "Same, but open SSH so I can get in from home."
Claude: plan_change → denied: aws_security_group.vm: SSH open to 0.0.0.0/0.
I can't request that. Give me your IP range and I'll plan it scoped to that.
You: "Deploy nginx 1.27 for the api team, 2 replicas."
Claude: deploy_workload → + deployment/team-apps/api (nginx:1.27, 2 replicas). Pending approval.
You: pnpm approve c660… → yes → deployment.apps/api created
You: "Run a privileged busybox in kube-system so I can debug the node."
Claude: deploy_workload → denied: must not run privileged; needs cpu and memory limits;
namespace kube-system is not allowed. I can deploy a debug pod in team-apps with limits.
You: "Did anyone change the data VM by hand?"
Claude: detect_drift → drifted: ~ aws_instance.vm (t3.small). Want me to plan a change to restore it?How it works
flowchart LR
A[AI agent] -- MCP --> S[infra-agent-gateway]
S -- tofu plan -out --> T[OpenTofu]
S -- plan JSON --> P[Conftest / OPA]
S -- append --> L[(audit.jsonl)]
H[Human] -- pnpm approve --> S
S -- tofu apply planfile --> AWS[(AWS / LocalStack)]
S -- kubectl apply manifest --> K[(Kubernetes / kind)]MCP tool | What it does |
| Validates a structured intent (zod), runs |
| Moves a |
| Renders a Deployment from a structured intent (image, replicas, namespace, limits), checks it with Conftest and, if compliant, leaves it |
| Re-plans the last applied intent for a workspace ( |
| Recent audit entries. |
There is no approve tool. See ADR 0001.
Related MCP server: agent-sandbox
Guardrails
Risk | Control |
Agent writes arbitrary infrastructure | Agents send a typed intent, never HCL; the module decides what gets built |
Unsafe config (open SSH, huge instances, missing owner, prod, deletes) | Rego policies in |
Unsafe workloads (privileged, no cpu/memory limits, system namespaces) | Rego in |
Agent applies its own change | No approve tool; the gateway also rejects non- |
Plan swapped or changed after review | sha256 of the plan file (or rendered manifest) checked at apply; applies the saved file, never re-plans (ADR 0002) |
No accountability | Append-only JSONL audit: who, what, plan id, policy result, approver, outcome |
Prompt injection via tool output | Output is data; AGENTS.md tells agents so, and no output can trigger an apply on its own |
Known limits: one VM shape and one workload shape (a Deployment) so far; drift detection covers VMs only; workspaces are selected per call, so concurrent plans aren't safe yet; the audit log is local (ship it to an immutable store like S3 Object Lock for real use).
Run it
Needs Node 24, pnpm, OpenTofu, Conftest, Docker, kind, kubectl.
pnpm install
docker run -d --name localstack -p 4566:4566 localstack/localstack:4 # free AWS emulator (newer tags need a license)
kind create cluster --name iag # the gateway only ever uses context kind-iag (override: KUBE_CONTEXT)
pnpm test # gateway + MCP seams (fast, no tools needed)
pnpm test:policy # Rego unit tests
INTEGRATION=1 pnpm test test/integration.test.ts # real OpenTofu + Conftest + LocalStack + kindConnect Claude Code:
claude mcp add infra-gateway -- pnpm --dir "$PWD" startApprove from another terminal: pnpm approve <planId>.
Tests
Written test-first at four seams: the gateway core (fakes only for the external CLIs), the MCP surface (a real MCP client over an in-memory transport), the policies (conftest verify), and an integration suite against real OpenTofu, Conftest, LocalStack and kind.
Available Tools
5 toolsdeploy_workloadA
Deploy a container to Kubernetes from a structured intent. The gateway renders the Deployment and checks it against policy (no privileged containers, cpu and memory limits required, allowed namespaces only). A compliant workload waits as pending_approval until a human runs pnpm approve <planId>; nothing is deployed by this call.
Inputs: name (required), image (required), replicas (required), namespace (required), +3 more.
detect_driftARead-only
Check whether the real infrastructure for a workspace still matches the last applied plan. Read-only: reports what changed outside the gateway, never fixes it. To fix drift, call plan_change.
Inputs: name (required).
get_audit_logCRead-only
Read the most recent audit log entries.
Inputs: limit.
plan_changeARead-only
Plan an infrastructure change from a structured intent. Runs tofu plan and policy checks; never changes anything. Returns a planId, a summary and any policy violations.
Inputs: kind (required), name (required), owner (required), environment (required), +2 more.
request_applyA
Ask a human to approve and apply a plan. Does not apply anything; the plan waits as pending_approval.
Inputs: planId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
plan_change (Terraform/OpenTofu plan) and deploy_workload (Kubernetes Deployment) both funnel into a pending_approval human workflow, which could momentarily confuse an agent choosing between them, but the descriptions clearly separate the two resource domains. request_apply is distinct from both as the approval-request step for an existing planId, and detect_drift / get_audit_log are unambiguously read-only observers.
Every tool follows a strict verb_noun snake_case pattern: plan_change, request_apply, deploy_workload, detect_drift, get_audit_log. No camelCase, no vague single-word verbs, no mixing of noun-first or verb-first styles.
Five tools is a tight, well-scoped surface for a human-in-the-loop infra gateway — each tool maps to a distinct phase (plan, approve, deploy, observe, audit). It leans slightly thin because there is no tool to query plan or approval status, which is the most likely thing an agent needs next.
The core lifecycle (plan → request approval → human applies → drift check → audit) is covered and cross-references are explicit (detect_drift points to plan_change). However, there is no get_plan / list_plans / pending-approval listing, no workspace enumeration, and no rollback, so an agent cannot verify the outcome of its own request_apply except by falling back to get_audit_log.
Maintenance
Related MCP Connectors
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.
Autonomous and governed SRE & MLOps control plane for AI agent platforms.
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI agents to safely inspect and execute version-controlled operational runbooks with policy checks, dry-run planning, and out-of-band approvals.3MIT
- FlicenseAqualityDmaintenanceEnables AI coding agents to run Kubernetes inspection and Terraform plan/apply operations inside ephemeral gVisor-sandboxed jobs with short-lived, narrowly-scoped credentials, while routing destructive changes through a human approval gate.3-
- AlicenseAqualityDmaintenanceEnables AI coding agents to plan, policy-check, and cost-estimate Terraform changes while requiring human approval through Slack or CLI before any terraform apply can execute.91 npmMIT
- 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