← Back to Documentation
Running Multiple AI Assistants with Kapture
Kapture enables multiple AI assistants to control browser tabs simultaneously through a single server instance. This guide explains how to set up and manage multi-assistant workflows effectively.
Understanding the Architecture
Kapture uses a hybrid architecture that supports both stdio and WebSocket connections:
graph LR
CD[Claude Desktop] -->|stdio| B[bridge]
B -->|WebSocket| KS[Kapture Server]
OC[Other MCP Clients] -->|WebSocket| KS
KS --> CE[Chrome Extension]
CE --> BT[Browser Tabs]
Key Concepts
- Single Server Instance: Only one Kapture server runs at a time on port 61822
- Bridge Mode: Translates between stdio (used by Claude Desktop) and WebSocket
- Direct WebSocket: Other MCP clients connect directly via WebSocket
- Shared Browser Access: All connected clients can control any connected browser tab
Setup Guide
Step 1: Install the Chrome Extension
- Download the Kapture extension from the releases page
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode"
- Click "Load unpacked" and select the extension folder
Step 2: Configure Your Primary AI Client (Claude Desktop)
Claude Desktop will automatically start and manage the server:
- Open Claude Desktop's configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- Add the Kapture configuration:
{
"mcpServers": {
"kapture": {
"command": "npx",
"args": ["kapture-mcp-server", "bridge"]
}
}
}
- Restart Claude Desktop - the server will start automatically
Step 3: Add Additional AI Clients
Once the server is running (started by Claude Desktop), other clients can connect:
Cline (VS Code Extension)
Add to your VS Code settings:
{
"cline.mcpServers": {
"kapture": {
"transport": "websocket",
"url": "ws://localhost:61822/mcp"
}
}
}
Other MCP-Compatible Clients
Any MCP client that supports WebSocket can connect to:
ws://localhost:61822/mcp
Step 4: Connect Browser Tabs
- Open Chrome/Brave and navigate to any website
- Open DevTools (F12 or Cmd+Option+I)
- Click on the "Kapture" panel
- The extension automatically connects to the server
Each tab shows:
- A unique Tab ID (e.g.,
tab_1234567890
)
- Connection status (green = connected)
- Current URL
Verification and Monitoring
Check Server Status
Open in your browser:
http://localhost:61822/
You'll see:
{
"mcpClients": ["Claude Desktop", "Cline"],
"connectionCount": 2,
"browserTabs": 3
}
Monitor in DevTools
The Kapture panel shows:
- Server connection status
- Command history
- Response details
View Server Logs
Server logs appear in the terminal where Claude Desktop was launched, showing:
- Client connections/disconnections
- Command execution
- Errors and warnings
Common Scenarios
Scenario 1: Research and Development
Setup: Claude Desktop + Cline
- Claude Desktop researches API documentation:
"Navigate to https://docs.api.com and find the authentication section"
- Simultaneously, Cline implements the code:
"Create an authentication module based on the research"
- Both work independently without interference
Scenario 2: Automated Testing
Setup: Multiple Claude Desktop instances
- Instance 1 writes test scenarios
- Instance 2 executes tests in the browser
- Instance 3 monitors console logs for errors
Scenario 3: Multi-Site Management
Setup: Claude Desktop + Custom MCP Client
- Claude manages social media posts
- Custom client handles form submissions
- Each operates on different browser tabs
Important Considerations
Server Lifecycle
- Automatic Start: When Claude Desktop launches with the bridge config
- Smart Detection: If you run
npx kapture-mcp-server
manually and a server is already running, it will show the existing server info and exit
- Graceful Shutdown: Server stops when all clients disconnect
Tab Management
- Tab Persistence: Tab IDs remain constant even if the page reloads
- Automatic Reconnection: Extensions reconnect automatically if the server restarts
- Independent Control: Each AI can control any tab, but commands are queued to prevent conflicts
Resource Limits
- Concurrent Clients: No hard limit, but performance may degrade with many clients
- Browser Tabs: Limited by Chrome's memory constraints
- Command Queue: Each tab processes commands sequentially
Troubleshooting
"Server already running" Error
This is normal! It means Claude Desktop already started the server. Your additional client should connect via WebSocket.
WebSocket Connection Failed
- Verify the server is running:
http://localhost:61822/
- Check firewall settings for port 61822
- Ensure the WebSocket URL is exactly:
ws://localhost:61822/mcp
Commands Not Working
- Check the Kapture panel is active in DevTools
- Verify the tab shows as connected (green status)
- Look for errors in the DevTools console
Performance Issues
- Close unused browser tabs
- Limit concurrent automation operations
- Add delays between rapid commands:
await new Promise(resolve => setTimeout(resolve, 500));
Best Practices
1. Coordinate AI Tasks
- Assign specific responsibilities to each AI
- Use tab naming conventions (e.g., "research-1", "test-2")
- Implement handoff mechanisms between AIs
2. Handle Errors Gracefully
- Check command responses for success/failure
- Implement retry logic for failed operations
- Use try-catch blocks in your AI prompts
3. Optimize Performance
- Batch related operations
- Use CSS selectors efficiently
- Close tabs when done
4. Maintain Security
- Only run on localhost
- Don't expose port 61822 externally
- Monitor connected clients regularly
Advanced Usage
Custom Integration
Create your own MCP client:
import { WebSocketClientTransport } from '@modelcontextprotocol/sdk';
const transport = new WebSocketClientTransport(
new URL('ws://localhost:61822/mcp')
);
await transport.connect();
Monitoring All Activity
Subscribe to notifications:
kapture/tabs_changed
- Tab connections/disconnections
kapture/console_log
- Real-time browser console output
Programmatic Control
Use the HTTP API for debugging:
# List all tabs
curl http://localhost:61822/tabs
# Get tab details
curl http://localhost:61822/tab/{tabId}
# View screenshot
curl http://localhost:61822/tab/{tabId}/screenshot/view > screenshot.png
Summary
Running multiple AI assistants with Kapture enables powerful automation workflows. The key is understanding that:
- Claude Desktop manages the server lifecycle via the bridge command
- Additional clients connect via WebSocket
- All clients share access to browser tabs
- Commands are queued per tab to prevent conflicts
Start simple with two clients, then expand as you become comfortable with the coordination patterns.
Ready to start? Follow the setup guide above and begin automating with multiple AI assistants today!