|
| 1 | +# Installation Guide |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +- Mattermost Server 9.0+ |
| 6 | +- Claude Code CLI installed on the bridge server |
| 7 | +- Node.js 22+ (for bridge server) |
| 8 | +- Go 1.21+ (for building from source) |
| 9 | + |
| 10 | +## Method 1: Mattermost Marketplace (Recommended) |
| 11 | + |
| 12 | +1. Log in to Mattermost as System Admin |
| 13 | +2. Go to **System Console** → **Plugins** → **Marketplace** |
| 14 | +3. Search for "Claude Code" |
| 15 | +4. Click **Install** |
| 16 | +5. Configure settings (see [Configuration](#configuration) section) |
| 17 | +6. Enable the plugin |
| 18 | + |
| 19 | +## Method 2: Manual Installation |
| 20 | + |
| 21 | +### Download Latest Release |
| 22 | + |
| 23 | +```bash |
| 24 | +# For Linux |
| 25 | +wget https://github.com/appsome/claude-code-mattermost-plugin/releases/latest/download/com.appsome.claudecode-linux-amd64.tar.gz |
| 26 | + |
| 27 | +# For macOS |
| 28 | +wget https://github.com/appsome/claude-code-mattermost-plugin/releases/latest/download/com.appsome.claudecode-darwin-amd64.tar.gz |
| 29 | + |
| 30 | +# For Windows |
| 31 | +wget https://github.com/appsome/claude-code-mattermost-plugin/releases/latest/download/com.appsome.claudecode-windows-amd64.tar.gz |
| 32 | +``` |
| 33 | + |
| 34 | +### Upload Plugin |
| 35 | + |
| 36 | +1. Go to **System Console** → **Plugins** → **Management** |
| 37 | +2. Click **Upload Plugin** |
| 38 | +3. Select the downloaded `.tar.gz` file |
| 39 | +4. Click **Upload** |
| 40 | +5. Enable the plugin |
| 41 | + |
| 42 | +### Configuration |
| 43 | + |
| 44 | +1. Go to **System Console** → **Plugins** → **Claude Code** |
| 45 | +2. Configure the following settings: |
| 46 | + |
| 47 | +| Setting | Description | Default | |
| 48 | +|---------|-------------|---------| |
| 49 | +| Bridge Server URL | URL of the Claude Code bridge server | `http://localhost:3002` | |
| 50 | +| Claude Code CLI Path | Path to the Claude Code CLI executable | `/usr/local/bin/claude` | |
| 51 | +| Enable File Operations | Allow users to browse and edit files via dialogs | `true` | |
| 52 | + |
| 53 | +3. Click **Save** |
| 54 | + |
| 55 | +## Bridge Server Setup |
| 56 | + |
| 57 | +The bridge server manages Claude Code CLI sessions and is required for the plugin to function. |
| 58 | + |
| 59 | +### Option 1: Docker (Recommended) |
| 60 | + |
| 61 | +```bash |
| 62 | +# Clone the repository |
| 63 | +git clone https://github.com/appsome/claude-code-mattermost-plugin |
| 64 | +cd claude-code-mattermost-plugin |
| 65 | + |
| 66 | +# Start the bridge server |
| 67 | +docker-compose -f docker-compose.prod.yml up -d |
| 68 | +``` |
| 69 | + |
| 70 | +The bridge server will be available at `http://localhost:3002`. |
| 71 | + |
| 72 | +### Option 2: Manual Setup |
| 73 | + |
| 74 | +```bash |
| 75 | +# Clone the repository |
| 76 | +git clone https://github.com/appsome/claude-code-mattermost-plugin |
| 77 | +cd claude-code-mattermost-plugin/bridge-server |
| 78 | + |
| 79 | +# Install dependencies |
| 80 | +npm install |
| 81 | + |
| 82 | +# Build the server |
| 83 | +npm run build |
| 84 | + |
| 85 | +# Start the server |
| 86 | +npm start |
| 87 | +``` |
| 88 | + |
| 89 | +### Option 3: Using PM2 (Process Manager) |
| 90 | + |
| 91 | +```bash |
| 92 | +# Install PM2 globally |
| 93 | +npm install -g pm2 |
| 94 | + |
| 95 | +# Start the bridge server |
| 96 | +cd bridge-server |
| 97 | +npm run build |
| 98 | +pm2 start dist/index.js --name claude-code-bridge |
| 99 | + |
| 100 | +# Enable startup script |
| 101 | +pm2 startup |
| 102 | +pm2 save |
| 103 | +``` |
| 104 | + |
| 105 | +### Environment Variables |
| 106 | + |
| 107 | +Configure the bridge server using environment variables: |
| 108 | + |
| 109 | +| Variable | Description | Default | |
| 110 | +|----------|-------------|---------| |
| 111 | +| `HOST` | Server bind address | `127.0.0.1` | |
| 112 | +| `PORT` | Server port | `3002` | |
| 113 | +| `DATABASE_PATH` | SQLite database path | `./data/sessions.db` | |
| 114 | +| `CLAUDE_CODE_PATH` | Path to Claude Code CLI | `/usr/local/bin/claude` | |
| 115 | +| `MAX_SESSIONS` | Maximum concurrent sessions | `100` | |
| 116 | +| `SESSION_TIMEOUT_MS` | Session timeout in milliseconds | `3600000` (1 hour) | |
| 117 | +| `LOG_LEVEL` | Logging level (debug, info, warn, error) | `info` | |
| 118 | + |
| 119 | +## Verification |
| 120 | + |
| 121 | +1. Open any Mattermost channel |
| 122 | +2. Type `/claude help` |
| 123 | +3. You should see the help message with available commands |
| 124 | + |
| 125 | +### Available Commands |
| 126 | + |
| 127 | +- `/claude <message>` - Send a message to Claude Code |
| 128 | +- `/claude start` - Start a new Claude Code session |
| 129 | +- `/claude stop` - Stop the current session |
| 130 | +- `/claude status` - Check session status |
| 131 | +- `/claude help` - Show help message |
| 132 | + |
| 133 | +## Troubleshooting |
| 134 | + |
| 135 | +### Plugin fails to connect to bridge server |
| 136 | + |
| 137 | +1. Verify the bridge server is running: |
| 138 | + ```bash |
| 139 | + curl http://localhost:3002/health |
| 140 | + ``` |
| 141 | +2. Check the bridge server URL in plugin settings |
| 142 | +3. Ensure there are no firewall rules blocking the connection |
| 143 | + |
| 144 | +### Claude Code CLI not found |
| 145 | + |
| 146 | +1. Verify Claude Code is installed: |
| 147 | + ```bash |
| 148 | + which claude |
| 149 | + claude --version |
| 150 | + ``` |
| 151 | +2. Update the CLI path in plugin settings or bridge server environment |
| 152 | + |
| 153 | +### Sessions not persisting |
| 154 | + |
| 155 | +1. Check the database path is writable |
| 156 | +2. For Docker, ensure the volume is mounted correctly |
| 157 | + |
| 158 | +## Updating |
| 159 | + |
| 160 | +### Plugin Update |
| 161 | + |
| 162 | +1. Download the latest release |
| 163 | +2. Go to **System Console** → **Plugins** → **Management** |
| 164 | +3. Upload the new version |
| 165 | +4. The plugin will be automatically updated |
| 166 | + |
| 167 | +### Bridge Server Update |
| 168 | + |
| 169 | +Using the update script: |
| 170 | + |
| 171 | +```bash |
| 172 | +./scripts/update-bridge.sh |
| 173 | +``` |
| 174 | + |
| 175 | +Or manually: |
| 176 | + |
| 177 | +```bash |
| 178 | +cd bridge-server |
| 179 | +git pull origin main |
| 180 | +npm install |
| 181 | +npm run build |
| 182 | +# Restart the server (method depends on how you're running it) |
| 183 | +``` |
| 184 | + |
| 185 | +## Security Considerations |
| 186 | + |
| 187 | +- The bridge server should only be accessible from the Mattermost server |
| 188 | +- Consider using HTTPS for production deployments |
| 189 | +- Review and restrict Claude Code CLI permissions as needed |
| 190 | +- The plugin respects Mattermost channel permissions |
| 191 | + |
| 192 | +## Support |
| 193 | + |
| 194 | +- [GitHub Issues](https://github.com/appsome/claude-code-mattermost-plugin/issues) |
| 195 | +- [Documentation](https://github.com/appsome/claude-code-mattermost-plugin) |
0 commit comments