Skip to content

Commit d8d3bdb

Browse files
Copilot0xrinegade
andcommitted
Add one-liner deployment scripts for all platforms
Co-authored-by: 0xrinegade <[email protected]>
1 parent 849a360 commit d8d3bdb

File tree

10 files changed

+322
-0
lines changed

10 files changed

+322
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,32 @@ A Model Context Protocol (MCP) server that provides comprehensive access to Sola
2929
TEMP_DIR=$(mktemp -d) && cd "$TEMP_DIR" && git clone https://github.com/opensvm/solana-mcp-server.git . && cargo build --release && CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/claude" && mkdir -p "$CONFIG_DIR" && echo "{\"mcpServers\":{\"solana\":{\"command\":\"$PWD/target/release/solana-mcp-server\",\"env\":{\"SOLANA_RPC_URL\":\"https://api.mainnet-beta.solana.com\"}}}}" > "$CONFIG_DIR/config.json" || { rm -rf "$TEMP_DIR"; exit 1; }
3030
```
3131

32+
## Quick Deployment
33+
34+
🚀 **One-liner deployment scripts for all platforms:**
35+
36+
```bash
37+
# Local development
38+
./scripts/deploy-local.sh
39+
40+
# Docker container
41+
./scripts/deploy-docker.sh
42+
43+
# Kubernetes
44+
./scripts/deploy-k8s.sh
45+
46+
# AWS Lambda
47+
./scripts/deploy-lambda.sh
48+
49+
# Google Cloud Functions
50+
./scripts/deploy-gcf.sh
51+
52+
# Vercel Edge Functions
53+
./scripts/deploy-vercel.sh
54+
```
55+
56+
See [`scripts/README.md`](scripts/README.md) for detailed usage and requirements for each deployment option.
57+
3258
## Available RPC Methods
3359

3460
### Account Methods

scripts/README.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# One-liner Deployment Scripts
2+
3+
This directory contains one-liner deployment scripts for the Solana MCP Server across different platforms.
4+
5+
## Quick Start
6+
7+
```bash
8+
# Run the main script to see all options
9+
./scripts/deploy.sh
10+
```
11+
12+
## Available Scripts
13+
14+
### Local Development
15+
```bash
16+
./scripts/deploy-local.sh
17+
```
18+
- Downloads latest release binary
19+
- Configures Claude Desktop integration
20+
- No additional dependencies required
21+
22+
### Docker Container
23+
```bash
24+
./scripts/deploy-docker.sh
25+
```
26+
- Builds Docker image
27+
- Runs container on port 8080
28+
- Requires: Docker
29+
30+
### Docker Compose
31+
```bash
32+
./scripts/deploy-compose.sh
33+
```
34+
- Creates docker-compose.yml
35+
- Deploys with health checks
36+
- Requires: Docker, Docker Compose
37+
38+
### Kubernetes
39+
```bash
40+
./scripts/deploy-k8s.sh
41+
```
42+
- Creates deployment and service manifests
43+
- Deploys 3 replicas with load balancer
44+
- Requires: Docker, kubectl, Kubernetes cluster
45+
46+
### AWS Lambda
47+
```bash
48+
./scripts/deploy-lambda.sh
49+
```
50+
- Builds Lambda-compatible binary
51+
- Creates function and API Gateway
52+
- Requires: AWS CLI, cargo-lambda, valid AWS credentials
53+
54+
### Google Cloud Functions
55+
```bash
56+
./scripts/deploy-gcf.sh
57+
```
58+
- Builds for Cloud Functions runtime
59+
- Deploys HTTP-triggered function
60+
- Requires: gcloud CLI, valid GCP credentials
61+
62+
### Vercel Edge Functions
63+
```bash
64+
./scripts/deploy-vercel.sh
65+
```
66+
- Creates Vercel project structure
67+
- Deploys to Vercel Edge runtime
68+
- Requires: Vercel CLI, Node.js
69+
70+
## Prerequisites by Platform
71+
72+
| Platform | Requirements |
73+
|----------|-------------|
74+
| Local | curl, unzip |
75+
| Docker | Docker |
76+
| Docker Compose | Docker, docker-compose |
77+
| Kubernetes | Docker, kubectl, K8s cluster |
78+
| AWS Lambda | AWS CLI, cargo-lambda, AWS credentials |
79+
| Google Cloud | gcloud CLI, GCP credentials |
80+
| Vercel | Vercel CLI, Node.js |
81+
82+
## Environment Variables
83+
84+
All scripts use these default environment variables:
85+
- `SOLANA_RPC_URL=https://api.mainnet-beta.solana.com`
86+
- `SOLANA_COMMITMENT=confirmed`
87+
- `RUST_LOG=info`
88+
89+
Modify the scripts to customize these values for your deployment.
90+
91+
## Troubleshooting
92+
93+
If a deployment fails:
94+
1. Check that all required tools are installed
95+
2. Verify credentials are configured (for cloud platforms)
96+
3. Ensure network connectivity
97+
4. Check platform-specific logs
98+
99+
## Support
100+
101+
See the main [DEPLOYMENT.md](../docs/DEPLOYMENT.md) for detailed deployment guides and troubleshooting.

