Chrome Extension Bridge MCP
A chrome extension bridge that allows you to connect to a mcp server to use global window object.
Oanakiaja
README
Chrome Extension Bridge MCP
A Chrome extension that establishes a WebSocket connection between web pages and a local MCP server. This allows you to interact with web page resources and execute functions from your mcp server.
Inspired by playcanvas/editor-mcp-server.
Overview
This project consists of two main components:
- Chrome Extension: Injects a client script into web pages that establishes a WebSocket connection to your local server.
- Local MCP Server: A WebSocket server that can send commands to the extension and receive responses.
With this setup, you can:
- Access browser APIs and DOM elements from your local server
- Execute JavaScript functions in the context of web pages
- Retrieve resources and information from web pages
- Especially, access the global object like editor, e.x : https://threejs.org/editor/. You can use
window.editor
which is exposed by the website to control the editor. Just like playcanvas/editor-mcp-server.
Installation
Setup
- Clone the repository:
git clone https://github.com/yourusername/chrome-extension-socket-mcp.git
cd chrome-extension-socket-mcp
- Install dependencies:
npm install
Development
Run the following command to build the extension in development mode:
npm run debug
Loading the Extension
- Open Chrome and navigate to
chrome://extensions/
- Enable "Developer mode" by toggling the switch in the top right corner
- Click "Load unpacked" and select the
extension
folder from this project - The extension is now installed. You should see a small red indicator in the top right corner of any web page indicating "MCP Extension Loaded"
Usage
Server-side
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
import { Client } from "../src/client";
// Define the port for WebSocket connection
// This should match the port in your Chrome extension's WebSocket connection
const port = 54319;
const client = new Client(port);
// Establish connection to the Chrome extension
await client.connect();
// Create a new MCP server instance with name and version
const server = new McpServer({
name: "Extension-Socket-Server",
version: "1.0.0",
});
// Register a tool that executes the window.alert function in the browser
// This demonstrates how to interact with browser APIs from your server
server.tool(
"alert", // Tool name
"use window.alert", // Tool description
{ message: z.string() }, // Tool parameters schema using Zod
async ({ message }) => { // Tool implementation function
// Call the extension to execute alert in the browser context
const response = await client.callToolExtension("alert", { message });
return response;
}
);
// Register a resource to retrieve the browser's user agent
// This demonstrates how to access browser properties from your server
server.resource(
"userAgent", // Resource name
"useragent://chrome", // Resource URI template
async (uri) => { // Resource handler function
// Get the user agent from the browser
const { content } = await client.callResourceExtension("navigator.userAgent");
// Return the formatted resource
return {
contents: [
{
uri: uri.href,
text: content[0].text,
},
],
};
}
);
// Set up a transport layer for the MCP server
// StdioServerTransport uses standard input/output for communication
const transport = new StdioServerTransport();
await server.connect(transport);
// Handle application termination gracefully
process.on("SIGINT", async () => {
console.log("SIGINT signal received"); // Log when SIGINT is received
await client.dispose(); // Close the WebSocket connection
process.exit(0); // Exit the process
});
Extension-side
The extension automatically connects to ws://localhost:54319
by default. You can modify this in extension/content.js
.
The extension exposes two main entry points for server commands:
mcp:resource.*
- For accessing browser resources and propertiesmcp:tool.*
- For executing functions in the browser context
API Reference
Client
new Client(port)
- Create a new client instance connecting to specified portconnect()
- Connect to the MCP servercallToolExtension(toolName, params)
- Call a tool in the browsercallResourceExtension(resourceName, params)
- Get a resource from the browserdispose()
- Close the connection
WebSocket Protocol
The extension uses a simple JSON-RPC-like protocol:
Request:
{
"id": "unique-request-id",
"method": "mcp:resource.navigator.userAgent",
"params": {}
}
Response:
{
"id": "unique-request-id",
"result": "Mozilla/5.0 ..."
}
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.