browser-console-mcp-server
v1.0.2
Published
MCP server for browser console access and tab management
Maintainers
Readme
Browser Console MCP Server
A Model Context Protocol (MCP) server that provides browser console access and tab management capabilities for AI assistants. This server enables AI tools to interact with web browser tabs, retrieve console logs, refresh pages, and navigate to different URLs.
Features
- Console Log Retrieval: Get real-time console logs from browser tabs
- Tab Refresh: Refresh specific tabs or the active tab
- Tab Navigation: Navigate tabs to new URLs
- WebSocket Communication: Real-time communication with browser extension
- Cross-Platform: Works on Windows, macOS, and Linux
Installation
Global Installation (Recommended)
npm install -g browser-console-mcp-serverRun with npx (No Installation)
npx browser-console-mcp-serverLocal Installation
npm install browser-console-mcp-serverUsage
Start the Server
# If installed globally
browser-console-mcp
# Or with npx
npx browser-console-mcp-server
# Or if installed locally
npm startThe server will start and listen on ws://localhost:3001 for on-demand browser extension connections.
Browser Extension
You'll also need to install the companion Firefox extension to enable browser communication. The extension connects to the MCP server via WebSocket.
MCP Tools
This server provides the following MCP tools:
get_console_logs
Retrieve console logs from the active browser tab or a specific tab.
Parameters:
tabId(optional): Specific tab ID. If not provided, uses the active tablimit(optional): Maximum number of logs to return (default: 100)
refresh_tab
Refresh the active browser tab or a specific tab.
Parameters:
tabId(optional): Specific tab ID. If not provided, refreshes the active tab
navigate_tab
Navigate the active browser tab or a specific tab to a new URL.
Parameters:
url(required): The URL to navigate totabId(optional): Specific tab ID. If not provided, navigates the active tab
Configuration
The server uses the following default configuration:
- Port: 3001 (configurable via
WS_PORTenvironment variable) - Host: localhost
- Protocol: WebSocket
- Connection Pattern: On-demand connections for task execution
Environment Variables
WS_PORT: WebSocket server port (default: 3001)NODE_ENV: Environment mode (development/production)
Development
Prerequisites
- Node.js 18.0.0 or higher
- npm or yarn
Setup
git clone <repository-url>
cd browser-console-mcp-server
npm install
npm run build
npm startScripts
npm run build: Compile TypeScript to JavaScriptnpm run dev: Watch mode for developmentnpm start: Start the servernpm run prepublishOnly: Build before publishing
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
