Skip to content

Commit df8dcda

Browse files
committed
Add script and configuration for deploying hosted MCP servers
1 parent 076a1d0 commit df8dcda

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

k8s/deployment.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: boj-server
5+
labels:
6+
app: boj-server
7+
spec:
8+
replicas: 3
9+
selector:
10+
matchLabels:
11+
app: boj-server
12+
template:
13+
metadata:
14+
labels:
15+
app: boj-server
16+
spec:
17+
containers:
18+
- name: boj-server
19+
image: ghcr.io/hyperpolymath/boj-server:latest
20+
ports:
21+
- containerPort: 7700
22+
- containerPort: 7701
23+
- containerPort: 7702
24+
- containerPort: 7703
25+
env:
26+
- name: BOJ_URL
27+
value: "http://localhost:7700"
28+
resources:
29+
requests:
30+
cpu: "100m"
31+
memory: "128Mi"
32+
limits:
33+
cpu: "500m"
34+
memory: "512Mi"
35+
restartPolicy: Always

k8s/service.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: boj-server
5+
labels:
6+
app: boj-server
7+
spec:
8+
selector:
9+
app: boj-server
10+
ports:
11+
- name: rest
12+
port: 7700
13+
targetPort: 7700
14+
- name: grpc
15+
port: 7701
16+
targetPort: 7701
17+
- name: graphql
18+
port: 7702
19+
targetPort: 7702
20+
- name: sse
21+
port: 7703
22+
targetPort: 7703
23+
type: LoadBalancer
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: PMPL-1.0-or-later
3+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
4+
5+
# Deploy Hosted MCP Servers
6+
7+
# This script deploys hosted MCP servers for improved accessibility.
8+
# It supports deploying to various cloud providers and platforms.
9+
10+
set -euo pipefail
11+
12+
echo "=== Deploy Hosted MCP Servers ==="
13+
14+
# Check if the required tools are installed
15+
if ! command -v docker &>/dev/null; then
16+
echo "Error: Docker is not installed. Please install Docker first."
17+
exit 1
18+
fi
19+
20+
if ! command -v kubectl &>/dev/null; then
21+
echo "Error: kubectl is not installed. Please install kubectl first."
22+
exit 1
23+
fi
24+
25+
# Build the Docker image
26+
echo "Building Docker image..."
27+
docker build -f Containerfile -t boj-server:latest .
28+
29+
# Push the Docker image to a container registry
30+
echo "Pushing Docker image to container registry..."
31+
docker tag boj-server:latest ghcr.io/hyperpolymath/boj-server:latest
32+
docker push ghcr.io/hyperpolymath/boj-server:latest
33+
34+
# Deploy to Kubernetes
35+
echo "Deploying to Kubernetes..."
36+
kubectl apply -f k8s/deployment.yaml
37+
kubectl apply -f k8s/service.yaml
38+
39+
# Wait for the deployment to be ready
40+
echo "Waiting for deployment to be ready..."
41+
kubectl wait --for=condition=available deployment/boj-server --timeout=300s
42+
43+
# Get the service URL
44+
echo "Getting service URL..."
45+
kubectl get service boj-server
46+
47+
# Deploy to Cloudflare Workers
48+
echo "Deploying to Cloudflare Workers..."
49+
npm run deploy:workers
50+
51+
# Deploy to Vercel
52+
echo "Deploying to Vercel..."
53+
npm run deploy:vercel
54+
55+
# Deploy to Netlify
56+
echo "Deploying to Netlify..."
57+
npm run deploy:netlify
58+
59+
echo "=== Deployment Complete ==="

0 commit comments

Comments
 (0)