-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug.sh
More file actions
executable file
·47 lines (37 loc) · 1.32 KB
/
debug.sh
File metadata and controls
executable file
·47 lines (37 loc) · 1.32 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
# Clean and build first
npm run clean
npm run build
# Kill any existing processes
pkill -f mysql-mcp-server || true
pkill -f "@modelcontextprotocol/inspector" || true
lsof -ti:5173,3000,3001,3002,9229 | xargs kill -9 2>/dev/null || true
# Set up base environment
export PORT=3002
export NODE_ENV=development
export DEBUG=@modelcontextprotocol*
# Build the environment args array
ENV_ARGS=()
# Add base environment variables
ENV_ARGS+=("-e" "PORT=3002")
ENV_ARGS+=("-e" "NODE_ENV=development")
ENV_ARGS+=("-e" "DEBUG=@modelcontextprotocol*")
# Load environment variables from .env file and add to args
if [ -f .env ]; then
while IFS='=' read -r key value || [ -n "$key" ]; do
# Skip comments and empty lines
[[ $key =~ ^#.*$ ]] && continue
[[ -z $key ]] && continue
# Remove any leading/trailing whitespace and quotes
key=$(echo $key | xargs)
value=$(echo $value | xargs | sed 's/^"\(.*\)"$/\1/')
# Add to env args if both key and value exist
if [[ -n $key && -n $value ]]; then
export "$key=$value"
ENV_ARGS+=("-e" "$key=$value")
fi
done < .env
fi
echo "Starting MCP inspector..."
# Start the inspector with all environment variables
exec npx @modelcontextprotocol/inspector "${ENV_ARGS[@]}" node dist/index.js