MCP Router
A cloud-agnostic Node.js orchestration server that routes requests to pluggable tool adapters (Claude, Cursor, custom tools) via the MCP protocol pattern. Deployable on EKS (AWS) or AKS (Azure) without code changes.
Architecture decisions
| Decision | Choice | Reason |
|---|---|---|
| Protocol | HTTP + SSE | Universal, no WS infra needed, works through all proxies |
| Adapter loading | Dynamic import() scan | Drop-in plugins, zero router changes |
| Auth | Delegated to Ingress | Keeps router stateless and horizontally scalable |
| K8s packaging | Helm + plain YAML | Works with ArgoCD, Flux, or raw kubectl |
| Image | Distroless nonroot | Minimal attack surface, no shell |
Quick start
cp .env.example .env # add your ANTHROPIC_API_KEY
npm install
npm run dev
Call the router
# List available tools
curl http://localhost:3000/mcp/tools
# Stream a Claude completion (SSE)
curl -N -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-d '{
"tool": "claude",
"stream": true,
"input": {
"messages": [{"role":"user","content":"Explain MCP in one paragraph"}]
}
}'
# Buffered JSON response
curl -X POST http://localhost:3000/mcp \
-H 'Content-Type: application/json' \
-d '{"tool":"custom","stream":false,"input":{"input":"hello world"}}'
Adding a new adapter
cp src/adapters/custom.js src/adapters/my-tool.js- Change
nameinmeta() - Update
InputSchemaand implementexecute()as an async generator - Restart — the registry auto-discovers the new file
No changes to the router, registry, or Kubernetes manifests.
Deploy to Kubernetes
Prerequisites
kubectlconfigured for your cluster (EKS or AKS)helmv3- Your image pushed to ECR or ACR
Create secrets
kubectl create secret generic mcp-router-secrets \
--from-literal=ANTHROPIC_API_KEY=sk-... \
--from-literal=CURSOR_API_KEY=optional
Helm install
helm install mcp-router ./helm/mcp-router \
--set image.repository=<your-registry>/mcp-router \
--set image.tag=<git-sha>
Or plain kubectl
kubectl apply -f k8s/manifests.yaml
Cloud-specific ingress notes
EKS: install aws-load-balancer-controller and add annotation:
kubernetes.io/ingress.class: alb
alb.ingress.kubernetes.io/scheme: internet-facing
AKS: install ingress-nginx via Helm (same chart works on both clouds):
helm install ingress-nginx ingress-nginx/ingress-nginx
The default values.yaml targets nginx, which is cloud-agnostic.
Environment variables
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | For claude adapter | Anthropic API key |
CURSOR_API_URL | For cursor adapter | Cursor REST endpoint URL |
CURSOR_API_KEY | For cursor adapter | Bearer token for Cursor API |
CURSOR_CLI_PATH | For cursor adapter | Path to Cursor binary (alternative to REST) |
PORT | No (default 3000) | HTTP port |
LOG_LEVEL | No (default info) | Pino log level |
NODE_ENV | No | Set to production to disable pretty-printing |
API reference
POST /mcp
{
"tool": "claude",
"stream": true,
"input": { /* adapter-specific, validated by Zod schema */ }
}
SSE events (when stream: true):
data: {"type":"text","data":"Hello"}
data: {"type":"done","data":{"stop_reason":"end_turn","usage":{...}}}
data: {"type":"error","data":"Something went wrong"}
GET /mcp/tools
Returns registered adapters and their descriptions.
GET /health/live
Kubernetes liveness probe.
GET /health/ready
Kubernetes readiness probe — 503 until adapters are loaded.