|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -e |
| 4 | + |
| 5 | +# Colors for output |
| 6 | +RED='\033[0;31m' |
| 7 | +GREEN='\033[0;32m' |
| 8 | +YELLOW='\033[1;33m' |
| 9 | +BLUE='\033[0;34m' |
| 10 | +NC='\033[0m' # No Color |
| 11 | + |
| 12 | +echo -e "${BLUE}================================${NC}" |
| 13 | +echo -e "${BLUE} Discord Setup MCP Installer${NC}" |
| 14 | +echo -e "${BLUE}================================${NC}" |
| 15 | +echo |
| 16 | + |
| 17 | +# Check for required commands |
| 18 | +check_command() { |
| 19 | + if ! command -v "$1" &> /dev/null; then |
| 20 | + echo -e "${RED}Error: $1 is not installed${NC}" |
| 21 | + echo "Please install $1 and try again" |
| 22 | + exit 1 |
| 23 | + fi |
| 24 | +} |
| 25 | + |
| 26 | +echo -e "${YELLOW}Checking prerequisites...${NC}" |
| 27 | +check_command git |
| 28 | +check_command node |
| 29 | +check_command npm |
| 30 | + |
| 31 | +# Check Node.js version |
| 32 | +NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) |
| 33 | +if [ "$NODE_VERSION" -lt 18 ]; then |
| 34 | + echo -e "${RED}Error: Node.js 18+ is required (found v$NODE_VERSION)${NC}" |
| 35 | + exit 1 |
| 36 | +fi |
| 37 | +echo -e "${GREEN}✓ Node.js $(node -v)${NC}" |
| 38 | + |
| 39 | +# Set install directory |
| 40 | +INSTALL_DIR="${DISCORD_MCP_DIR:-$HOME/.discord-setup-mcp}" |
| 41 | + |
| 42 | +echo |
| 43 | +echo -e "${YELLOW}Installing to: ${INSTALL_DIR}${NC}" |
| 44 | + |
| 45 | +# Clone or update repository |
| 46 | +if [ -d "$INSTALL_DIR" ]; then |
| 47 | + echo -e "${YELLOW}Updating existing installation...${NC}" |
| 48 | + cd "$INSTALL_DIR" |
| 49 | + git pull origin main |
| 50 | +else |
| 51 | + echo -e "${YELLOW}Cloning repository...${NC}" |
| 52 | + git clone https://github.com/cj-vana/discord-setup-mcp.git "$INSTALL_DIR" |
| 53 | + cd "$INSTALL_DIR" |
| 54 | +fi |
| 55 | + |
| 56 | +# Install dependencies |
| 57 | +echo |
| 58 | +echo -e "${YELLOW}Installing dependencies...${NC}" |
| 59 | +npm install |
| 60 | + |
| 61 | +# Build the project |
| 62 | +echo |
| 63 | +echo -e "${YELLOW}Building project...${NC}" |
| 64 | +npm run build |
| 65 | + |
| 66 | +echo |
| 67 | +echo -e "${GREEN}================================${NC}" |
| 68 | +echo -e "${GREEN} Installation complete!${NC}" |
| 69 | +echo -e "${GREEN}================================${NC}" |
| 70 | +echo |
| 71 | +echo -e "Installed to: ${BLUE}${INSTALL_DIR}${NC}" |
| 72 | +echo |
| 73 | +echo -e "${YELLOW}Next steps:${NC}" |
| 74 | +echo |
| 75 | +echo "1. Set your Discord bot token:" |
| 76 | +echo -e " ${BLUE}export DISCORD_BOT_TOKEN=\"your-token-here\"${NC}" |
| 77 | +echo |
| 78 | +echo "2. Add to Claude Desktop config:" |
| 79 | +echo -e " ${BLUE}~/Library/Application Support/Claude/claude_desktop_config.json${NC} (macOS)" |
| 80 | +echo -e " ${BLUE}%APPDATA%\\Claude\\claude_desktop_config.json${NC} (Windows)" |
| 81 | +echo |
| 82 | +cat << 'EOF' |
| 83 | + { |
| 84 | + "mcpServers": { |
| 85 | + "discord-setup": { |
| 86 | + "command": "node", |
| 87 | +EOF |
| 88 | +echo " \"args\": [\"${INSTALL_DIR}/dist/index.js\"]," |
| 89 | +cat << 'EOF' |
| 90 | + "env": { |
| 91 | + "DISCORD_BOT_TOKEN": "your-token-here" |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + } |
| 96 | +EOF |
| 97 | +echo |
| 98 | +echo "3. Or add to Claude Code:" |
| 99 | +echo -e " ${BLUE}claude mcp add discord-setup node ${INSTALL_DIR}/dist/index.js -e DISCORD_BOT_TOKEN=your-token${NC}" |
| 100 | +echo |
0 commit comments