VPS Browser MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@VPS Browser MCPtake a screenshot of the active tab"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
VPS Browser MCP
Control your local Chrome browser from a remote VPS. Cross-platform Chrome extension with WebSocket bridge for secure remote browser automation. MCP (Model Context Protocol) compatible.
π― What is this?
VPS Browser MCP is a system that allows you to remotely control and inspect a Chrome browser running on your personal laptop from a Virtual Private Server (VPS). It's perfect for:
Remote debugging web applications
Automated testing from different network locations
Secure browser automation without exposing your browser publicly
Web scraping with full browser capabilities
Remote technical support and troubleshooting
AI/LLM integration via MCP (Model Context Protocol)
Related MCP server: Chrome DevTools MCP
ποΈ Architecture
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β VPS Agent βββββΊβ Local Bridge βββββΊβ Chrome Extensionβ
β (Node.js) β β (Node.js) β β (Manifest V3) β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
β β β
βΌ βΌ βΌ
WebSocket WebSocket Chrome APIs
(Tailscale/SSH) (localhost) (tabs, scripting)Components
Chrome Extension (Manifest V3)
Runs in your local Chrome browser
Executes browser actions via Chrome APIs
Maintains WebSocket connection to local bridge
Handles tab management, DOM inspection, script execution
Local Bridge (Node.js)
Lightweight service running on your laptop
Bridges WebSocket connections between VPS and Chrome extension
Routes commands and responses
Keeps connections alive with ping/pong
VPS Agent (Node.js)
Module running on your remote server
Sends structured JSON commands
Receives execution results and logs
Simple API for browser automation
π Quick Start
Prerequisites
Node.js (v16 or higher) - Download
Chrome browser - Download
Remote access (optional): SSH or Tailscale
Installation
# Clone the repository
git clone https://github.com/Parithosh-Varma/VPS-browser-MCP.git
cd VPS-browser-MCP
# Run setup (installs dependencies)
npm run setup
# Install Chrome extension
npm run install-extension
# Start the bridge
npm start3-Step Usage
Setup:
npm run setup(one-time installation)Install Extension:
npm run install-extension(opens Chrome extensions page)Start:
npm start(launches WebSocket bridge)
π Usage Examples
Basic Commands
const BrowserController = require('./vps_agent/vps_client_example');
// Create controller instance
const browser = new BrowserController();
await browser.connect();
// Get current page URL and title
const pageInfo = await browser.getUrl();
console.log(pageInfo);
// { url: 'https://example.com', title: 'Example Domain' }
// Click an element
await browser.click('#submit-button');
// Type in a search box
await browser.type('#search-input', 'hello world');
// Execute custom JavaScript
const result = await browser.executeJs('document.title.length');
console.log(result); // 13
// Take a screenshot
const screenshot = await browser.screenshot();
// Returns base64 encoded PNG image
// Get DOM content
const dom = await browser.getDom();
console.log(dom.html); // Full page HTML
console.log(dom.elements); // Array of elementsAdvanced Usage
// Execute complex JavaScript
const complexResult = await browser.executeJs(`
// Get all links on the page
const links = Array.from(document.querySelectorAll('a'));
links.map(link => ({
text: link.textContent,
href: link.href
}));
`);
// Get specific element's DOM
const elementDom = await browser.getDom('#main-content');
// Type with validation
await browser.type('input[name="email"]', 'user@example.com');
// Click and wait for navigation
await browser.click('a[href="/dashboard"]');π οΈ Available Commands
Command | Description | Returns |
| Get active tab URL and title |
|
| Get DOM HTML or specific element |
|
| Click an element by CSS selector |
|
| Type text into input field |
|
| Execute JavaScript in page context |
|
| Capture tab screenshot |
|
π Security Features
No public exposure: Extension only connects to localhost
Encrypted tunneling: Use SSH or Tailscale for remote access
Local execution: Scripts run in your browser's security context
Permission-based: Extension only accesses what you allow
No data storage: Everything runs in memory, no logs saved
π Remote Access Options
Option 1: SSH Tunnel (Recommended)
On your VPS:
# Create SSH tunnel to forward port 9877
ssh -R 9877:127.0.0.1:9877 user@your-laptop-ip -N
# Keep tunnel running in background
ssh -R 9877:127.0.0.1:9877 user@your-laptop-ip -N -fOn your VPS (in another terminal):
# Connect to the bridge
node vps_agent/vps_client_example.jsOption 2: Tailscale (Zero-Config)
Install Tailscale on both machines:
# macOS/Linux curl -fsSL https://tailscale.com/install.sh | sh # Windows: Download from https://tailscale.com/download/Login on both machines:
tailscale upUse the Tailnet IP in your connection:
const browser = new BrowserController('ws://100.x.x.x:9877');
π Project Structure
VPS-browser-MCP/
βββ extension/ # Chrome Extension
β βββ manifest.json # Extension configuration
β βββ background.js # Service worker (WebSocket handler)
β βββ content.js # Content script (page injection)
β βββ inject.js # Injected script (DOM access)
β
βββ local_bridge/ # Bridge Server
β βββ local_bridge.js # WebSocket bridge server
β βββ package.json # Dependencies
β
βββ vps_agent/ # VPS Client
β βββ vps_client_example.js # Example client with BrowserController class
β βββ package.json # Dependencies
β
βββ setup.js # Cross-platform setup script
βββ start.js # Cross-platform service starter
βββ install-extension.js # Chrome extension installer
βββ package.json # Root package configuration
βββ README.md # This file
βββ LICENSE # MIT Licenseπ¨ Features
Chrome Extension Capabilities
Tab Management: Query, create, update, and remove tabs
DOM Inspection: Query elements, get HTML, inspect attributes
Script Execution: Run arbitrary JavaScript in page context
Event Handling: Click elements, type text, trigger events
Screenshot Capture: Take PNG screenshots of visible tabs
Console Access: Capture console logs and errors
Bridge Features
Bidirectional Communication: Commands flow VPS β Extension, results flow back
Connection Management: Automatic reconnection and keep-alive
Multiple Clients: Support for multiple VPS agents simultaneously
Message Routing: Proper command/response correlation with UUIDs
Error Handling: Graceful error recovery and reporting
VPS Agent Features
Simple API: Easy-to-use methods for common operations
Async/Await: Modern JavaScript async patterns
Type Safety: Clear result types and error handling
Extensible: Easy to add custom commands
Logging: Built-in logging for debugging
π§ Configuration
Environment Variables
Create a .env file (created automatically by setup):
# Extension WebSocket port (Chrome connects here)
EXTENSION_WS_PORT=9876
# VPS Agent WebSocket port (Remote agent connects here)
VPS_WS_PORT=9877
# VPS Agent connection URL
VPS_WS_URL=ws://127.0.0.1:9877Chrome Extension Permissions
The extension requires these permissions:
tabs: Access tab informationactiveTab: Access current active tabscripting: Execute scripts in tabswebNavigation: Monitor page navigation
π Troubleshooting
Extension not connecting?
Ensure the bridge is running:
npm startCheck Chrome console for errors: Right-click extension β Inspect
Verify WebSocket port is available:
netstat -an | grep 9876
VPS can't connect?
Verify SSH tunnel is active:
ssh -R 9877:127.0.0.1:9877 user@laptop-ip -NCheck firewall allows port 9877
Test connection:
telnet localhost 9877
Commands not working?
Ensure extension has required permissions (check chrome://extensions/)
Check Chrome DevTools console for errors
Verify the page you're trying to control is fully loaded
Bridge crashes?
Check Node.js version:
node --version(need v16+)Reinstall dependencies:
npm run setupCheck for port conflicts:
lsof -i :9876ornetstat -an | grep 9876
π JSON Command Schema
Request Format
{
"id": "uuid-v4-string",
"action": "get_url | get_dom | click | type | execute_js | screenshot",
"target": "current_tab | tab_id | {selector: string}",
"payload": {
"text": "string",
"js": "string",
"selector": "css-selector",
"wait": 0
},
"timestamp": "ISO-8601-UTC-string"
}Response Format
{
"id": "matching-request-id",
"status": "ok | error",
"result": {},
"error": {
"code": "ERR_TIMEOUT | ERR_NOT_FOUND | ERR_PERMISSION",
"message": "human-readable error"
},
"timestamp": "ISO-8601-UTC-string"
}π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Fork the repository
Create your feature branch (
git checkout -b feature/AmazingFeature)Commit your changes (
git commit -m 'Add some AmazingFeature')Push to the branch (
git push origin feature/AmazingFeature)Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
WebSocket - Browser API for real-time communication
Chrome Extensions - Chrome extension documentation
Node.js - JavaScript runtime for bridge and VPS agent
ws - WebSocket library for Node.js
π Support
If you have any questions or issues, please:
Check the Troubleshooting section
Open an issue on GitHub Issues
Contact: [Your Email or Discord]
Made with β€οΈ for the developer community
This server cannot be deployed
Maintenance
Related MCP Connectors
Automate cloud Chromeβnavigate, click, type, screenshot, run code, record screen video
remote debug iOS/Android/Unity/Godot/Flutter/RN/Web on real-device.ui-tree/screenshots/taps,tests.
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
- TabfleetOAuthcom.tabfleet
Launch, inspect, control, and share isolated cloud browsers for your agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceControls Chrome browser with debugging capabilities, allowing page automation, extension management, and userscript injection through the Model Context Protocol.45-
- AlicenseAqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automation, debugging, performance analysis, and screenshot capture through Chrome DevTools.261,000,705 npm3Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automation, debugging, performance analysis, network monitoring, and DOM interaction through Chrome DevTools Protocol.1,000,705 npmApache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser through Chrome DevTools for automation, debugging, and performance analysis.1,000,705 npmApache 2.0