A unified server that provides browser automation tools via Model Context Protocol (MCP) and direct Agent access. Built as a monorepo with shared tools and single binary output.
browseros-server/
├── packages/
│ ├── common/ # Shared utilities (context, mutex, browser connection)
│ ├── tools/ # Browser automation tools (CDP + controller-based)
│ ├── mcp/ # MCP HTTP server implementation
│ ├── agent/ # Agent WebSocket server with Claude SDK
│ └── server/ # Unified entry point with shared WebSocketManager
┌─────────────────────────────────────────┐
│ Unified Server Process │
│ │
│ ┌───────────────────────────────────┐ │
│ │ WebSocketManager (Port 9224) │ │ ← Shared by all
│ │ Browser Extension Connection │ │
│ └───────────────┬───────────────────┘ │
│ │ │
│ ┌─────────┴─────────┐ │
│ │ │ │
│ ┌─────▼──────┐ ┌──────▼──────┐ │
│ │ HTTP MCP │ │ Agent │ │
│ │ (Port 9223)│ │ (Port 3000) │ │
│ │ │ │ │ │
│ │ External │ │ Claude SDK │ │
│ │ MCP │ │ In-process │ │
│ │ Clients │ │ SDK MCP │ │
│ └────────────┘ └─────────────┘ │
│ │
└─────────────────────────────────────────┘
# Clone the repository
git clone https://github.com/browseros-ai/BrowserOS-server.git
cd BrowserOS-server
# Install dependencies
bun install
# Run tests
bun test:all
# Start the server
bun start| Command | Description |
|---|---|
bun start |
Start the server (port 9223) |
bun test:all |
Run all tests across packages |
bun test:common |
Test common package |
bun test:tools |
Test tools package |
bun test:mcp |
Test MCP package |
bun test:server |
Test server package |
bun run build:binary |
Compile to single binary |
bun run format |
Format code (ESLint + Prettier) |
bun run check-format |
Check code formatting |
bun run clean |
Clean build artifacts |
The server needs Chrome to run. Set the executable path if Chrome is not in the default location:
PUPPETEER_EXECUTABLE_PATH="/path/to/chrome" bun startDevelopment builds (single platform):
bun run dev:server # Current platform
bun run dev:server:linux # Linux x64
bun run dev:server:macos # macOS ARM64
bun run dev:server:windows # Windows x64
# Output: dist/server/browseros-serverProduction builds (all platforms):
bun run dist:server
# Output: dist/server/
# - browseros-server-linux-x64
# - browseros-server-linux-arm64
# - browseros-server-darwin-x64
# - browseros-server-darwin-arm64
# - browseros-server-windows-x64.exeDevelopment build (with source maps):
bun run dev:ext
# Output: dist/ext/
# - background.js (unminified)
# - background.js.map
# - manifest.jsonProduction build (minified):
bun run dist:ext
# Output: dist/ext/
# - background.js (minified)
# - manifest.jsonShared utilities used by all packages:
McpContext- Browser context managementMutex- Tool execution synchronization- Browser connection management
- Logging utilities
Browser automation tools (26 total):
- Pure functions, no server logic
- Zod schemas for validation
- Response formatters
- Direct CDP integration
MCP protocol implementation:
- HTTP server with SSE transport
- Tool registration with MCP SDK
- Handles JSON-RPC protocol
Agent WebSocket server with Claude SDK integration:
- Multi-session WebSocket server for concurrent agents
- Direct tool execution via shared WebSocketManager (no HTTP overhead)
- Claude SDK integration with in-process MCP
- Automatic session management and cleanup
Unified server orchestrating all components:
- Starts HTTP MCP server and Agent WebSocket server
- Single WebSocketManager shared by both MCP and Agent
- CLI argument parsing with enable/disable flags
- Graceful shutdown and resource cleanup
Tests use Puppeteer with a real Chrome browser. All tests are in packages/*/tests/:
# Run all tests
bun test:all
# Run with coverage
bun test --coverage
# Run specific package tests
bun test packages/tools
# Run specific test file
bun test packages/tools/tests/tools/pages.test.tsCurrent coverage across 16 test files with 26 tests passing.
The server provides 26 browser automation tools:
- Input automation (7 tools)
- Navigation automation (7 tools)
- Emulation (3 tools)
- Performance (3 tools)
- Network (2 tools)
- Debugging (4 tools)
# Default startup (MCP + Agent on default ports)
bun start
# Connect to existing Chrome instance (optional)
bun start --cdp-port=9222
# Specify server ports
bun start --http-mcp-port=9223 --agent-port=3000 --extension-port=9224
# Disable MCP HTTP server (Agent-only mode)
bun start --disable-mcp-server
# Disable Agent server (MCP-only mode)
bun start --disable-agent-server
# Full example
bun start --cdp-port=9222 --http-mcp-port=9223 --agent-port=3000 --extension-port=9224node packages/agent/scripts/tests/test-client.ts
Required for Agent:
ANTHROPIC_API_KEY- Anthropic API key for Claude SDK (required for agent functionality)
Agent Configuration:
MAX_SESSIONS- Maximum concurrent agent sessions (default: 5)SESSION_IDLE_TIMEOUT_MS- Session idle timeout in milliseconds (default: 90000)EVENT_GAP_TIMEOUT_MS- Max time between agent events in milliseconds (default: 60000)
Optional:
PUPPETEER_EXECUTABLE_PATH- Path to Chrome executableDEBUG=mcp:*- Enable debug loggingLOG_LEVEL- Logging level (debug, info, warn, error)NODE_ENV- Environment (development, production)
- Unified Process: MCP and Agent run in single server process
- Shared WebSocket: Single WebSocketManager for extension connection
- Zero Overhead: Agent uses in-process SDK MCP (direct function calls)
- Single Binary: Everything compiles to one executable
- Shared Tools: Both MCP and Agent use same tool implementations
- No Duplication: One source of truth for browser automation
- Type Safety: Full TypeScript with Zod validation
- Modular: Each package has single responsibility
See CONTRIBUTING.md for development guidelines.
AGPL-3.0 or later
See docs/troubleshooting.md for common issues.