Run the mcpserver in Kubernetes (or OpenShift) with basic manifests
- Docker
- kind (Kubernetes in Docker)
- kubectl
- Python 3.11+ (for local testing)
Start by creating a local Kubernetes cluster (with kind):
kind create clusterBuild the container image locally and load it into the kind nodes so you don't have to push to a remote registry.
You can also pull and load.
# Build the image
docker build -t ghcr.io/converged-computing/mcp-server:latest .
# OR pull
docker pull ghcr.io/converged-computing/mcp-server:latest
# Load into kind
kind load docker-image ghcr.io/converged-computing/mcp-server:latestThe configuration and the custom tools are managed via a Kubernetes ConfigMap.
This contains our mcpserver.yaml (the configuration) and echo.py (the tool code).
kubectl apply -f config-map.yamlThis launches the pod, mounts the configuration, and exposes it via a Service.
kubectl apply -f deployment.yaml
kubectl apply -f service.yamlWait for the pod to reach the Running state:
kubectl get podsSee the server running:
kubectl logs mcp-server-5bbdcbbbdf-2sccc -fExpose the service to your local machine:
kubectl port-forward svc/mcp-server-service 8080:80Check health:
$ curl -s http://localhost:8080/health | jq
{
"status": 200,
"message": "OK"
}Ask for pancakes (you need fastmcp installed for this).
$ python3 get_pancakes.py
⭐ Discovered tool: pancakes_tool
⭐ Discovered tool: simple_echo
CallToolResult(content=[TextContent(type='text', text='Pancakes for Vanessa 🥞', annotations=None, meta=None)], structured_content={'result': 'Pancakes for Vanessa 🥞'}, meta=None, data='Pancakes for Vanessa 🥞', is_error=False)Note that we can also run the server in stdio mode and then echo json RPC to it, but nah, don't really want to do that.
To delete the cluster and start over:
kind delete cluster