Basic configuration patterns for MCP servers.
- Overview
- Configuration by Environment
- Transport Configuration
- Resource Sizing
- Service Exposure
- Best Practices
MCPServer resources can be configured for different use cases from development to production. This guide provides practical patterns for common scenarios.
For advanced configuration (HPA, security contexts, affinity, Kustomize), see the Advanced Configuration Guide.
See Quick Start for minimal development configuration.
Configuration for pre-production testing:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-staging
namespace: staging
spec:
image: "myregistry/mcp-server:v1.2.0"
# Multiple replicas for testing HA
replicas: 2
# Explicit protocol for consistency
transport:
type: http
protocol: streamable-http
config:
http:
port: 8080
path: "/mcp"
sessionManagement: true
# Production-like resources
resources:
requests:
cpu: "200m"
memory: "256Mi"
limits:
cpu: "1000m"
memory: "1Gi"
# Info logging
environment:
- name: LOG_LEVEL
value: "info"
- name: ENVIRONMENT
value: "staging"
# Enable metrics collection
metrics:
enabled: true
port: 9090
# Strict validation in staging
validation:
enabled: true
strictMode: true
requiredCapabilities:
- "tools"
- "resources"For full production configuration with HPA, security contexts, and pod affinity, see the Advanced Configuration Guide.
Let the operator detect the protocol automatically:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-auto
spec:
image: "mcp/server:latest"
transport:
type: http
protocol: auto # Prefers Streamable HTTP over SSE
config:
http:
port: 8080
# Path will be auto-detected
# Tries /mcp first, then /sseForce Streamable HTTP protocol (MCP 2025-03-26+):
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-streamable
spec:
image: "mcp/modern-server:latest"
transport:
type: http
protocol: streamable-http
config:
http:
port: 8080
path: "/mcp"
sessionManagement: trueForce Server-Sent Events protocol (MCP 2024-11-05):
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-sse
spec:
image: "mcp/wikipedia-mcp:latest"
command: ["python", "-m", "wikipedia_mcp"]
args: ["--transport", "sse", "--port", "3001", "--host", "0.0.0.0"]
transport:
type: http
protocol: sse
config:
http:
port: 3001
path: "/sse"For detailed transport information, see Transport Protocols.
Use auto when:
- You're not sure which protocol your server supports
- Your server supports multiple protocols
- You want the operator to handle protocol selection
Use streamable-http when:
- You know your server uses modern Streamable HTTP
- You want to ensure only Streamable HTTP is used
- You're deploying new MCP servers (recommended)
Use sse when:
- You're working with legacy MCP servers
- Your server only supports SSE
- You need compatibility with older MCP clients
Suitable for development, testing, or low-traffic services:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-small
spec:
image: "myregistry/mcp-server:latest"
replicas: 1
resources:
requests:
cpu: "100m" # 0.1 CPU cores
memory: "128Mi" # 128 megabytes
limits:
cpu: "500m" # 0.5 CPU cores
memory: "512Mi" # 512 megabytesCharacteristics:
- Single replica or 2 for basic HA
- Minimal resource usage
- Suitable for <10 requests/second
Suitable for production services with moderate traffic:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-medium
spec:
image: "myregistry/mcp-server:latest"
replicas: 3
resources:
requests:
cpu: "200m" # 0.2 CPU cores
memory: "256Mi" # 256 megabytes
limits:
cpu: "1000m" # 1 CPU core
memory: "1Gi" # 1 gigabyte
# Optional: Enable HPA
hpa:
enabled: true
minReplicas: 3
maxReplicas: 10
targetCPUUtilizationPercentage: 70Characteristics:
- 3+ replicas for high availability
- Moderate resource allocation
- Can handle 10-100 requests/second
- HPA recommended for traffic spikes
See Advanced Configuration Guide for large-scale deployments with HPA.
Internal cluster access only:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-clusterip
spec:
image: "myregistry/mcp-server:latest"
service:
type: ClusterIP # Default
port: 8080Use case: Services accessed only from within the cluster.
Access via node IP and static port:
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-nodeport
spec:
image: "myregistry/mcp-server:latest"
service:
type: NodePort
port: 8080
# Kubernetes assigns a port in range 30000-32767Use case: Development/testing with direct node access.
Cloud load balancer (AWS/GCP/Azure):
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: mcp-loadbalancer
spec:
image: "myregistry/mcp-server:latest"
service:
type: LoadBalancer
port: 8080
annotations:
# AWS
service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
# GCP
cloud.google.com/load-balancer-type: "Internal"
# Azure
service.beta.kubernetes.io/azure-load-balancer-internal: "true"Use case: Production external access with cloud provider integration.
Begin with minimal configuration and add complexity as requirements grow:
# Start with this
apiVersion: mcp.mcp-operator.io/v1
kind: MCPServer
metadata:
name: my-server
spec:
image: "myregistry/mcp-server:latest"
# Add features gradually:
# - Resource limits
# - HPA
# - Security contexts
# - Pod affinityPrevent resource exhaustion:
resources:
requests: # Guaranteed resources
cpu: "200m"
memory: "256Mi"
limits: # Maximum resources
cpu: "1000m"
memory: "1Gi"Ensure Kubernetes can monitor server health:
healthCheck:
enabled: true
path: "/health"
port: 8080Catch issues early:
validation:
enabled: true
strictMode: true # Fail deployment if validation fails
requiredCapabilities:
- "tools"
- "resources"Never hardcode credentials:
environment:
- name: API_KEY
valueFrom:
secretKeyRef:
name: mcp-secrets
key: api-keyAvoid latest tag in production:
# Good
image: "myregistry/mcp-server:v1.2.0"
# Bad for production
image: "myregistry/mcp-server:latest"Enable metrics collection via the metrics sidecar:
metrics:
enabled: true
port: 9090 # Metrics endpoint portSee Monitoring Guide for details.
- Advanced Configuration - HPA, security, affinity, Kustomize
- API Reference - Complete field documentation
- Environment Variables Guide - Environment variable configuration
- Transport Protocols - Protocol details
- Troubleshooting Guide - Common issues and solutions
- Configuration Examples - Real-world YAML examples