Field Guides / MCP for DevOps Engineers
Field Guide · Intermediate · 10-12 hours with labsMCP for DevOps Engineers
Build, test and secure an MCP server that gives AI assistants safe, read-only access to Kubernetes, GitHub and Terraform plans.




91
pages
pages
11
hands-on labs
hands-on labs
20
interview Q&As
interview Q&As
13
chapters
chapters
This is for you if
- You're a DevOps, platform or SRE engineer asked to connect an AI assistant to real infrastructure
- You want to review third-party MCP servers instead of trusting their README
- You're preparing for platform or AI-infrastructure interviews where MCP comes up
- You know Python, kubectl and basic Terraform, and want the security story right
What's inside
- How MCP really works on the wire: hosts, clients, servers, JSON-RPC, and the stateless 2026-07-28 revision
- stdio vs Streamable HTTP, DNS rebinding protection, and running stateless behind a load balancer
- A complete Python server on the official SDK 2.x with Kubernetes, GitHub and Terraform-plan tools
- Least-privilege RBAC, fine-grained GitHub tokens and plan-only Terraform with destroy detection
- OAuth resource-server auth: protected resource metadata, audience checks, per-tool scopes
- Testing with pytest, the MCP Inspector web UI and a CI smoke test with contract snapshots
- Tool poisoning, prompt injection through tool results, over-broad tokens and supply-chain risks
- Production patterns: container, Kubernetes manifests, audit logging, gateways and safe write tools
- A troubleshooting playbook, 20 interview Q&As, a dense cheat sheet and a 30-day plan
After this guide you can
- Explain MCP's architecture and both protocol eras clearly in a design review or interview
- Build and test a read-only MCP server with typed tools, resources and prompts
- Lock it down with allowlists, Kubernetes RBAC, scoped tokens and bearer-token auth
- Recognise and mitigate tool poisoning and prompt injection in a real deployment
- Deploy it to Kubernetes with health checks, audit logs and a CI contract test
- Debug a broken MCP integration layer by layer
Contents
- The mental modelp. 4
- Transports and the wirep. 11
- Designing tools, resources and promptsp. 16
- Building the server: Kubernetes toolsp. 23
- GitHub and Terraform-plan toolsp. 36
- Testing and connecting clientsp. 45
- Auth and least privilegep. 54
- Security: tool poisoning, prompt injection and over-broad tokensp. 62
- Production patterns and the checklistp. 67
- Troubleshooting playbookp. 75
- Interview questionsp. 78
- Cheat sheetp. 85
- 30-day practice planp. 89
Written by Randy, a Senior Platform Engineer & SRE who runs production platforms on AWS, GCP and Azure. Companion to the Techworld with Randy episode MCP for DevOps Engineers.