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).

Hosted MCP

1

Get your API token

  1. Go to Bright Data user settings
  2. Copy your API token (it looks like: 2dceb1aa0***************************)
2

Set up your Cloudflare environment

Make sure you have Node.js 20+ installed, then log in to Cloudflare:
3

Install the Agents Starter template

4

Configure environment variables

Copy the example env file and add your OpenAI API key:
Edit .dev.vars:
5

Connect Bright Data MCP in your agent

In src/server.ts, find the default commented-out MCP connection inside onChatMessage:
Replace it with the Bright Data MCP connection:
Make sure mcp.connect() is called before this.mcp.getAITools() to avoid jsonSchema not initialized errors.
6

Test it works

  1. Replace <API_TOKEN> with your actual Bright Data API token
  2. Start the development server:
  1. Open the app in your browser and ask the agent a question, for example:
You should see the agent use Bright Data’s web scraping tools to fetch and summarize live results:Hosted MCP
7

Monitor usage

  1. View your API usage at My Zones in your Bright Data dashboard
  2. Your free tier includes 5,000 requests per month