MCPContainerServer

The MCPContainerServer resource defines containerized MCP servers running in your cluster.

Purpose

Use MCPContainerServer to:

  • Run MCP servers as containers in your cluster
  • Use STDIO transport for direct pod communication
  • Manage server lifecycle alongside your gateway

Example

apiVersion: mcp-gateway.ohcs.io/v1alpha1
kind: MCPContainerServer
metadata:
  name: github
  namespace: default
spec:
  gatewayRef:
    name: my-gateway
  path: /github
  transport: stdio
  template:
    spec:
      containers:
      - name: mcp-server
        image: ghcr.io/github/github-mcp-server
        envFrom:
        - secretRef:
            name: github-credentials
        resources:
          limits:
            memory: "256Mi"
            cpu: "500m"

Key Fields

spec.gatewayRef

Reference to the MCPGateway that will route to this server.

spec.path

URL path on the gateway for this server.

spec.transport

Transport type:

  • stdio - STDIO transport (gateway attaches to pod stdin/stdout)
  • http - HTTP transport (container exposes HTTP endpoint)

spec.template

Pod template specification. Uses the same structure as Kubernetes PodSpec.

Transport Types

STDIO Transport

For STDIO transport, the gateway attaches to the container’s stdin/stdout:

sequenceDiagram
    participant Client
    participant Gateway
    participant Pod

    Client->>Gateway: MCP Request
    Gateway->>Pod: kubectl attach
    Gateway->>Pod: stdin: request
    Pod->>Gateway: stdout: response
    Gateway->>Client: MCP Response

HTTP Transport

For HTTP transport, the gateway proxies to the container’s HTTP endpoint:

spec:
  transport: http
  port: 8080
  template:
    spec:
      containers:
      - name: mcp-server
        image: my-mcp-server:latest
        ports:
        - containerPort: 8080