Running a local Model Context Protocol (MCP) server over stdio on a developer laptop takes two minutes. Moving that same MCP server into enterprise Kubernetes—where autonomous AI agents invoke internal databases, ticketing APIs, and cluster operations—introduces serious reliability and security challenges.

With MCP's transition toward a stateless core and enterprise Virtual MCP Gateways, production teams can now orchestrate MCP servers just like standard cloud-native microservices. Here is the production blueprint.

1. Move From stdio to Stateless Streamable HTTP

Avoid sticky sessions wherever possible. Stateless HTTP MCP servers scale horizontally behind standard Kubernetes Ingress or Gateway API load balancers, survive Pod restarts cleanly, and integrate directly with HorizontalPodAutoscaler (HPA).

2. Put a Virtual MCP / AI Gateway in Front

Never expose dozens of internal MCP tool endpoints directly to LLM clients. Aggregate them behind a single gateway layer that enforces:

  • Per-Tool RBAC & Identity Propagation: Map OAuth / OIDC user identities to least-privilege Kubernetes ServiceAccount tokens so an agent can never escalate beyond the caller's permissions.

  • Read-Only vs. Mutating Tool Separation: Require explicit human-in-the-loop approval or separate policy scopes for write/delete tools.

  • Structured Audit Logging: Log every tool call (caller_id, tool_name, sanitized arguments, latency, exit status) to your SIEM or OpenTelemetry pipeline.

  • Token & Rate Budgeting: Cap runaway agent loops before a single misbehaving workflow burns your monthly LLM budget—model expected spend with our LLM API Cost Calculator.

3. Hardened Kubernetes Deployment Pattern for MCP Servers

apiVersion: apps/v1 kind: Deployment metadata: name: ops-readonly-mcp namespace: ai-agents spec: replicas: 2 selector: matchLabels: app: ops-readonly-mcp template: metadata: labels: app: ops-readonly-mcp spec: serviceAccountName: mcp-readonly-sa automountServiceAccountToken: false securityContext: runAsNonRoot: true seccompProfile: type: RuntimeDefault containers: - name: mcp image: ghcr.io/your-org/ops-mcp:1.2.0 ports: - containerPort: 8080 resources: requests: cpu: "250m" memory: "256Mi" limits: cpu: "250m" memory: "256Mi" securityContext: allowPrivilegeEscalation: false readOnlyRootFilesystem: true capabilities: drop: ["ALL"] 

Production Readiness Checklist

Originally published at OpsHubs. Found it useful? Buy us a coffee ☕.