A server-based AI agent with multi-platform messaging support, configurable sandbox, and extensible plugin system.
- Web UI: Real-time chat interface accessible from any browser
- Multi-Provider AI: Support for Claude, OpenAI, and local models (Ollama)
- Messaging Integrations: Telegram, Discord, and WhatsApp bots
- Configurable Sandbox: Control file system access (workspace, home, full, custom)
- Task Management: Create and execute AI-powered tasks
- Plugin System: Extend functionality with custom plugins
- Authentication: JWT-based auth with API key support
- Deployment Ready: Docker, PM2, systemd support
-
Clone the repository
git clone https://github.com/yourusername/king-claw.git cd king-claw -
Install dependencies
npm install
-
Configure environment
cp .env.example .env # Edit .env with your API keys -
Start the server
npm run dev
-
Open in browser
- Navigate to http://localhost:3000
- Complete the initial setup wizard
- Start chatting!
-
Configure environment
cp .env.example .env # Edit .env with your configuration -
Build and run
docker-compose up -d
-
View logs
docker-compose logs -f
-
Run the install script
curl -fsSL https://raw.githubusercontent.com/yourusername/king-claw/main/install.sh | bashOr with systemd:
curl -fsSL https://raw.githubusercontent.com/yourusername/king-claw/main/install.sh | bash -s -- --systemd -
Configure
cd /opt/king-claw nano .env -
Start with PM2
npm run start:pm2
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 3000 |
HOST |
Server host | 0.0.0.0 |
NODE_ENV |
Environment | production |
DATA_PATH |
Data storage path | ./data |
JWT_SECRET |
JWT signing secret | (required) |
SANDBOX_MODE |
File access level | workspace |
| Mode | Description |
|---|---|
workspace |
Most secure - only workspace folder (default) |
home |
Access to user's home directory |
custom |
Access to specified custom path |
full |
Full system access (use with caution) |
Set your API keys in .env:
# Claude (Anthropic)
ANTHROPIC_API_KEY=sk-ant-...
# OpenAI
OPENAI_API_KEY=sk-...- Create a bot with @BotFather
- Add token to
.env:TELEGRAM_BOT_TOKEN=123456:ABC-DEF... TELEGRAM_ALLOWED_USERS=12345678,87654321 # Optional
Commands:
/start- Welcome message/help- Show commands/files [path]- List files/read <file>- Read file/tasks- List tasks/newtask <title>- Create task/clear- Clear conversation/status- System status
- Create app at Discord Developer Portal
- Enable Message Content Intent
- Add token to
.env:DISCORD_BOT_TOKEN=... DISCORD_PREFIX=!kc DISCORD_ALLOWED_CHANNELS= # Optional DISCORD_ALLOWED_ROLES= # Optional
Commands: Use !kc help for command list
- Enable in
.env:WHATSAPP_ENABLED=true WHATSAPP_ALLOWED_NUMBERS=14155551234 # Optional - Scan QR code shown in terminal on first run
- Message the bot to chat
Plugins are located in the /plugins directory. Each plugin has:
manifest.json- Plugin metadata and skillsindex.js- Plugin code
Example plugin structure:
plugins/
my-plugin/
manifest.json
index.js
See existing plugins for examples.
# Login
POST /api/auth/login
Body: { "username": "...", "password": "..." }
# Use API key
Header: X-API-Key: kc_...# Send message
POST /api/ai/chat
Body: { "messages": [{ "role": "user", "content": "..." }] }# List files
GET /api/files?path=...
# Read file
GET /api/files/read?path=...
# Write file
POST /api/files/write
Body: { "path": "...", "content": "..." }# List tasks
GET /api/tasks
# Create task
POST /api/tasks
Body: { "title": "...", "description": "..." }- Always change
JWT_SECRETandCOOKIE_SECRETin production - Use
workspacesandbox mode unless you need broader access - Enable HTTPS via reverse proxy (nginx, Caddy, etc.)
- Restrict messaging bot access with allowed users/channels/roles
Port already in use:
# Find process using port
lsof -i :3000
# Kill it
kill -9 <PID>WhatsApp QR not showing:
- Ensure Chromium is installed
- Check logs for puppeteer errors
- Try deleting
data/whatsapp-sessionand restarting
API key errors:
- Verify API keys are correct in
.env - Check API key permissions/limits
See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.