@wpscholar/browser-bridge
v1.0.0
Published
Chrome extension that exposes browser APIs (tabs, bookmarks, history, tab groups, windows, sessions, top sites) as MCP tools
Maintainers
Readme
Browser Bridge
A Chrome extension that exposes Chrome browser APIs as MCP (Model Context Protocol) tools, enabling AI assistants like Claude Desktop to interact with your browser.
Architecture
Browser Bridge uses WebSocket communication between the extension and local server:
- Chrome Extension (background service worker) - Handles Chrome API calls, communicates via WebSocket
- Server (Node.js process) - Runs WebSocket server for extension communication and MCP server
- MCP Server - Exposes browser tools via MCP protocol (HTTP or stdio transport)
- MCP Client (external, e.g., Claude Desktop) - Connects to the MCP server
MCP Client (Claude Desktop or HTTP client)
↕ (stdio or HTTP/SSE)
MCP Server (Node.js)
↕ (WebSocket - port 58080)
Chrome Extension (Service Worker)
↕ (Chrome APIs)
Browser (Tabs/Bookmarks/History)Key Design Decision: Chrome extension communication uses WebSocket instead of native messaging, freeing up stdin/stdout for MCP stdio transport (required for Claude Desktop compatibility). WebSocket provides reliable bidirectional communication that works well in Chrome extension service workers.
Features
Tab Management
chrome_list_tabs- List all open tabschrome_open_tab- Open a new tabchrome_close_tab- Close tabschrome_query_tabs- Search/filter tabschrome_update_tab- Update tab properties (URL, muted, etc.)chrome_group_tabs- Organize tabs into groupschrome_move_tab- Move a tab to a new position or windowchrome_ungroup_tabs- Remove tabs from their groupschrome_get_tab- Get a tab by its ID
Bookmark Management
chrome_create_bookmark- Create a bookmarkchrome_delete_bookmark- Delete bookmarkschrome_search_bookmarks- Search bookmarkschrome_update_bookmark- Update bookmark propertieschrome_get_bookmark_tree- Get bookmark folder structurechrome_get_bookmark- Get a bookmark by its IDchrome_get_bookmark_children- Get a folder's direct childrenchrome_get_recent_bookmarks- Get recently added bookmarkschrome_get_bookmark_subtree- Get a bookmark and all descendantschrome_move_bookmark- Move a bookmark or folderchrome_remove_bookmark_tree- Delete a bookmark folder and its contents
History Management
chrome_search_history- Search browsing historychrome_delete_history_url- Delete a specific URL from historychrome_delete_history_range- Delete history entries within a time rangechrome_get_visits- Get all visits for a specific URLchrome_get_recent_history- Get recent browsing historychrome_clear_all_history- Clear all browsing history
Tab Groups Management
chrome_get_tab_group- Get details about a specific tab groupchrome_move_tab_group- Move a tab group to a different positionchrome_query_tab_groups- Query tab groups based on criteriachrome_update_tab_group- Modify tab group properties (title, color, etc.)
Windows Management
chrome_get_window- Get a window by its IDchrome_get_all_windows- Get all windowschrome_get_current_window- Get the current windowchrome_get_last_focused_window- Get the last focused windowchrome_create_window- Create a new windowchrome_update_window- Update window propertieschrome_remove_window- Remove (close) a window
Sessions Management
chrome_get_recently_closed- Get recently closed tabs and windows
Top Sites
chrome_get_most_visited- Get the most frequently visited sites
Page Interaction
chrome_execute_script- Read text, HTML, form values, or attributes using reviewed page-content actionschrome_click_element- Click the first element matching a CSS selectorchrome_type_text- Fill an input, textarea, or contenteditable elementchrome_insert_css- Insert CSS into a page
Page interaction requires the extension's <all_urls> host permission. The
bridge only exposes fixed, structured actions; it does not execute arbitrary
JavaScript received from MCP clients.
Navigation State
chrome_wait_for_navigation- Wait for a tab to reach a navigation milestonechrome_get_frames- List the frames in a tab
Screenshot Capture
chrome_capture_tab- Capture the active tab's visible viewport as a PNG or JPEG image
Downloads
chrome_search_downloads- Search downloadschrome_download_file- Start a downloadchrome_cancel_download- Cancel a downloadchrome_pause_download- Pause a downloadchrome_resume_download- Resume a downloadchrome_open_download- Open a downloaded filechrome_show_download_in_folder- Reveal a downloaded file in its folder
Browser UI
chrome_set_badge- Set the extension action badgechrome_show_notification- Show a desktop notification
Prerequisites
- Node.js 24 or higher
- Google Chrome browser
- npm or yarn package manager
Quick Start
- Install Browser Bridge from the Chrome Web Store once it is published. Until then, download the versioned extension ZIP from the project's release assets, extract it, and load the extracted directory from
chrome://extensions/with Developer mode enabled. - Open the extension's Options page, click Generate to create an auth token, then Save.
- Expand Set up your MCP client, copy the configuration, and paste it into your MCP client. See the MCP local server setup guide.
Example configuration after this package is published as @wpscholar/browser-bridge:
{
"mcpServers": {
"browser-bridge": {
"command": "npx",
"args": ["--yes", "@wpscholar/browser-bridge"],
"env": {
"BROWSER_BRIDGE_AUTH_TOKEN": "replace-with-the-token-from-extension-options"
}
}
}
}npx downloads and runs the npm package when the MCP client starts. The server starts its localhost WebSocket bridge automatically; do not start host.js alongside this configuration.
See INSTALLATION.md for manual ZIP installation, multiple profiles, HTTP MCP clients, and troubleshooting.
Running from Source
For development, clone the repository and install dependencies:
npm installLoad the extension directory through chrome://extensions/, then start the HTTP MCP server:
BROWSER_BRIDGE_AUTH_TOKEN=replace-with-a-long-random-secret npm startThis starts the extension WebSocket server on ws://127.0.0.1:58080 and the MCP HTTP server on http://127.0.0.1:6001. Configure the same token in the extension Options page (use Generate for a secure random value).
Multiple Chrome Profiles
If you run more than one Chrome profile — or different Chromium-based browsers — configure each one through the extension's Options page. Each profile has its own isolated chrome.storage.local, so its port and auth token do not affect another profile:
- Start each server instance with a distinct port and token, e.g.
BROWSER_BRIDGE_CHROME_PORT=58081 BROWSER_BRIDGE_AUTH_TOKEN=profile1-secret npm startfor profile 1,BROWSER_BRIDGE_CHROME_PORT=58082 BROWSER_BRIDGE_AUTH_TOKEN=profile2-secret npm startfor profile 2 (or set both in each MCP client config'senvfield). - In each profile, go to
chrome://extensions/→ BrowserBridge → Details → Extension options, expand Advanced settings, and set the matching port and auth token. - The extension reconnects immediately on save — no reload needed.
Ports are restricted to 58080-58089 (declared in manifest.json's host_permissions); to support more than 10 simultaneous profiles, widen that range and reload the extension.
Connecting MCP Clients
Claude Desktop
✅ Claude Desktop is now supported! The Chrome extension communicates over WebSocket, freeing up stdin/stdout for MCP stdio transport.
The easiest setup path is the extension Options page:
- Open
chrome://extensions/→ BrowserBridge → Details → Extension options. - Click Generate to create a secure auth token, then Save.
- Expand Set up your MCP client, review the live JSON, and click Copy configuration.
- Paste it into your MCP client config. See the MCP local server setup guide.
- Restart your MCP client.
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
The copied configuration uses NPX after this package is published as
@wpscholar/browser-bridge:
{
"mcpServers": {
"browser-bridge": {
"command": "npx",
"args": ["--yes", "@wpscholar/browser-bridge"],
"env": {
"BROWSER_BRIDGE_CHROME_PORT": "58080",
"BROWSER_BRIDGE_AUTH_TOKEN": "replace-with-a-long-random-secret"
}
}
}
}If you change the Options-page port or token, the JSON preview updates immediately. Copy again and restart your MCP client so both sides stay in sync.
Important Notes:
- Requires Node.js 24+ on the machine running the MCP client
- Do NOT run
host.jswhen using Claude Desktop — the NPX/mcp-stdio.jsentry point starts the Chrome extension WebSocket server automatically - If you get a "port already in use" error, make sure
host.jsis not running - Make sure the Chrome extension is loaded in Chrome
- Restart your MCP client after updating the configuration
- Copied configuration includes a secret; do not share screenshots of it or commit it
Local development without NPX
While developing from a git checkout before the package is published, point Claude Desktop at the local stdio entry point instead:
{
"mcpServers": {
"browser-bridge": {
"command": "node",
"args": ["/absolute/path/to/server/mcp-stdio.js"],
"env": {
"BROWSER_BRIDGE_CHROME_PORT": "58080",
"BROWSER_BRIDGE_AUTH_TOKEN": "replace-with-a-long-random-secret"
}
}
}
}Example path (adjust for your system):
- macOS/Linux:
/Users/yourusername/Sites/browser-bridge/server/mcp-stdio.js - Windows:
C:\\Users\\YourUsername\\Sites\\browser-bridge\\server\\mcp-stdio.js
Other MCP Clients (HTTP-based)
Any MCP client that supports HTTP/SSE transport can connect to:
- URL:
http://127.0.0.1:6001/mcp - Transport: Streamable HTTP (SSE)
- Authentication:
Authorization: Bearer <token>
For HTTP clients, start the server with:
BROWSER_BRIDGE_AUTH_TOKEN=replace-with-a-long-random-secret npm startThis starts both the Chrome extension server (port 58080) and MCP HTTP server (port 6001). HTTP clients must send BROWSER_BRIDGE_AUTH_TOKEN as their bearer token.
Development
Project Structure
browser-bridge/
├── extension/ # Chrome extension files
│ ├── manifest.json # Extension manifest
│ ├── background.js # Service worker
│ ├── config.js # Static fallback port + auth token + npm package name
│ ├── options.html # Per-profile options, token generator, MCP setup UI
│ ├── options.js # Options page logic (chrome.storage.local)
│ └── icons/ # Extension icons
├── server/ # Server (WebSocket + MCP server)
│ ├── host.js # HTTP server for extension + MCP (HTTP mode)
│ ├── mcp-stdio.js # Entry point for Claude Desktop (stdio mode)
│ ├── mcp-server.js # MCP server implementation
│ ├── config.js # Shared port configuration/constants
│ ├── chrome-bridge.js # Authenticated WebSocket bridge to the extension
│ ├── tools/ # Tool implementations
│ │ ├── tabs.js
│ │ ├── bookmarks.js
│ │ ├── history.js
│ │ ├── tabGroups.js
│ │ ├── windows.js
│ │ ├── sessions.js
│ │ ├── topSites.js
│ │ ├── downloads.js
│ │ ├── webNavigation.js
│ │ ├── action.js
│ │ ├── scripting.js
│ │ ├── capture.js
│ │ └── notifications.js
└── package.json # Root package.json (dependencies and scripts)Testing
For HTTP-based MCP clients:
- Load the extension in Chrome (Developer mode)
- Start the server:
BROWSER_BRIDGE_AUTH_TOKEN=replace-with-a-long-random-secret npm start - Connect an MCP client to
http://127.0.0.1:6001/mcp - Test tool calls through the MCP client
For Claude Desktop (stdio-based):
- Load the extension in Chrome (Developer mode)
- Configure Claude Desktop from the Options-page setup JSON (or a local
mcp-stdio.jspath) - Restart Claude Desktop
- The server will start automatically when Claude Desktop connects
- Test tool calls through Claude Desktop
Debugging
- Check Chrome extension background service worker logs in
chrome://extensions/ - Server logs are written to stderr (will appear in terminal)
- MCP server logs are written to stderr
- Verify the extension WebSocket connection by checking network requests in Chrome DevTools (look for
/chrome/ws) - For Claude Desktop, check that
mcp-stdio.jspath is correct and executable
Enable extension bridge tracing
The extension keeps routine WebSocket, authentication, keep-alive, and Chrome API request/response logs off by default. To trace that flow:
- Go to
chrome://extensions/→ BrowserBridge → Details → Extension options. - Expand Advanced settings, enable debug logging, and click Save.
- Open the BrowserBridge service worker console from the extension's details page, then reproduce the issue.
- Disable the setting and save when finished.
Errors, authentication failures, and failed Chrome API calls are always logged, even when debug tracing is disabled.
Security Considerations
- The extension requests browser-management permissions plus
scriptingand<all_urls>to support page interaction on tabs the user has already opened. - All Chrome API calls are validated
- The servers run on localhost only (127.0.0.1)
- The WebSocket bridge and HTTP MCP endpoint require authentication tokens.
- The HTTP MCP endpoint does not configure CORS; it is bound to localhost.
- Page text, HTML, form values (including password fields), and screenshots can be returned to the connected MCP client. Treat page content as untrusted: malicious pages can contain prompt-injection instructions. The MCP client and its AI model handle returned data under their own policies.
Troubleshooting
Extension not connecting to server
- Verify the server is running with a non-empty
BROWSER_BRIDGE_AUTH_TOKEN - Check that port 58080 is not in use by another process
- Check Chrome extension background service worker logs for connection errors
- If using a custom port, set the matching port and auth token on the extension Options page. For a single profile, you can instead update the static fallback values in
extension/config.jsand reload the unpacked extension.
MCP server not starting
- Ensure Node.js 24+ is installed
- Check that all dependencies are installed:
npm install - Verify ports 58080 and 6001 (or your configured ports) are not in use
- Check stderr for error messages
Claude Desktop not connecting
- Verify the path to
mcp-stdio.jsis absolute and correct when using a source checkout - Check that Node.js is in your PATH
- Verify the file is executable (Unix/Linux/macOS):
chmod +x server/mcp-stdio.js - Check Claude Desktop logs for connection errors
- Ensure the Chrome extension is loaded and the server (port 58080) is running
Tools not working
- Verify the extension has the necessary permissions
- Check the background service worker for errors
- Ensure the server is running
- For HTTP clients: Verify MCP client is connected to
http://127.0.0.1:6001/mcpand sends its configured bearer token - For Claude Desktop: Check that the stdio server started successfully
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
