
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@mastra/brightdata
Advanced tools
Affected versions:
Bright Data web search and web fetch tools for Mastra agents.
Backed by the official @brightdata/sdk. Bright Data's SERP API and Web Unlocker bypass bot detection and CAPTCHAs, so the tools work on sites that block typical scrapers.
npm install @mastra/brightdata zod
Use createBrightDataTools() to get both tools with a shared configuration:
import { Agent } from '@mastra/core/agent';
import { createBrightDataTools } from '@mastra/brightdata';
const tools = createBrightDataTools();
// Or pass an explicit API token:
// const tools = createBrightDataTools({ apiKey: 'brd_...' });
const agent = new Agent({
id: 'realtime-information-agent',
name: 'Realtime Information Agent',
instructions:
'You are a realtime information agent. Use brightdata-search to find pages, and brightdata-fetch to read them.',
model: 'anthropic/claude-sonnet-4-6',
tools,
});
By default the tools read BRIGHTDATA_API_TOKEN from your environment. You can also pass { apiKey } explicitly.
Each tool can be created independently:
import { createBrightDataSearchTool, createBrightDataFetchTool } from '@mastra/brightdata';
const search = createBrightDataSearchTool({ apiKey: 'brd_...' });
const fetch = createBrightDataFetchTool(); // uses BRIGHTDATA_API_TOKEN env var
brightdata-search)import { createBrightDataSearchTool } from '@mastra/brightdata';
const searchTool = createBrightDataSearchTool();
// When called by an agent, accepts:
// - query (required)
// - country: 2-letter code (e.g., 'us', 'gb')
// - start: result offset for pagination (e.g. 10 for the second page of 10 results)
//
// Returns:
// {
// query: string,
// results: Array<{ link, title, description }>,
// currentPage: number
// }
brightdata-fetch)import { createBrightDataFetchTool } from '@mastra/brightdata';
const fetchTool = createBrightDataFetchTool();
// Accepts: url (required)
// Returns: { url, content } // content is Markdown
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | process.env.BRIGHTDATA_API_TOKEN | Your Bright Data API token |
All tools accept the full BrightDataClientOptions from @brightdata/sdk (including timeout, webUnlockerZone, serpZone, rateLimit, etc.). If no API token is found, the tool throws a clear error at execution time.
Combine search and fetch for retrieval-augmented generation:
import { Agent } from '@mastra/core/agent';
import { createBrightDataTools } from '@mastra/brightdata';
const agent = new Agent({
id: 'rag-agent',
name: 'Research Assistant',
model: 'anthropic/claude-sonnet-4-6',
instructions: `You are a research assistant. Use brightdata-search to find relevant pages, then use brightdata-fetch to get full Markdown content from the best results.`,
tools: createBrightDataTools(),
});
Apache-2.0
FAQs
Bright Data web search and web fetch tools for Mastra agents
The npm package @mastra/brightdata receives a total of 682 weekly downloads. As such, @mastra/brightdata popularity was classified as not popular.
We found that @mastra/brightdata demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.