chrome-extension-bridge
A chrome extension bridge that allows you to connect to a mcp server to use global window object.
claude mcp add --transport stdio oanakiaja-chrome-extension-bridge-mcp node path/to/server.js \ --env PORT="54319"
How to use
This MCP server enables a local bridge to a Chrome extension that injects a client script into web pages and communicates over WebSocket. The server runs on your machine and exposes tools and resources you can invoke from your MCP client. For example, you can register a tool that calls window.alert in the browser, or fetch the browser's userAgent as a resource. The extension side connects to ws://localhost:54319 by default, allowing the server to send commands to the browser context and receive responses. Use the provided server setup to interact with web pages in real time, execute JavaScript in the page context, and retrieve page resources or properties such as navigator.userAgent. The workflow follows a simple JSON-RPC style protocol between the server and the extension client, enabling structured requests and responses for tools and resources.
How to install
Prerequisites:
- Node.js (LTS) and npm installed
Installation steps:
-
Clone the repository: git clone https://github.com/yourusername/chrome-extension-socket-mcp.git cd chrome-extension-socket-mcp
-
Install dependencies: npm install
-
Build/run the server in development mode (if applicable): npm run debug
-
Ensure the Chrome extension is loaded in Chrome and configured to connect to ws://localhost:54319 as described in the README.
-
Start the local MCP server (if not using npm script): node path/to/server.js
Additional notes
Tips and notes:
- Ensure the Chrome extension is loaded and the extension indicator shows MCP Extension Loaded on pages you test.
- The server uses port 54319 by default (adjust if needed) and the extension connects to that port.
- When registering tools, you can execute browser APIs (e.g., window.alert) or fetch page resources via the extension bridge. Maintain proper security considerations when exposing browser capabilities.
- If you modify extension/content.js or the server, restart the MCP server to apply changes.
- Common issues include port conflicts, extension not loading due to Chrome flags, or mismatched WebSocket ports between server and extension. Verify ws://localhost:54319 connectivity with a simple client first.
- The API supports resource names like userAgent and tool names like alert; expand by implementing additional resource/tool handlers as needed.
Related MCP Servers
context7
Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
web-eval-agent
An MCP server that autonomously evaluates web applications.
bitbucket
Bitbucket MCP - A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs
editor
MCP Server for AI automation of the PlayCanvas Editor
job-searchoor
A simple MCP server that delivers you jobs based on your needs
unity-editor
An MCP server and client for LLMs to interact with Unity Projects