-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstart-d1-mcp.sh
More file actions
32 lines (26 loc) · 862 Bytes
/
start-d1-mcp.sh
File metadata and controls
32 lines (26 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
echo "🗄️ Starting D1 Database MCP Server..."
if [ ! -f .env ]; then
echo "⚠️ Creating .env from template..."
cp .env.example .env
echo "📝 Please edit .env with your Cloudflare credentials:"
echo " CLOUDFLARE_ACCOUNT_ID=your-account-id"
echo " CLOUDFLARE_API_TOKEN=your-api-token"
echo " D1_DEV_DATABASE_ID=your-database-id"
exit 1
fi
set -a; source .env; set +a
if [ -z "$CLOUDFLARE_ACCOUNT_ID" ] || [ -z "$CLOUDFLARE_API_TOKEN" ]; then
echo "❌ Please configure .env file with Cloudflare credentials"
exit 1
fi
if [ ! -d "node_modules" ]; then
echo "📦 Installing dependencies..."
npm install
fi
if [ ! -d "dist" ] || [ "src/index.ts" -nt "dist/index.js" ]; then
echo "🔨 Building MCP server..."
npm run build
fi
echo "✅ Starting D1 Database MCP Server"
npm start