Demo Server
MCP (Model Context Protocol) SDK Demo Servers
Ask AI about Demo Server
Powered by Claude Β· Grounded in docs
I know everything about Demo Server. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
MCP (Model Context Protocol) SDK Demo Servers
This project provides two simple MCP servers (in Go and Python) using the official SDKs.
Repository Structure
mcp-demo-server/
βββ go-server/ # Go implementation
β βββ main.go # Server code
β βββ go.mod # Go dependencies
β βββ Dockerfile # Docker build file
β βββ cmd/
β βββ testclient/ # MCP test client (Go)
β βββ main.go # Test client code
βββ python-server/ # Python implementation
β βββ mcp_server.py # Server code
β βββ requirements.txt # Python dependencies
β βββ Dockerfile # Docker build file
β βββ cmd/
β βββ testclient/ # MCP test client (Python)
β βββ testclient.py # Test client code
βββ k8s/ # Kubernetes manifests
β βββ go-server-deployment.yaml # Go server Deployment & Service
β βββ python-server-deployment.yaml # Python server Deployment & Service
β βββ ingress.yaml # Optional Ingress configuration
βββ helm/ # Helm charts
β βββ mcp-server-go/ # Go server Helm chart
β β βββ Chart.yaml # Chart metadata
β β βββ values.yaml # Default values
β β βββ templates/ # Kubernetes templates
β βββ mcp-server-python/ # Python server Helm chart
β βββ Chart.yaml # Chart metadata
β βββ values.yaml # Default values
β βββ templates/ # Kubernetes templates
βββ README.md # This file
Each server exposes the following tools for testing the MCP protocol:
echotest: Echoes back the provided messagetimeserver: Returns the current time with optional IANA timezone support (e.g., "Europe/Kyiv", "America/New_York")fetch: Fetches content from any HTTP/HTTPS URL with optional size limit
HTTP Endpoints
When running in HTTP mode, both servers expose the following endpoints:
| Endpoint | Purpose | Method | Response |
|---|---|---|---|
/mcp | MCP Streamable HTTP endpoint | GET/POST/DELETE | Streamable HTTP transport for MCP protocol (MCP spec 2025-03-26) |
/health | Health check | GET | JSON status: {"status":"ok","service":"...","version":"v1.1.0"} |
/healthz | Health check (K8s style) | GET | JSON status: {"status":"ok","service":"...","version":"v1.1.0"} |
The health check endpoints (/health and /healthz) are designed for:
- Kubernetes liveness and readiness probes
- Load balancer health checks
- Monitoring systems
- Quick service status verification
Transport Protocol: Both servers use the modern Streamable HTTP transport (MCP specification 2025-03-26) which provides:
- Single unified
/mcpendpoint for all operations - Stateful session management with
Mcp-Session-Idheader - Session affinity support for production deployments
- 30-minute session timeout for idle connections
CLI Alignment
Both servers support consistent command-line arguments:
| Argument | Go Server | Python Server | Description |
|---|---|---|---|
--mode | stdio | http | stdio | http | Transport mode |
--host | default: 0.0.0.0 | default: 0.0.0.0 | Bind address |
--port | default: 8080 | default: 8080 | Listen port |
Transport Modes:
- Go:
stdio(default, local) orhttp(Streamable HTTP for network) - Python:
stdio(default, local) orhttp(Streamable HTTP for network)
Testing Clients
Because these servers use the real MCP protocol, you need an MCP client to test them. You have two options:
Option 1: Built-in Test Clients (Recommended)
This repository includes test clients in both Go and Python that support both servers.
Go Test Client
Build:
cd go-server
go build -o testclient ./cmd/testclient
Usage:
# Single command mode
./testclient -tool echotest -args '{"message":"Hello"}' -url http://localhost:8080/mcp
./testclient -tool timeserver -args '{"timezone":"Europe/Kyiv"}' -url http://localhost:8080/mcp
./testclient -tool fetch -args '{"url":"https://ifconfig.co/json","max_bytes":1024}' -url http://localhost:8080/mcp
# Interactive mode
./testclient -i -url http://localhost:8080/mcp
Python Test Client
Setup:
cd python-server
# Ensure dependencies are installed (mcp package required)
source venv/bin/activate # if using venv
pip install -r requirements.txt
Usage:
# Single command mode
python3 cmd/testclient/testclient.py -tool echotest -args '{"message":"Hello"}' -url http://localhost:8080/mcp
python3 cmd/testclient/testclient.py -tool timeserver -args '{"timezone":"Europe/Kyiv"}' -url http://localhost:8080/mcp
python3 cmd/testclient/testclient.py -tool fetch -args '{"url":"https://ifconfig.co/json","max_bytes":1024}' -url http://localhost:8080/mcp
# Interactive mode
python3 cmd/testclient/testclient.py -i -url http://localhost:8080/mcp
Interactive Mode Commands
Both clients support the same interactive commands:
help,h,?- Show available commandslist,ls- List available tools on the serverecho <message>- Test echotest tooltime [timezone]- Test timeserver toolfetch <url> [max_bytes]- Test fetch toolquit,exit,q- Exit
Option 2: Official mcp-cli
You can also use the official MCP CLI tool:
go install github.com/modelcontextprotocol/mcp-cli@latest
(Ensure your Go bin directory, e.g., ~/go/bin, is in your $PATH)
1. Go (Golang) Server
Location: go-server/
Files:
main.go(Server Code)go.mod/go.sum(Dependencies)Dockerfile(Docker Build File)
Build and Run (Locally)
-
Navigate to the Go server directory:
cd go-server -
Install dependencies (if needed):
go mod download -
Run the Server:
Stdio mode (default):
go run . # Server: mcp-server-demo-go running in stdio modeHTTP mode (Streamable HTTP for network access):
go run . --mode=http --host=0.0.0.0 --port=8080 # Server: mcp-server-demo-go v1.1.0 starting... # Transport: Streamable HTTP (MCP spec 2025-03-26) # Server listening on 0.0.0.0:8080
Test (Locally)
For HTTP mode:
The server exposes multiple endpoints. You can verify the server is running:
# Test health check endpoint
curl http://localhost:8080/health
# Should return: {"status":"ok","service":"mcp-server-demo-go","version":"v1.1.0"}
# Test Kubernetes-style health check
curl http://localhost:8080/healthz
# Should return: {"status":"ok","service":"mcp-server-demo-go","version":"v1.1.0"}
# Test MCP endpoint (Streamable HTTP transport)
curl -X GET http://localhost:8080/mcp
# MCP protocol communication (requires proper MCP client)
To interact with the MCP server, use an MCP-compatible client that supports Streamable HTTP transport:
- The built-in test clients (Go/Python) included in this repository
- The official MCP SDKs with Streamable HTTP support (Go SDK v1.1.0+, Python SDK v1.21.2+)
- Custom clients implementing the MCP Streamable HTTP specification (2025-03-26)
Example with built-in Go test client:
cd go-server
./testclient -i -url http://localhost:8080/mcp
Example with MCP Go SDK:
import "github.com/modelcontextprotocol/go-sdk/mcp"
transport := &mcp.StreamableClientTransport{
Endpoint: "http://localhost:8080/mcp",
MaxRetries: 3,
}
session, err := client.Connect(ctx, transport, nil)
For stdio mode: Use with MCP clients that support stdio transport (like the official mcp-cli with command transport)
Dockerize
-
Build the Docker Image:
cd go-server docker build -t mcp-server-demo-go:latest . -
Run the Docker Container (HTTP mode - default):
docker run -d -p 8080:8080 --name go-mcp mcp-server-demo-go:latest # Server runs in HTTP mode (Streamable HTTP transport) by default in Docker -
Verify the container is running:
docker logs go-mcp # Should show: # mcp-server-demo-go v1.1.0 starting... # Transport: Streamable HTTP (MCP spec 2025-03-26) # Server listening on 0.0.0.0:8080 curl http://localhost:8080/health # Should return: {"status":"ok","service":"mcp-server-demo-go","version":"v1.1.0"} -
Run in stdio mode (if needed):
docker run -it --name go-mcp mcp-server-demo-go:latest --mode=stdio -
Stop/Remove:
docker stop go-mcp && docker rm go-mcp
2. Python Server
Location: python-server/
Files:
mcp_server.py(Server Code)requirements.txt(Dependencies)Dockerfile(Docker Build File)
Build and Run (Locally)
-
Navigate to the Python server directory:
cd python-server -
Create a Virtual Environment (recommended):
python3 -m venv venv source venv/bin/activate -
Install Dependencies:
pip install -r requirements.txt -
Run the Server:
Stdio mode (default):
python3 mcp_server.py # Output: INFO - mcp-server-demo-python running in stdio modeHTTP mode (Streamable HTTP for network access):
python3 mcp_server.py --mode=http --host=0.0.0.0 --port=8080 # Output: # INFO - mcp-server-demo-python v1.1.0 starting... # INFO - Transport: Streamable HTTP (MCP spec 2025-03-26) # INFO - Server listening on 0.0.0.0:8080
Test (Locally)
For HTTP mode:
The server exposes multiple endpoints. You can verify the server is running:
# Test health check endpoint
curl http://localhost:8080/health
# Should return: {"status":"ok","service":"mcp-server-demo-python","version":"v1.1.0"}
# Test Kubernetes-style health check
curl http://localhost:8080/healthz
# Should return: {"status":"ok","service":"mcp-server-demo-python","version":"v1.1.0"}
# Test MCP endpoint (Streamable HTTP transport)
curl -X GET http://localhost:8080/mcp
# MCP protocol communication (requires proper MCP client)
To interact with the MCP server, use an MCP-compatible client that supports Streamable HTTP transport:
- The built-in test clients (Go/Python) included in this repository
- The official MCP SDKs with Streamable HTTP support (Go SDK v1.1.0+, Python SDK v1.21.2+)
- Custom clients implementing the MCP Streamable HTTP specification (2025-03-26)
Example with built-in Python test client:
cd python-server
python3 cmd/testclient/testclient.py -i -url http://localhost:8080/mcp
Example with MCP Python SDK:
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
async with streamablehttp_client("http://localhost:8080/mcp") as (read, write):
async with ClientSession(read, write) as session:
await session.initialize()
result = await session.call_tool("timeserver", arguments={})
print(result)
For stdio mode: Use with MCP clients that support stdio transport (like the official mcp-cli with command transport)
Dockerize
-
Build the Docker Image:
cd python-server docker build -t mcp-server-demo-python:latest . -
Run the Docker Container (HTTP mode - default):
docker run -d -p 8080:8080 --name py-mcp mcp-server-demo-python:latest # Server runs in HTTP mode (Streamable HTTP transport) by default in Docker -
Verify the container is running:
docker logs py-mcp # Should show: # INFO - mcp-server-demo-python v1.1.0 starting... # INFO - Transport: Streamable HTTP (MCP spec 2025-03-26) # INFO - Server listening on 0.0.0.0:8080 curl http://localhost:8080/health # Should return: {"status":"ok","service":"mcp-server-demo-python","version":"v1.1.0"} -
Run in stdio mode (if needed):
docker run -it --name py-mcp mcp-server-demo-python:latest --mode=stdio -
Stop/Remove:
docker stop py-mcp && docker rm py-mcp
3. Production Deployment
This section covers building production-ready Docker images and deploying to Kubernetes.
Docker Image Build for Production
Building and Tagging Images
For production deployments, it's recommended to use semantic versioning and push images to a container registry.
Go Server:
cd go-server
# Set version and registry configuration
VERSION=v1.1.0
REGISTRY_USER=yourusername # For Docker Hub
# REGISTRY=gcr.io/your-project-id # For GCR
# REGISTRY=123456789012.dkr.ecr.us-east-1.amazonaws.com # For ECR
# Build with version tag
docker build -t mcp-server-demo-go:${VERSION} -t mcp-server-demo-go:latest .
# Tag for your container registry
# For Docker Hub:
docker tag mcp-server-demo-go:${VERSION} ${REGISTRY_USER}/mcp-server-demo-go:${VERSION}
docker tag mcp-server-demo-go:latest ${REGISTRY_USER}/mcp-server-demo-go:latest
# For Google Container Registry (GCR) or Amazon ECR:
# docker tag mcp-server-demo-go:${VERSION} ${REGISTRY}/mcp-server-demo-go:${VERSION}
# docker tag mcp-server-demo-go:latest ${REGISTRY}/mcp-server-demo-go:latest
Python Server:
cd python-server
# Set version and registry configuration
VERSION=v1.1.0
REGISTRY_USER=yourusername # For Docker Hub
# REGISTRY=gcr.io/your-project-id # For GCR
# REGISTRY=123456789012.dkr.ecr.us-east-1.amazonaws.com # For ECR
# Build with version tag
docker build -t mcp-server-demo-python:${VERSION} -t mcp-server-demo-python:latest .
# Tag for your container registry
# For Docker Hub:
docker tag mcp-server-demo-python:${VERSION} ${REGISTRY_USER}/mcp-server-demo-python:${VERSION}
docker tag mcp-server-demo-python:latest ${REGISTRY_USER}/mcp-server-demo-python:latest
# For Google Container Registry (GCR) or Amazon ECR:
# docker tag mcp-server-demo-python:${VERSION} ${REGISTRY}/mcp-server-demo-python:${VERSION}
# docker tag mcp-server-demo-python:latest ${REGISTRY}/mcp-server-demo-python:latest
Pushing to Container Registry
Docker Hub:
# Login to Docker Hub
docker login
# Push images
docker push ${REGISTRY_USER}/mcp-server-demo-go:${VERSION}
docker push ${REGISTRY_USER}/mcp-server-demo-go:latest
docker push ${REGISTRY_USER}/mcp-server-demo-python:${VERSION}
docker push ${REGISTRY_USER}/mcp-server-demo-python:latest
Google Container Registry (GCR):
# Authenticate with GCR
gcloud auth configure-docker
# Push images
docker push ${REGISTRY}/mcp-server-demo-go:${VERSION}
docker push ${REGISTRY}/mcp-server-demo-go:latest
docker push ${REGISTRY}/mcp-server-demo-python:${VERSION}
docker push ${REGISTRY}/mcp-server-demo-python:latest
Amazon ECR:
# Set AWS region
AWS_REGION=us-east-1
# Authenticate with ECR
aws ecr get-login-password --region ${AWS_REGION} | docker login --username AWS --password-stdin ${REGISTRY}
# Create repositories if they don't exist
aws ecr create-repository --repository-name mcp-server-demo-go --region ${AWS_REGION}
aws ecr create-repository --repository-name mcp-server-demo-python --region ${AWS_REGION}
# Push images
docker push ${REGISTRY}/mcp-server-demo-go:${VERSION}
docker push ${REGISTRY}/mcp-server-demo-go:latest
docker push ${REGISTRY}/mcp-server-demo-python:${VERSION}
docker push ${REGISTRY}/mcp-server-demo-python:latest
Kubernetes Deployment
This project includes ready-to-use Kubernetes manifests in the k8s/ directory.
Prerequisites
-
Kubernetes cluster - You can use:
- Local: Minikube, Kind, Docker Desktop with Kubernetes
- Cloud: GKE, EKS, AKS, or any other Kubernetes cluster
-
kubectl - Kubernetes CLI tool configured to access your cluster
-
Container images - Either:
- Use local images (for Minikube/Kind with
imagePullPolicy: IfNotPresent) - Push images to a registry and update image references in manifests
- Use local images (for Minikube/Kind with
Deployment Manifests Overview
The k8s/ directory contains:
go-server-deployment.yaml- Go server Deployment and Servicepython-server-deployment.yaml- Python server Deployment and Serviceingress.yaml- Optional Ingress for external access
Each deployment includes:
- 2 replicas for high availability
- Health checks (liveness and readiness probes)
- Resource limits (CPU and memory)
- Security context (non-root user, dropped capabilities)
- ClusterIP Service for internal cluster communication
Step-by-Step Deployment
1. Prepare your cluster:
For local testing with Minikube:
# Start Minikube
minikube start
# Load local images into Minikube (if not using a registry)
minikube image load mcp-server-demo-go:latest
minikube image load mcp-server-demo-python:latest
For Kind:
# Create Kind cluster
kind create cluster --name mcp-demo
# Load local images into Kind (if not using a registry)
kind load docker-image mcp-server-demo-go:latest --name mcp-demo
kind load docker-image mcp-server-demo-python:latest --name mcp-demo
2. Update image references (if using a registry):
Edit the manifest files to use your registry images:
# Set your registry and version
REGISTRY_USER=yourusername
VERSION=v1.1.0
# For go-server-deployment.yaml, change:
# image: mcp-server-demo-go:latest
# to:
# image: ${REGISTRY_USER}/mcp-server-demo-go:${VERSION}
# For python-server-deployment.yaml, change:
# image: mcp-server-demo-python:latest
# to:
# image: ${REGISTRY_USER}/mcp-server-demo-python:${VERSION}
Or use sed to update:
cd k8s
sed -i "s|mcp-server-demo-go:latest|${REGISTRY_USER}/mcp-server-demo-go:${VERSION}|g" go-server-deployment.yaml
sed -i "s|mcp-server-demo-python:latest|${REGISTRY_USER}/mcp-server-demo-python:${VERSION}|g" python-server-deployment.yaml
3. Deploy to Kubernetes:
# Deploy Go server
kubectl apply -f k8s/go-server-deployment.yaml
# Deploy Python server
kubectl apply -f k8s/python-server-deployment.yaml
# Optional: Deploy Ingress (requires Ingress controller)
kubectl apply -f k8s/ingress.yaml
4. Verify deployments:
# Check deployment status
kubectl get deployments
kubectl get pods
kubectl get services
# Wait for pods to be ready
kubectl wait --for=condition=ready pod -l app=mcp-server-demo-go --timeout=60s
kubectl wait --for=condition=ready pod -l app=mcp-server-demo-python --timeout=60s
# Check pod logs
kubectl logs -l app=mcp-server-demo-go
kubectl logs -l app=mcp-server-demo-python
Expected output:
NAME READY STATUS RESTARTS AGE
mcp-server-demo-go-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
mcp-server-demo-go-xxxxxxxxxx-xxxxx 1/1 Running 0 30s
mcp-server-demo-python-xxxxxxxxxx-xxxx 1/1 Running 0 30s
mcp-server-demo-python-xxxxxxxxxx-xxxx 1/1 Running 0 30s
Testing Kubernetes Deployments
Method 1: Port Forwarding (Quick Test)
# Forward Go server port
kubectl port-forward svc/mcp-server-demo-go 8080:8080
# In another terminal, test the server
curl http://localhost:8080/health
# Should return 200 OK
# Test with built-in test client
cd go-server
./testclient -tool timeserver -args '{}' -url http://localhost:8080/mcp
# Forward Python server port (use a different local port)
kubectl port-forward svc/mcp-server-demo-python 8081:8080
# Test Python server
curl http://localhost:8081/health
cd python-server
python3 cmd/testclient/testclient.py -tool timeserver -args '{}' -url http://localhost:8081/mcp
Method 2: From within the cluster (create a test pod)
# Create a temporary test pod
kubectl run test-client --image=curlimages/curl:latest -it --rm --restart=Never -- sh
# Inside the pod, test the services
curl http://mcp-server-demo-go:8080/health
curl http://mcp-server-demo-python:8080/health
Method 3: Using Ingress (External Access)
If you deployed the Ingress:
# Get Ingress address
kubectl get ingress
# For Minikube, enable Ingress addon
minikube addons enable ingress
# Get Minikube IP
minikube ip
# Test with Ingress (update /etc/hosts to point domain to Minikube IP)
# Add line: <minikube-ip> mcp-demo.example.com mcp-go.example.com mcp-python.example.com
curl http://mcp-go.example.com/health
curl http://mcp-python.example.com/health
# Or use the test clients
./testclient -tool timeserver -args '{}' -url http://mcp-go.example.com/mcp
Method 4: Interactive Testing
# Port forward and use interactive mode
kubectl port-forward svc/mcp-server-demo-go 8080:8080
# In another terminal
cd go-server
./testclient -i -url http://localhost:8080/mcp
# Interactive commands:
mcp> list
mcp> echo Hello from Kubernetes!
mcp> time Europe/Kyiv
mcp> fetch https://ifconfig.co/json 1024
Health Checks and Monitoring
Check pod health:
# View pod status and ready state
kubectl get pods -l app=mcp-server-demo-go -o wide
kubectl get pods -l app=mcp-server-demo-python -o wide
# Describe pod to see health check results
kubectl describe pod -l app=mcp-server-demo-go | grep -A 5 "Liveness\|Readiness"
# View events
kubectl get events --sort-by=.metadata.creationTimestamp
Check resource usage:
# View resource consumption
kubectl top pods -l app=mcp-server-demo-go
kubectl top pods -l app=mcp-server-demo-python
# View resource limits
kubectl describe deployment mcp-server-demo-go | grep -A 5 "Limits\|Requests"
Scaling Deployments
# Scale Go server to 3 replicas
kubectl scale deployment mcp-server-demo-go --replicas=3
# Scale Python server to 3 replicas
kubectl scale deployment mcp-server-demo-python --replicas=3
# Verify scaling
kubectl get pods -l app=mcp-server-demo-go
kubectl get pods -l app=mcp-server-demo-python
# Auto-scaling (HPA - requires metrics-server)
kubectl autoscale deployment mcp-server-demo-go --cpu-percent=70 --min=2 --max=10
kubectl autoscale deployment mcp-server-demo-python --cpu-percent=70 --min=2 --max=10
Updating Deployments
# Update to a new version
NEW_VERSION=v1.1.0
kubectl set image deployment/mcp-server-demo-go mcp-server=${REGISTRY_USER}/mcp-server-demo-go:${NEW_VERSION}
kubectl set image deployment/mcp-server-demo-python mcp-server=${REGISTRY_USER}/mcp-server-demo-python:${NEW_VERSION}
# Check rollout status
kubectl rollout status deployment/mcp-server-demo-go
kubectl rollout status deployment/mcp-server-demo-python
# Rollback if needed
kubectl rollout undo deployment/mcp-server-demo-go
kubectl rollout undo deployment/mcp-server-demo-python
# View rollout history
kubectl rollout history deployment/mcp-server-demo-go
Troubleshooting
Pods not starting:
# Check pod status
kubectl get pods -l app=mcp-server-demo-go
# View pod events and logs
kubectl describe pod <pod-name>
kubectl logs <pod-name>
# Common issues:
# - Image pull errors: Check image name and registry authentication
# - CrashLoopBackOff: Check logs for application errors
# - Pending: Check resource availability (CPU/memory)
Health checks failing:
# Check endpoint manually from within cluster
kubectl run test --image=curlimages/curl -it --rm --restart=Never -- curl -I http://mcp-server-demo-go:8080/sse
# Adjust health check timing if needed (edit deployment)
kubectl edit deployment mcp-server-demo-go
# Increase initialDelaySeconds or failureThreshold
Service not accessible:
# Verify service endpoints
kubectl get endpoints mcp-server-demo-go
# Check if pods are ready
kubectl get pods -l app=mcp-server-demo-go
# Test service from within cluster
kubectl run test --image=curlimages/curl -it --rm --restart=Never -- curl http://mcp-server-demo-go:8080/mcp
Cleanup
# Delete all resources
kubectl delete -f k8s/go-server-deployment.yaml
kubectl delete -f k8s/python-server-deployment.yaml
kubectl delete -f k8s/ingress.yaml
# Or delete by label
kubectl delete all -l app=mcp-server-demo-go
kubectl delete all -l app=mcp-server-demo-python
# Delete Minikube cluster (if used)
minikube delete
# Delete Kind cluster (if used)
kind delete cluster --name mcp-demo
Helm Deployment
This project includes Helm charts for simplified deployment and management of both MCP servers.
Prerequisites
- Helm 3.x installed (Installation guide)
- Kubernetes cluster with kubectl configured
- Container images built and accessible (local or registry)
Helm Charts Overview
The helm/ directory contains two Helm charts:
helm/mcp-server-go/- Helm chart for Go serverhelm/mcp-server-python/- Helm chart for Python server
Each chart includes:
- Configurable deployment with replicas, resources, and security contexts
- Service configuration (ClusterIP, NodePort, LoadBalancer)
- Optional Ingress with TLS support
- Optional Horizontal Pod Autoscaler (HPA)
- Customizable health probes
- NOTES with post-installation instructions
Installing with Helm
Install Go Server:
# Install with default values (uses local image)
helm install mcp-go ./helm/mcp-server-go
# Install with custom values
helm install mcp-go ./helm/mcp-server-go \
--set image.repository=${REGISTRY_USER}/mcp-server-demo-go \
--set image.tag=${VERSION} \
--set replicaCount=3
# Install with Ingress enabled
helm install mcp-go ./helm/mcp-server-go \
--set ingress.enabled=true \
--set ingress.hosts[0].host=mcp-go.example.com \
--set ingress.hosts[0].paths[0].path=/ \
--set ingress.hosts[0].paths[0].pathType=Prefix
# Install with autoscaling enabled
helm install mcp-go ./helm/mcp-server-go \
--set autoscaling.enabled=true \
--set autoscaling.minReplicas=2 \
--set autoscaling.maxReplicas=10 \
--set autoscaling.targetCPUUtilizationPercentage=70
Install Python Server:
# Install with default values (uses local image)
helm install mcp-python ./helm/mcp-server-python
# Install with custom values
helm install mcp-python ./helm/mcp-server-python \
--set image.repository=${REGISTRY_USER}/mcp-server-demo-python \
--set image.tag=${VERSION} \
--set replicaCount=3
# Install with Ingress enabled
helm install mcp-python ./helm/mcp-server-python \
--set ingress.enabled=true \
--set ingress.hosts[0].host=mcp-python.example.com \
--set ingress.hosts[0].paths[0].path=/ \
--set ingress.hosts[0].paths[0].pathType=Prefix
Install to a specific namespace:
# Create namespace
kubectl create namespace mcp-servers
# Install both servers to the namespace
helm install mcp-go ./helm/mcp-server-go -n mcp-servers
helm install mcp-python ./helm/mcp-server-python -n mcp-servers
Using a Custom Values File
Create a custom values file to override defaults:
custom-values-go.yaml:
replicaCount: 3
image:
repository: ${REGISTRY_USER}/mcp-server-demo-go
tag: "v1.0.3"
pullPolicy: Always
resources:
limits:
cpu: 1000m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
ingress:
enabled: true
className: nginx
hosts:
- host: mcp-go.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: mcp-go-tls
hosts:
- mcp-go.example.com
autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetCPUUtilizationPercentage: 70
Install with custom values:
helm install mcp-go ./helm/mcp-server-go -f custom-values-go.yaml
Managing Helm Releases
List installed releases:
helm list
helm list -n mcp-servers # In specific namespace
Get release status:
helm status mcp-go
helm status mcp-python
Upgrade a release:
# Upgrade with new image version
helm upgrade mcp-go ./helm/mcp-server-go \
--set image.tag=v1.1.0
# Upgrade with custom values file
helm upgrade mcp-go ./helm/mcp-server-go -f custom-values-go.yaml
# Upgrade with reuse of previous values
helm upgrade mcp-go ./helm/mcp-server-go --reuse-values --set replicaCount=5
Rollback a release:
# Rollback to previous revision
helm rollback mcp-go
# Rollback to specific revision
helm rollback mcp-go 2
# View rollback history
helm history mcp-go
Uninstall a release:
helm uninstall mcp-go
helm uninstall mcp-python
# Uninstall from specific namespace
helm uninstall mcp-go -n mcp-servers
Testing Helm Deployments
Dry run (validate without installing):
helm install mcp-go ./helm/mcp-server-go --dry-run --debug
Template rendering (see generated manifests):
helm template mcp-go ./helm/mcp-server-go
helm template mcp-go ./helm/mcp-server-go -f custom-values-go.yaml
Lint chart (check for issues):
helm lint ./helm/mcp-server-go
helm lint ./helm/mcp-server-python
Test the deployed application:
# Port forward to access the service
kubectl port-forward svc/mcp-go-mcp-server-go 8080:8080
# In another terminal, test with the test client
cd go-server
./testclient -i -url http://localhost:8080/mcp
Packaging and Distributing Helm Charts
Package charts:
# Package individual charts
helm package ./helm/mcp-server-go
helm package ./helm/mcp-server-python
# This creates mcp-server-go-1.0.0.tgz and mcp-server-python-1.0.0.tgz
Install from packaged chart:
helm install mcp-go mcp-server-go-1.0.0.tgz
Create Helm repository index:
# Create index file for multiple charts
helm repo index . --url https://example.com/charts
# This generates index.yaml for hosting as a chart repository
Common Helm Values Configurations
For Production Environments:
# Production configuration example
replicaCount: 3
image:
repository: your-registry.io/mcp-server-demo-go
tag: "v1.1.0"
pullPolicy: Always
imagePullSecrets:
- name: registry-secret
resources:
limits:
cpu: 1000m
memory: 256Mi
requests:
cpu: 200m
memory: 128Mi
autoscaling:
enabled: true
minReplicas: 3
maxReplicas: 20
targetCPUUtilizationPercentage: 70
ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
hosts:
- host: mcp-go.prod.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: mcp-go-tls
hosts:
- mcp-go.prod.example.com
podAnnotations:
prometheus.io/scrape: "true"
prometheus.io/port: "8080"
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app.kubernetes.io/name
operator: In
values:
- mcp-server-go
topologyKey: kubernetes.io/hostname
For Development Environments:
# Development configuration example
replicaCount: 1
image:
repository: mcp-server-demo-go
tag: "latest"
pullPolicy: IfNotPresent
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 100m
memory: 64Mi
service:
type: NodePort
autoscaling:
enabled: false
Helm Values Reference
Key configuration options available in values.yaml:
| Parameter | Description | Default |
|---|---|---|
replicaCount | Number of replicas | 2 |
image.repository | Image repository | mcp-server-demo-go |
image.tag | Image tag | latest |
image.pullPolicy | Image pull policy | IfNotPresent |
service.type | Service type | ClusterIP |
service.port | Service port | 8080 |
ingress.enabled | Enable Ingress | false |
ingress.className | Ingress class | nginx |
resources.limits.cpu | CPU limit | 500m |
resources.limits.memory | Memory limit | 128Mi (Go) / 256Mi (Python) |
autoscaling.enabled | Enable HPA | false |
autoscaling.minReplicas | Minimum replicas | 2 |
autoscaling.maxReplicas | Maximum replicas | 10 |
config.mode | Server mode | http |
config.host | Bind address | 0.0.0.0 |
config.port | Server port | 8080 |
For complete values reference, see the values.yaml file in each chart directory.
Production Best Practices
- Use specific version tags instead of
latestin production - Enable resource limits to prevent resource exhaustion
- Configure horizontal pod autoscaling based on metrics
- Set up monitoring with Prometheus/Grafana
- Configure logging with ELK stack or cloud-native solutions
- Use secrets management for sensitive configuration
- Implement network policies to restrict traffic
- Regular security updates - rebuild images with updated base images
- Backup configurations - store manifests in version control
- Test rollback procedures before production deployment
