quick-start.shโข6.85 kB
#!/bin/bash
# ValueRouter MCP Server Quick Start Script
# This script helps you quickly deploy and test the ValueRouter MCP server
set -e
echo "๐ ValueRouter MCP Server Quick Start"
echo "===================================="
# Check if Node.js is installed
if ! command -v node &> /dev/null; then
echo "โ Node.js is not installed. Please install Node.js 18 or higher."
exit 1
fi
# Check Node.js version
NODE_VERSION=$(node --version | cut -d'v' -f2)
REQUIRED_VERSION="18.0.0"
if [ "$(printf '%s\n' "$REQUIRED_VERSION" "$NODE_VERSION" | sort -V | head -n1)" != "$REQUIRED_VERSION" ]; then
echo "โ Node.js version $NODE_VERSION is too old. Please install Node.js 18 or higher."
exit 1
fi
echo "โ
Node.js version $NODE_VERSION detected"
# Check if npm is installed
if ! command -v npm &> /dev/null; then
echo "โ npm is not installed. Please install npm."
exit 1
fi
echo "โ
npm is available"
# Create environment file if it doesn't exist
if [ ! -f ".env" ]; then
echo "๐ง Creating environment configuration..."
cat > .env << EOF
# ValueRouter MCP Server Configuration
# Replace these with your actual RPC URLs
# Ethereum Mainnet
ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/YOUR_INFURA_KEY
# Layer 2 Networks
ARBITRUM_RPC_URL=https://arb1.arbitrum.io/rpc
OPTIMISM_RPC_URL=https://mainnet.optimism.io
POLYGON_RPC_URL=https://polygon-rpc.com
AVALANCHE_RPC_URL=https://api.avax.network/ext/bc/C/rpc
BASE_RPC_URL=https://mainnet.base.org
# Non-EVM Networks
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
SUI_RPC_URL=https://fullnode.mainnet.sui.io:443
# Cosmos Networks
NOBLE_RPC_URL=https://noble-rpc.polkachu.com
OSMOSIS_RPC_URL=https://rpc.osmosis.zone
# Optional: Set to 'development' for testing
NODE_ENV=production
# Optional: Custom port (default: 3000)
PORT=3000
EOF
echo "โ
Created .env file with default configuration"
echo "โ ๏ธ Please edit .env file and add your RPC URLs before starting"
fi
# Function to install the package
install_package() {
echo "๐ฆ Installing ValueRouter MCP Server..."
if [ "$1" = "global" ]; then
npm install -g @valuerouter/mcp-server
echo "โ
Installed globally. You can now run: valuerouter-mcp"
else
npm install @valuerouter/mcp-server
echo "โ
Installed locally. You can now run: npx @valuerouter/mcp-server"
fi
}
# Function to build from source
build_from_source() {
echo "๐จ Building from source..."
if [ ! -f "package.json" ]; then
echo "โ package.json not found. Please run this script from the mcp-server directory."
exit 1
fi
npm install
npm run build
echo "โ
Built successfully"
}
# Function to test the server
test_server() {
echo "๐งช Testing MCP server..."
# Start server in background
if command -v valuerouter-mcp &> /dev/null; then
valuerouter-mcp &
else
npx @valuerouter/mcp-server &
fi
SERVER_PID=$!
sleep 3
# Test basic functionality
echo "Testing server response..."
# Create a test request
cat > test_request.json << EOF
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}
EOF
# Send test request (if server supports HTTP)
if curl -s -H "Content-Type: application/json" -d @test_request.json http://localhost:3000 > /dev/null; then
echo "โ
Server is responding correctly"
else
echo "โน๏ธ Server started successfully (stdio mode)"
fi
# Clean up
kill $SERVER_PID 2>/dev/null || true
rm -f test_request.json
}
# Function to create Claude Desktop configuration
create_claude_config() {
echo "๐ค Creating Claude Desktop configuration..."
CLAUDE_CONFIG_DIR="$HOME/.config/claude-desktop"
mkdir -p "$CLAUDE_CONFIG_DIR"
cat > "$CLAUDE_CONFIG_DIR/claude_desktop_config.json" << EOF
{
"mcpServers": {
"valuerouter": {
"command": "npx",
"args": ["@valuerouter/mcp-server"],
"env": {
"ETHEREUM_RPC_URL": "https://mainnet.infura.io/v3/YOUR_INFURA_KEY",
"ARBITRUM_RPC_URL": "https://arb1.arbitrum.io/rpc",
"OPTIMISM_RPC_URL": "https://mainnet.optimism.io",
"POLYGON_RPC_URL": "https://polygon-rpc.com",
"AVALANCHE_RPC_URL": "https://api.avax.network/ext/bc/C/rpc",
"BASE_RPC_URL": "https://mainnet.base.org",
"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com",
"SUI_RPC_URL": "https://fullnode.mainnet.sui.io:443"
}
}
}
}
EOF
echo "โ
Claude Desktop configuration created at $CLAUDE_CONFIG_DIR/claude_desktop_config.json"
echo "โ ๏ธ Please update the RPC URLs in the configuration file"
}
# Function to show usage examples
show_examples() {
echo "๐ Usage Examples:"
echo "=================="
echo ""
echo "1. Direct Usage:"
echo " npx @valuerouter/mcp-server"
echo ""
echo "2. With Environment Variables:"
echo " ETHEREUM_RPC_URL=https://mainnet.infura.io/v3/YOUR_KEY npx @valuerouter/mcp-server"
echo ""
echo "3. Claude Desktop Integration:"
echo " - Configuration already created in ~/.config/claude-desktop/"
echo " - Update RPC URLs and restart Claude Desktop"
echo ""
echo "4. Testing Bridge Quote:"
echo " - Use get_bridge_quote tool"
echo " - From: Ethereum (1) To: Arbitrum (42161)"
echo " - Amount: 1000000 (1 USDC)"
echo ""
echo "5. Check Supported Chains:"
echo " - Use get_supported_chains tool"
echo " - Include testnets: true/false"
}
# Main menu
echo ""
echo "What would you like to do?"
echo "1. Install from NPM (recommended)"
echo "2. Install globally"
echo "3. Build from source"
echo "4. Test server"
echo "5. Create Claude Desktop config"
echo "6. Show usage examples"
echo "7. Exit"
echo ""
read -p "Enter your choice (1-7): " choice
case $choice in
1)
install_package "local"
;;
2)
install_package "global"
;;
3)
build_from_source
;;
4)
test_server
;;
5)
create_claude_config
;;
6)
show_examples
;;
7)
echo "๐ Goodbye!"
exit 0
;;
*)
echo "โ Invalid choice. Please run the script again."
exit 1
;;
esac
echo ""
echo "๐ Quick start completed!"
echo ""
echo "Next steps:"
echo "1. Configure your RPC URLs in .env file"
echo "2. Test the server with: npx @valuerouter/mcp-server"
echo "3. Integrate with your AI agent (Claude Desktop, OpenAI, etc.)"
echo ""
echo "๐ For more information, visit:"
echo " - Documentation: https://github.com/valuerouter/mcp-server"
echo " - Examples: https://github.com/valuerouter/mcp-server/tree/main/examples"
echo " - Support: https://discord.gg/valuerouter"