Skip to main content

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).
Install the Bright Data plugin for OpenCode so your coding agent can search, scrape and extract structured data from the live web without getting blocked. The plugin adds Bright Data skills to OpenCode, and the agent runs them through the Bright Data CLI.

Prerequisites

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 bdata from its shell:
For other install methods, see Install the Bright Data CLI.
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 opencode --version.
The command adds the plugin to your global ~/.config/opencode/opencode.json. To add the plugin to a single project instead, put the following in the project’s opencode.json:
Keep the @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 brightdata in the output:
On OpenCode 1, start a session and ask Which Bright Data skills do you have?.
5

Run your first prompt

Start OpenCode with opencode and paste a prompt:
Prompt
The agent loads a Bright Data skill, runs the search in its shell and answers with the live results.

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:
The agent can find a scraper among thousands of pre-built scrapers with 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 after bdata 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:
Get an API key from the user settings page. Set the variables in the environment that starts OpenCode. Environment variables override the saved login.

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.
Leave out --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:
OpenCode reads BRIGHTDATA_API_KEY from the environment when it connects, so the API key itself is not written to opencode.json. Verify the connection:
You should see brightdata marked as connected.

How to update or remove the plugin

OpenCode 2 manages the plugin from the terminal:
Use the same package name and tag in 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 the search, 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:
The 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 your PATH. 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.