Universal Browser MCP allows you to use your web browser as a Model Context Protocol (MCP) server. By connecting an MCP client to your browser, the client can read web pages, execute scripts, and automate browser tasks directly.
The repository is divided into three primary parts:
- extension: A browser extension built with WXT (supporting Chrome and Firefox). It runs in the browser, processes incoming MCP requests, and interacts with web pages.
- native-server: A Node.js native messaging host that bridges the communication between your MCP client and the browser extension. It translates MCP protocol messages over stdio into Native Messaging calls that the browser extension can understand.
- shared: Common types and utilities shared between the extension and the native server.
- An MCP client starts the
native-servervia standard input/output (stdio). - The
native-serverestablishes a connection with the browser extension using Chrome's Native Messaging protocol. - When the MCP client sends a tool execution request (e.g., retrieving page content), the server forwards it to the extension.
- The extension executes the necessary browser APIs and returns the result back through the server to the client.
- Node.js (version 20 or higher)
- npm or pnpm
- Google Chrome or a Chromium-based browser
-
Install dependencies: Navigate to the
extensionandnative-serverdirectories separately and runnpm install. -
Build and load the extension:
- Navigate to the
extensiondirectory. - Run
npm run buildto create a production build. The output will be in the.outputdirectory. - Load the unpacked extension from the
.outputdirectory into your browser via the Extensions management page.
- Navigate to the
-
Register the Native Messaging Host:
- Navigate to the
native-serverdirectory. - Build the server using
npm run build. - Register the host with your browser. You can automatically detect and register installed browsers by running
node dist/cli.js register --detect.
- Navigate to the
Configure your MCP client to use the newly built native server. Provide the path to the native server's stdio entry point.
For example, in your MCP client configuration file:
{
"mcpServers": {
"universal-browser": {
"command": "node",
"args": [
"/absolute/path/to/universal-browser-mcp/native-server/dist/mcp/mcp-server-stdio.js"
]
}
}
}- The
extensionfolder utilizes the WXT framework and Vite for fast browser extension development. - The
native-serverrelies on Fastify and TypeScript. - For detailed development scripts, testing instructions, and architecture diagrams, refer to the individual
README.mdandARCHITECTURE.mdfiles in each sub-directory.