A Chrome extension that allows you to inspect HTML elements on web pages and send them to Cursor for analysis via MCP (Model Context Protocol) integration.
- Element Inspection: Right-click on any element and select "Inspect with Cursor"
- Visual Highlighting: Elements are highlighted when you hover over them during inspection
- HTML Extraction: Automatically extracts the full HTML code of selected elements
- User Input: Add your own message or question about the element
- Two-Button Interface: Choose between "Copy to Clipboard" or "Send to Cursor"
- MCP Integration: Direct communication with Cursor via Model Context Protocol
- Fallback Support: Automatic fallback to clipboard when MCP server unavailable
- Smart Error Handling: Clear user feedback and instructions
-
Clone the repository:
git clone https://github.com/TheSnowGuru/cursor-ext.git cd cursor-ext -
Load in Chrome:
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode" in the top right
- Click "Load unpacked" and select the extension directory
- The extension should now appear in your extensions list
- Open Chrome and go to
For direct communication with Cursor, follow the complete setup guide:
-
Install Dependencies:
npm install
-
Configure Cursor MCP:
- Add the MCP server to your Cursor configuration
- See
COMPLETE_SETUP.mdfor detailed instructions
-
Start MCP Server:
node mcp-http-bridge.js
-
Load Chrome Extension (as above)
- Right-click on any element on any webpage
- Select "Inspect with Cursor" from the context menu
- Click on an element to select it (it will be highlighted in blue)
- A modal dialog opens with:
- Element information displayed
- Text area for your message
- Two buttons: "Copy to Clipboard" and "Send to Cursor"
- Enter your message and choose your action:
- "Copy to Clipboard": Copies formatted data to clipboard
- "Send to Cursor": Attempts MCP communication, falls back to clipboard
- Paste into Cursor (if using clipboard) or see direct integration message
The extension copies a formatted message containing:
- Element tag name, class, ID, and text content
- Page title, URL, and domain information
- Full HTML code of the element
- Your message/question
- Timestamp
cursor-ext/
├── manifest.json # Extension configuration
├── background.js # Background service worker
├── content.js # Content script for web pages
├── mcp-server.js # MCP server for Cursor integration
├── mcp-http-bridge.js # HTTP bridge for Chrome extension
├── package.json # Node.js dependencies
├── test.html # Test page for the extension
├── create_icons.html # Icon generator tool
├── icons/ # Extension icons
│ ├── icon.svg # SVG reference
│ ├── icon16.png # 16x16 icon
│ ├── icon48.png # 48x48 icon
│ └── icon128.png # 128x128 icon
├── COMPLETE_SETUP.md # Complete setup instructions
├── MCP_SETUP.md # MCP-specific setup
└── README.md # This file
-
Background Script (
background.js):- Creates the right-click context menu
- Handles MCP communication with Cursor
- Manages fallback to clipboard when MCP unavailable
-
Content Script (
content.js):- Runs on web pages
- Handles element inspection and highlighting
- Shows modal dialog with two-button interface
- Extracts HTML code from selected elements
- Sends data to background script for processing
-
MCP Server (
mcp-server.js):- Implements Model Context Protocol for Cursor integration
- Receives messages from Chrome extension via HTTP bridge
- Processes and forwards data to Cursor
-
HTTP Bridge (
mcp-http-bridge.js):- Acts as communication layer between Chrome extension and MCP server
- Handles CORS and HTTP requests
- Provides fallback error handling
The extension supports two integration methods:
- Direct Communication: Uses Model Context Protocol for real-time communication
- Automatic Setup: Configure once in Cursor's MCP settings
- Real-time Feedback: Immediate confirmation when messages are sent
- Universal Compatibility: Works with any Cursor setup
- Simple Operation: Just paste the copied data into Cursor
- No Configuration: Works out of the box
You can customize the extension by modifying:
- Colors and Styling: Edit the CSS in
popup.html - Element Selection: Modify the highlighting logic in
content.js - Data Format: Change how data is formatted for Cursor in
popup.js - Permissions: Update
manifest.jsonif you need additional permissions
- Extension not loading: Check that all files are present and
manifest.jsonis valid - Icons not showing: Ensure PNG icon files exist in the
iconsfolder - Element not selecting: Make sure the content script is running (check browser console)
- Popup not opening: Verify the extension has the necessary permissions
To modify the extension:
- Make your changes to the relevant files
- Go to
chrome://extensions/ - Click the refresh icon on the extension card
- Test your changes
Contributions are welcome! Please feel free to submit a Pull Request.
- GitHub: https://github.com/TheSnowGuru/cursor-ext
- Issues: Report bugs or request features on GitHub Issues
- Discussions: Join the conversation in GitHub Discussions
This project is open source and available under the MIT License.