scripts/deploy-compose.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# One-liner deployment script for Docker Compose
3+
set -e
4+
5+
echo "🐳 Deploying Solana MCP Server with Docker Compose..."
6+
7+
# Create docker-compose.yml and deploy with load balancer
8+
cat > docker-compose.yml << 'EOF'
9+
version: '3.8'
10+
services:
11+
solana-mcp:
12+
build: .
13+
ports:
14+
- "8080:8080"
15+
environment:
16+
- SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
17+
- SOLANA_COMMITMENT=confirmed
18+
- RUST_LOG=info
19+
restart: unless-stopped
20+
healthcheck:
21+
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
22+
interval: 30s
23+
timeout: 10s
24+
retries: 3
25+
EOF
26+
docker-compose up -d && echo "✅ Docker Compose deployment complete! Server running on http://localhost:8080 - Check status: docker-compose logs -f"

scripts/deploy-docker.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# One-liner deployment script for Docker
3+
set -e
4+
5+
echo "🐳 Deploying Solana MCP Server with Docker..."
6+
7+
# Build and run Docker container with all necessary configuration
8+
docker build -t solana-mcp-server . && docker run -d --name solana-mcp-server -p 8080:8080 -e SOLANA_RPC_URL=https://api.mainnet-beta.solana.com -e SOLANA_COMMITMENT=confirmed -e RUST_LOG=info --restart unless-stopped solana-mcp-server && echo "✅ Docker deployment complete! Server running on http://localhost:8080 - Check status: docker logs solana-mcp-server"

scripts/deploy-gcf.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
# One-liner deployment script for Google Cloud Functions
3+
set -e
4+
5+
echo "☁️ Deploying Solana MCP Server to Google Cloud Functions..."
6+
7+
# Build for Cloud Functions, create function.yaml, and deploy
8+
cargo build --release --target x86_64-unknown-linux-gnu && cat > function.yaml << 'EOF'
9+
specVersion: v1alpha1
10+
kind: CloudFunction
11+
metadata:
12+
name: solana-mcp-server
13+
spec:
14+
runtime: provided
15+
source:
16+
sourceArchiveUrl: gs://your-bucket/function-source.zip
17+
httpsTrigger: {}
18+
environmentVariables:
19+
SOLANA_RPC_URL: https://api.mainnet-beta.solana.com
20+
RUST_LOG: info
21+
EOF
22+
zip -r function-source.zip target/release/solana-mcp-server function.yaml && gsutil cp function-source.zip gs://$(gcloud config get-value project)-functions/ && gcloud functions deploy solana-mcp-server --source=gs://$(gcloud config get-value project)-functions/function-source.zip --trigger-http --runtime=provided --memory=256MB --timeout=30s --set-env-vars SOLANA_RPC_URL=https://api.mainnet-beta.solana.com,RUST_LOG=info && echo "✅ Google Cloud Functions deployment complete! Check: gcloud functions describe solana-mcp-server"

scripts/deploy-k8s.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# One-liner deployment script for Kubernetes
3+
set -e
4+
5+
echo "☸️ Deploying Solana MCP Server to Kubernetes..."
6+
7+
# Create Kubernetes deployment and service, then apply
8+
cat > k8s-deployment.yaml << 'EOF'
9+
apiVersion: apps/v1
10+
kind: Deployment
11+
metadata:
12+
name: solana-mcp-server
13+
spec:
14+
replicas: 3
15+
selector:
16+
matchLabels:
17+
app: solana-mcp-server
18+
template:
19+
metadata:
20+
labels:
21+
app: solana-mcp-server
22+
spec:
23+
containers:
24+
- name: solana-mcp-server
25+
image: solana-mcp-server:latest
26+
ports:
27+
- containerPort: 8080
28+
env:
29+
- name: SOLANA_RPC_URL
30+
value: "https://api.mainnet-beta.solana.com"
31+
- name: SOLANA_COMMITMENT
32+
value: "confirmed"
33+
resources:
34+
requests:
35+
memory: "64Mi"
36+
cpu: "250m"
37+
limits:
38+
memory: "128Mi"
39+
cpu: "500m"
40+
livenessProbe:
41+
httpGet:
42+
path: /health
43+
port: 8080
44+
initialDelaySeconds: 30
45+
periodSeconds: 10
46+
---
47+
apiVersion: v1
48+
kind: Service
49+
metadata:
50+
name: solana-mcp-service
51+
spec:
52+
selector:
53+
app: solana-mcp-server
54+
ports:
55+
- protocol: TCP
56+
port: 80
57+
targetPort: 8080
58+
type: LoadBalancer
59+
EOF
60+
docker build -t solana-mcp-server:latest . && kubectl apply -f k8s-deployment.yaml && echo "✅ Kubernetes deployment complete! Check status: kubectl get pods,svc -l app=solana-mcp-server"

