@absmartly/claude-code-bridge
v1.0.2
Published
HTTP bridge server for ABsmartly Extension to communicate with Claude Code CLI
Readme
@absmartly/claude-code-bridge
HTTP bridge server that enables the ABsmartly Browser Extension to communicate with Claude Code CLI for AI-powered A/B testing features.
Prerequisites
- Node.js 16+
- Claude Code CLI authenticated:
npx @anthropic-ai/claude-code login
Quick Start
npx @absmartly/claude-code-bridgeThe server will start on http://localhost:3000 by default.
Usage
1. Login to Claude CLI (one-time setup)
npx @anthropic-ai/claude-code loginFollow the prompts to authenticate with your Claude subscription.
2. Start the bridge server
npx @absmartly/claude-code-bridge3. Configure ABsmartly Extension
In the extension settings:
- Select "Claude Subscription" as your AI provider
- The extension will automatically connect to
http://localhost:3000
Custom Port
PORT=3001 npx @absmartly/claude-code-bridgeAPI Endpoints
GET /health- Health check and auth statusGET /auth/status- Claude CLI authentication statusPOST /conversations- Create new conversationPOST /conversations/:id/messages- Send message to ClaudeGET /conversations/:id/stream- Stream Claude responses (SSE)POST /conversations/:id/approve- Approve tool usePOST /conversations/:id/deny- Deny tool use
How It Works
- Authentication Check: Reads your Claude credentials from
~/.claude/.credentials.json - Claude CLI Spawn: Spawns
npx @anthropic-ai/claude-code --jsonsubprocess - HTTP Bridge: Provides REST API for the browser extension to communicate
- Message Forwarding: Routes messages between the extension and Claude CLI
- Server-Sent Events: Streams Claude responses back to the extension in real-time
Troubleshooting
"Claude CLI not logged in"
Run: npx @anthropic-ai/claude-code login
"Port already in use"
Either:
- Kill the existing process:
pkill -f claude-code-bridge - Or use a different port:
PORT=3001 npx @absmartly/claude-code-bridge
Extension can't connect
- Ensure the bridge is running:
http://localhost:3000/healthshould return JSON - Check the port matches in extension settings
- Restart the extension
License
MIT
