Building an AI startup?
You might be eligible for our Startup Program. Get fully funded access to the infrastructure you’re reading about right now (up to $20K value).
Prerequisites
- OpenCode is installed. The plugin works with OpenCode 2 and OpenCode 1
- Node.js 20 or later is installed (required for the Bright Data CLI)
- A Bright Data account. New accounts get 5,000 free credits every month, no credit card required
How to install the Bright Data plugin for OpenCode
1
Install the Bright Data CLI
Install the Bright Data CLI globally so the agent can call For other install methods, see Install the Bright Data CLI.
bdata from its shell:2
Log in to Bright Data
Connect your Bright Data account:
bdata login opens a browser to authorize, saves your credentials and creates the cli_unlocker and cli_browser zones if they do not exist. Over SSH or in a headless environment, run bdata login --device instead. In CI, run bdata login --api-key YOUR_API_KEY.3
Add the plugin to OpenCode
Run the command for your OpenCode version. Check the version with The command adds the plugin to your global Keep the
opencode --version.- OpenCode 2
- OpenCode 1
~/.config/opencode/opencode.json. To add the plugin to a single project instead, put the following in the project’s opencode.json:@latest tag. With @latest, OpenCode checks for a new version on startup and every 24 hours. Without a tag, OpenCode stays on the version you first installed.4
Check that the plugin is loaded
On OpenCode 2, list the installed plugins:You should see On OpenCode 1, start a session and ask
brightdata in the output:Which Bright Data skills do you have?.5
Run your first prompt
Start OpenCode with The agent loads a Bright Data skill, runs the search in its shell and answers with the live results.
opencode and paste a prompt:Prompt
What can OpenCode do with the Bright Data plugin?
OpenCode loads a Bright Data skill when your prompt needs one. Describe the task in plain language, or name the skill in the prompt.
The plugin also gives the agent the CLI install and login instructions, and passes your Bright Data environment variables to shell commands.
Which prompts can I try?
The prompts below cover search, scraping and pre-built scrapers:bdata pipelines search, and use bdata scrape for a page that has no pre-built scraper.
Which environment variables does the plugin use?
None are required afterbdata login. Every skill uses your saved API key and zone. To use environment variables instead of a saved login, set an API key and a Web Unlocker API zone:
How do I connect the Bright Data MCP server to OpenCode?
The plugin does not need the Bright Data MCP server. Add the Bright Data MCP server when you want web tools inside the agent’s tool loop, or browser automation without shell commands.- OpenCode 2
- OpenCode 1
--global to add the server to the current project only.opencode mcp auth starts the OAuth 2.1 sign-in, so no API key is stored in the config file.
In an environment with no browser, connect with an API key instead. Replace the URL in the opencode mcp add command with the following, and keep the quotes:
BRIGHTDATA_API_KEY from the environment when it connects, so the API key itself is not written to opencode.json. Verify the connection:
brightdata marked as connected.
How to update or remove the plugin
OpenCode 2 manages the plugin from the terminal:remove that you used in add. On OpenCode 1, remove the plugin by deleting its entry from the plugin list in opencode.json.
How to fix common OpenCode plugin errors
Why does OpenCode report “BRIGHTDATA_API_KEY is not set”?
The plugin is older than version 1.1.3, which added support for the saved login in thesearch, scrape, data-feeds and design-mirror skills. On OpenCode 2, run opencode plugin update. On version 1.1.3 or later, a “No Bright Data API key found” error means you are not logged in. Run bdata login.
Why do I see “No Web Unlocker zone specified” or “No Web Unlocker zone found”?
BRIGHTDATA_API_KEY is set, but no zone is configured. An API key alone does not select a zone, so scraping fails with one of these errors and bdata search fails with “No zone specified”. Run bdata login --api-key "$BRIGHTDATA_API_KEY" once to create and save a zone, or set the zone:
cli_unlocker zone exists after your first bdata login. You can use any other Web Unlocker API zone in your account.
Why does opencode plugin list show “No plugins found”?
OpenCode 2 loads plugins in the background after its service starts. Wait a few seconds and run opencode plugin list again.
Why does the agent report “bdata: command not found”?
The Bright Data CLI is not installed, or the npm global folder is not on yourPATH. Run npm install -g @brightdata/cli, then confirm the install with bdata --version.
Next steps
Bright Data CLI commands
Look up every command, flag and option the agent can run.
Bright Data for your coding agent
Combine llms.txt, agent skills, the CLI and the MCP server.
Plugin source code
Read the plugin source, report an issue or check releases.