opencode-browser
Browser automation plugin for OpenCode AI editor - Control Chrome/Edge with AI, automate web testing, scraping & form filling via MCP integration
claude mcp add --transport stdio michaljach-opencode-browser npx -y @browsermcp/mcp@latest \ --env BROWSER_MCP_DEBUG="false"
How to use
This MCP server integrates the Browser MCP engine with OpenCode, enabling browser automation capabilities directly from prompts. The Browser MCP server lets the AI control a real or headless browser: navigating to pages, filling forms, clicking elements, scraping data, and performing complex interactions. The integration supports automatic reconnection when the browser extension is toggled, exponential backoff retry logic for transient failures, and health monitoring to recover from disconnections. When you invoke browser-related prompts, OpenCode will route those commands to the Browser MCP server, which will manage the browser session, preserve context across actions, and log activity for visibility and debugging.
To use it, ensure the OpenCode prompt includes browser automation instructions and that the Browser MCP extension is installed in your browser. The MCP server detects browser-related tasks automatically and will coordinate with the extension to execute actions such as visiting a URL, filling in input fields, clicking buttons, and capturing screenshots or data as needed. You can script navigation like navigating to a page, waiting for the page to load, and performing form submissions, then request results (e.g., extracted text or images) as part of your prompt feedback loop. The integration also supports session context preservation so the AI can reason about the current browser state across prompts and prompts can request post-action verification (e.g., take a screenshot after navigation).
If a browser interaction fails due to a disconnected extension or a temporary issue, the plugin will automatically retry using exponential backoff. You may see retries like 1s, 2s, 4s, 8s, and 16s up to a 30s cap. This helps maintain smooth workflows without manual intervention while avoiding rapid-fire retry storms. You can also enable verbose debugging via environment variables to diagnose connectivity problems when needed.
How to install
Prerequisites:
- Node.js installed on your system
- OpenCode installed and configured
- Browser MCP extension installed in your browser (Chrome or Edge)
Install and configure:
- Install the Browser MCP extension in your browser: https://browsermcp.io/install
- Ensure OpenCode is configured to load the plugin and MCP server as shown in the configuration examples below.
OpenCode configuration (opencode.json) you can use globally or per project:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-browser"],
"mcp": {
"browsermcp": {
"type": "local",
"command": ["npx", "-y", "@browsermcp/mcp@latest"],
"enabled": true
}
}
}
Alternative configuration (for local development or testing):
# Global (example)
mkdir -p ~/.config/opencode/plugin
# Copy plugin bridge or reference as needed per development setup
# Or project-specific (example)
mkdir -p .opencode/plugin
# Ensure configuration points to the local MCP server as above
Verify installation:
- Ensure the plugin loads on OpenCode startup and the MCP server starts with the OpenCode session.
- Check that prompts mentioning browser automation trigger browser actions via Browser MCP.
Additional notes
Tips and considerations:
- Environment variables: You can enable debugging with BROWSER_MCP_DEBUG in the mcp configuration. Example: "env": { "BROWSER_MCP_DEBUG": "true" }.
- Reconnection behavior: The plugin supports automatic reconnection when the Browser MCP extension is disabled/enabled. If you encounter persistent failures, verify extension status and network conditions.
- Health monitoring: If the browser session becomes unhealthy, OpenCode will attempt to recover and preserve context where possible. Consider adding explicit verification steps (e.g., take a screenshot after navigation) to confirm actions.
- Security and permissions: Browser automation may require permissions in your browser to interact with pages, fill forms, and capture data. Ensure the extension has the necessary permissions for the target sites.
- Debugging prompts: For complex flows, include explicit selectors or use stable identifiers (text content, IDs) to improve reliability of automated actions.
- Compatibility: This MCP server uses the Browser MCP extension; ensure you are using compatible versions of the extension and Browser MCP server plugin.
Related MCP Servers
flyto-core
The open-source execution engine for AI agents. 412 modules, MCP-native, triggers, queue, versioning, metering.
opencode-studio
web GUI for securely managing local OpenCode configuration
google-ai-mode
MCP server for free Google AI Mode search with citations. Query optimization, CAPTCHA handling, multi-agent support. Works with Claude Code, Cursor, Cline, Windsurf.
izan.io
Turn Any Browser Action & Data Extraction into an AI Tool in 60 Seconds
puppeteer
Self-hosted Puppeteer MCP server with remote SSE access, API key authentication, and Docker deployment. Complete tool suite for browser automation via Model Context Protocol.
webclaw
A WebMCP-native browser agent that runs inside your real Chrome — control it from Claude, Cursor, and any MCP client