What is OpenCode?
OpenCode is an open-source AI coding agent available as a terminal UI, desktop app, or IDE extension. It connects to your codebase, understands your project structure, and helps you build features, refactor code, fix bugs, and navigate unfamiliar code, all from your editor or terminal. Like other AI coding tools, OpenCode can call external tools via MCP. Connect ZenRows and it gains reliable access to any web resource: protected documentation sites, JavaScript-rendered API references, paywalled technical content, and any page that would otherwise return a blocked or empty response.Why connect ZenRows to OpenCode?
- Fetch live docs that block automated requests. Many documentation sites (Cloudflare, AWS, Stripe, and others) return challenges or empty pages to automated clients. ZenRows bypasses that so OpenCode gets the actual content.
- Pull real API responses, not cached snapshots. When OpenCode needs to understand an external API, ZenRows fetches the live spec or reference page rather than relying on potentially stale training data.
- Research technical content during a coding session. Ask OpenCode to scrape Stack Overflow threads, GitHub issues, technical blogs, or framework changelogs and incorporate the findings directly into the task it’s working on.
- Access JavaScript-rendered pages. Developer tools, dashboards, and interactive docs often require JavaScript to render their content. ZenRows handles that automatically.
What you can build
- Live documentation lookup during development. Ask OpenCode to fetch the latest docs for a library you’re integrating and use them to generate correct, up-to-date code, not code based on training data that may be months old.
- Automated competitor or dependency research. Have OpenCode scrape changelogs, release notes, or breaking change announcements across your key dependencies and summarize what needs updating in your project.
- Technical reference extraction. Describe a problem and let OpenCode scrape relevant Stack Overflow threads, GitHub issues, or RFC documents to inform its solution.
- Live API testing context. Before generating integration code, have OpenCode scrape the target API’s reference page to confirm endpoint signatures, auth patterns, and response shapes.
Prerequisites
- A ZenRows API key from the ZenRows dashboard.
Getting started
Install OpenCode
brew install anomalyco/tap/opencode), Chocolatey (choco install opencode), Scoop (scoop install opencode). See the full install guide for all options.OpenCode runs natively on Windows via PowerShell or Command Prompt. WSL is optional.Verify the install:Connect an LLM provider
/connect command inside OpenCode and select your provider:/models to pick a model like claude-sonnet-4-6. For other providers, see the OpenCode full provider guide.Once a model is selected, you’re ready to add ZenRows.Add ZenRows MCP to OpenCode
opencode.json config file and add it under the mcp key.Create the file at one of these locations depending on your preferred scope:- Project-level (
opencode.jsonin your project root): ZenRows available only in this project. - Global (
~/.config/opencode/opencode.json): ZenRows available across all projects.
oauth: false is required. Without it, OpenCode’s automatic OAuth detection will intercept the request before the Bearer token header is sent.Scoping ZenRows to a specific agent (optional)
OpenCode supports custom agents: specialized AI assistants with their own prompts, models, and tool access. You can create one using:permission key and re-enable them per agent:
researcher agent is now the only one that can call ZenRows tools. Invoke it by @ mentioning it in your session:
Add a ZenRows instruction to your agent file (optional)
When you runopencode agent create and follow the interactive prompts, OpenCode generates a markdown agent file at .opencode/agents/<agent-name>.md. The file has a frontmatter block for config and a body for the system prompt.
Add the ZenRows instruction to the Guidelines section of the body if one exists, or anywhere in the prompt body if not. For example:
Troubleshooting
Command ‘opencode’ not found after install
Thenpm global bin directory isn’t in your PATH. Fix it by adding it.
Linux / macOS:
~/.bashrc or ~/.zshrc to make it permanent, then run source ~/.bashrc.
Windows CMD:
ERROR: CreateProcessCommon: execvpe(/bin/bash) failed: No such file or directory on Windows
This means WSL is installed, but no proper Linux distro is set up. Thedocker-desktop distro that ships with Docker Desktop is headless and doesn’t provide a usable shell. You have two options:
Install a proper WSL distro:
ZenRows tools not appearing in OpenCode
- Confirm
enabled: trueis set in the ZenRows MCP block. - Check that
ZENROWS_API_KEYis correct. - Restart OpenCode after saving the config.
- Run
opencode mcp listto see all registered MCP servers and their status.
Authentication error when calling ZenRows tools
Verify your API key is active in the ZenRows dashboard. Also confirmoauth: false is in your config. Without it, OpenCode’s OAuth auto-detection will intercept the connection before the Bearer token is applied.
OpenCode not using ZenRows even when available
Be explicit in your prompt:use zenrows to fetch https://www.scrapingcourse.com/antibot-challenge. Alternatively, add an instruction in your <agent-file.md> to set ZenRows as the default tool for external web fetches.
Context limit warnings after adding ZenRows
ZenRows adds its full tool list to the context on every request. If you’re hitting context limits, restrict OpenCode to only the tools you need using glob patterns in thetools config:
zenrows_scrape active. Or switch to a model with a larger context window.
FAQ (Frequently asked questions)
Should I add ZenRows to the project config or the global config?
Should I add ZenRows to the project config or the global config?
Can I use the local stdio version of ZenRows MCP instead?
Can I use the local stdio version of ZenRows MCP instead?
Can I connect multiple MCP servers alongside ZenRows?
Can I connect multiple MCP servers alongside ZenRows?
mcp:Does ZenRows work with all LLM providers in OpenCode?
Does ZenRows work with all LLM providers in OpenCode?
/connect. The MCP layer is independent of the model.Can I temporarily turn off ZenRows without removing it from the config?
Can I temporarily turn off ZenRows without removing it from the config?
enabled: false in the ZenRows block:true when you need it again.Does ZenRows work in OpenCode's Plan mode?
Does ZenRows work in OpenCode's Plan mode?
permission config.Can I use ZenRows with OpenCode's built-in webfetch tool simultaneously?
Can I use ZenRows with OpenCode's built-in webfetch tool simultaneously?
webfetch is OpenCode’s native HTTP fetch tool, useful for simple, unprotected pages. ZenRows is better for pages behind bot protection, JavaScript rendering, or geo-restrictions. OpenCode will reach for whichever tool you specify, or make its own judgment if you don’t specify one.