scripts/deploy-lambda.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# One-liner deployment script for AWS Lambda
3+
set -e
4+
5+
echo "⚡ Deploying Solana MCP Server to AWS Lambda..."
6+
7+
# Install dependencies, build Lambda package, and deploy with AWS CLI
8+
cargo install cargo-lambda && cargo lambda build --release && cp target/lambda/solana-mcp-server/bootstrap . && zip lambda-deployment.zip bootstrap && aws lambda create-function --function-name solana-mcp-server --runtime provided.al2 --role arn:aws:iam::$(aws sts get-caller-identity --query Account --output text):role/lambda-execution-role --handler bootstrap --zip-file fileb://lambda-deployment.zip --timeout 30 --memory-size 256 --environment Variables='{SOLANA_RPC_URL=https://api.mainnet-beta.solana.com,RUST_LOG=info}' && aws apigatewayv2 create-api --name solana-mcp-api --protocol-type HTTP --target arn:aws:lambda:$(aws configure get region):$(aws sts get-caller-identity --query Account --output text):function:solana-mcp-server && echo "✅ AWS Lambda deployment complete! Function: solana-mcp-server"

scripts/deploy-local.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# One-liner deployment script for local development
3+
set -e
4+
5+
echo "🚀 Deploying Solana MCP Server locally..."
6+
7+
# Download latest release, configure Claude Desktop, and start server
8+
curl -s https://api.github.com/repos/opensvm/solana-mcp-server/releases/latest | grep browser_download_url | grep $(uname -s | tr '[:upper:]' '[:lower:]') | cut -d '"' -f 4 | xargs curl -L -o solana-mcp-server && chmod +x solana-mcp-server && mkdir -p ~/.config/claude && echo '{"mcpServers":{"solana":{"command":"'$(pwd)'/solana-mcp-server","env":{"SOLANA_RPC_URL":"https://api.mainnet-beta.solana.com","SOLANA_COMMITMENT":"confirmed"}}}}' > ~/.config/claude/config.json && echo "✅ Local deployment complete! Server configured for Claude Desktop at $(pwd)/solana-mcp-server"

scripts/deploy-vercel.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# One-liner deployment script for Vercel Edge Functions
3+
set -e
4+
5+
echo "⚡ Deploying Solana MCP Server to Vercel Edge Functions..."
6+
7+
# Create Vercel project structure, install dependencies, and deploy
8+
mkdir -p api && cat > api/solana-mcp.rs << 'EOF'
9+
use vercel_runtime::{run, Body, Error, Request, Response};
10+
use serde_json::Value;
11+
12+
#[tokio::main]
13+
async fn main() -> Result<(), Error> {
14+
run(handler).await
15+
}
16+
17+
pub async fn handler(req: Request) -> Result<Response<Body>, Error> {
18+
let body = req.body();
19+
let payload: Value = serde_json::from_slice(body)?;
20+
21+
let config = solana_mcp_server::Config::load().map_err(|e| {
22+
Error::from(format!("Config error: {}", e))
23+
})?;
24+
25+
let state = std::sync::Arc::new(tokio::sync::RwLock::new(
26+
solana_mcp_server::server::ServerState::new(config)
27+
));
28+
29+
let response = solana_mcp_server::tools::handle_request(
30+
&payload.to_string(),
31+
state
32+
).await.map_err(|e| Error::from(format!("Handler error: {}", e)))?;
33+
34+
Ok(Response::builder()
35+
.status(200)
36+
.header("content-type", "application/json")
37+
.body(serde_json::to_string(&response)?.into())?)
38+
}
39+
EOF
40+
echo '{"functions": {"api/solana-mcp.rs": {"runtime": "[email protected]"}}, "env": {"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com"}}' > vercel.json && npx vercel --prod && echo "✅ Vercel deployment complete! Check: npx vercel ls"

scripts/deploy.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# Main deployment script - choose your deployment option
3+
set -e
4+
5+
echo "🚀 Solana MCP Server - One-liner Deployment Scripts"
6+
echo "==================================================="
7+
echo
8+
echo "Available deployment options:"
9+
echo "1. Local Development - ./scripts/deploy-local.sh"
10+
echo "2. Docker Container - ./scripts/deploy-docker.sh"
11+
echo "3. Docker Compose - ./scripts/deploy-compose.sh"
12+
echo "4. Kubernetes - ./scripts/deploy-k8s.sh"
13+
echo "5. AWS Lambda - ./scripts/deploy-lambda.sh"
14+
echo "6. Google Cloud Functions - ./scripts/deploy-gcf.sh"
15+
echo "7. Vercel Edge Functions - ./scripts/deploy-vercel.sh"
16+
echo
17+
echo "Usage: Choose and run any script directly, e.g.:"
18+
echo " bash scripts/deploy-local.sh"
19+
echo " bash scripts/deploy-docker.sh"
20+
echo
21+
echo "Each script is a complete one-liner deployment solution!"
22+
echo "Make sure you have the required tools installed for your chosen platform."
23+
echo

0 commit comments

Comments
 (0)