Page Control MCP Server and Chrome Extension
This project consists of two main components:
- A Node.js MCP server that communicates with an AI editor such as Zencoder or Cursor
- A Chrome extension that controls web pages
MCP Server Setup
Prerequisites
- Node.js (v14 or higher)
- npm (Node Package Manager)
Installation
-
Navigate to the MCP server directory:
cd mcp-server -
Install dependencies:
npm install -
Start the server:
npm start
The server will start on port 4000 and the WebSocket server on port 3001.
Zencoder Configuration (STDIO)
Open Zencoder settings => MCP servers and paste the following configuration:
{
"page-control": {
"command": "npm",
"args": ["start"],
"cwd": "mcp-server"
}
}
Cursor Configuration
Create or update the .cursor/mcp.json file in your home directory or update through cursor MCP serttings:
For SSE service (requires running the SSE service locally):
{
"mcpServers": {
"page-control": {
"url": "http://localhost:4000/page-control"
}
}
}
For STDIO - note you have to replace the \<\<Path to mcp server directory\>\> with your own local path
{
"mcpServers": {
"page-control": {
"command": "node",
"args": [
"<<Path to mcp server directory>>/mcp-server/page-control-mcp.js", "--stdio-only"
]
}
}
}
Available Tools
The MCP server provides the following tools:
-
query_page: Query elements on a web page/page-control query_page pageId="page_123456" selector=".my-class" -
modify_page: Modify elements on a web page/page-control modify_page targetPage="page_123456" modification='{"selector":".my-class","operation":"setTextContent","value":"New Text"}' -
run_snippet: Execute JavaScript code in the page context/page-control run_snippet pageId="page_123456" code="return document.title;" -
list_pages: List all connected pages/page-control list_pages -
page_control_status: Check the status of the page control server/page-control page_control_status detail_level="full"This returns information about the server status, including:
- Server type (SSE or STDIO)
- Current status
- WebSocket status
- Number of connected pages
- Server uptime in seconds
Chrome Extension Setup
Prerequisites
- Google Chrome browser
- Developer mode enabled in Chrome
Installation
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" in the top right corner
- Click "Load unpacked" and select the
extensiondirectory from this project
Usage
- Click the extension icon in the Chrome toolbar to activate it on the current page
- A confirmation dialog will appear - click "OK" to activate
- The extension will connect to the MCP server and display a control panel
- The extension will automatically deactivate when:
- The page is refreshed
- The tab is closed
- The extension icon is clicked again
Features
- Real-time page control through AI editor
- Visual feedback for actions
- Activity logging
- Automatic reconnection
- Secure code execution
Development
To modify the extension:
- Make changes to the files in the
extensiondirectory - Go to
chrome://extensions/ - Find the extension and click the refresh icon
- The changes will be applied immediately
File Structure
.
├── mcp-server/
│ ├── page-control-mcp.js # Main MCP server implementation
│ ├── page-control-commands.js # Command execution module
│ ├── package.json # Server dependencies
│ └── ...
├── extension/
│ ├── manifest.json # Extension configuration
│ ├── background.js # Background script
│ ├── content.js # Content script
│ ├── icons/ # Extension icons
│ └── ...
├── LICENSE # License information
└── README.md # This file
Troubleshooting
MCP Server Issues
-
If the server fails to start:
- Check if port 4000 is available
- Verify Node.js installation
- Check npm dependencies
-
If AI editor can't connect:
- Verify the MCP server is running
- Check the configuration (
.cursor/mcp.jsonfor Cursor or Zencoder settings) - Restart the AI editor
Extension Issues
-
If the extension doesn't load:
- Verify Developer mode is enabled
- Check for manifest errors
- Try reloading the extension
-
If the extension doesn't connect:
- Verify the MCP server is running
- Check the WebSocket connection
- Try deactivating and reactivating the extension
If the AI agent doesn't use the new MCP capabilities, you might need to notify it about these new capabilities, use the following prompt:
you now have the ability to use a new MCP server capabilities, it is called page-control, it has the following capabilities:
The MCP server provides the following tools:
query_page: Query elements on a web page
/page-control query_page pageId="page_123456" selector=".my-class"
modify_page: Modify elements on a web page
/page-control modify_page targetPage="page_123456" modification='{"selector":".my-class","operation":"setTextContent","value":"New Text"}'
run_snippet: Execute JavaScript code in the page context
/page-control run_snippet pageId="page_123456" code="return document.title;"
list_pages: List all connected pages
/page-control list_pages
page_control_status: Check the status of the page control server
/page-control page_control_status detail_level="full"
please keep this in memory so you do not forget
Recommend MCP Servers 💡
UnrealMCPBridge
An MCP server implementation as an Unreal Engine plugin enabling MCP clients to access the UE Editor Python API.
screenMonitorMCP
A REVOLUTIONARY Model Context Protocol (MCP) server! Gives AI real-time vision capabilities and enhanced UI intelligence power. This isn't just screen capture - it gives AI the power to truly "see" and understand your digital world!
github-follower-manager
Manages GitHub followers using MCP pattern, allowing checking, unfollowing, and analysis of follow relationships.
ros-mcp
A MCP server for controlling ROS robots via natural language using topics, services, and actions
@playwright/mcp
A Model Context Protocol (MCP) server providing browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots.
@agent-infra/mcp-server-browser
A fast, lightweight Model Context Protocol (MCP) server that empowers LLMs with browser automation via Puppeteer’s structured accessibility data, featuring optional vision mode for complex visual understanding and flexible, cross-platform configuration.