Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE
<tr>
<th width="33%">⚡ Rapid Mode (Free tier)</th>
<th width="33%">💎 Pro Mode</th>
<th width="34%">🔧 Custom Mode</th>
</tr>
<tr>
<td align="center">
Expand All @@ -138,6 +139,17 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE
<br/>
<code>PRO_MODE=true</code>
</td>
<td align="center">
<h3>Usage-based</h3>
<p><strong>Pick the tools you need</strong></p>
<hr/>
<p>✅ Combine tool groups<br/>
✅ Add individual tools<br/>
❌ Overrides Pro eligibility</p>
<br/>
<code>TOOL_GROUPS="browser"</code><br/>
<code>CUSTOM_TOOLS="scrape_as_html"</code>
</td>
</tr>
</table>
</div>
Expand All @@ -146,6 +158,80 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE

---

## 🧠 Advanced Tool Selection

- `TOOL_GROUPS` lets you enable curated tool bundles. Use comma-separated group IDs such as `ecommerce,browser`.
- `CUSTOM_TOOLS` adds explicit tool names on top of the selected groups.
- Mode priority: `PRO_MODE=true` (all tools) → `TOOL_GROUPS` / `CUSTOM_TOOLS` (whitelist) → default rapid mode (base toolkit).
- Base tools always enabled: `search_engine`, `scrape_as_markdown`.
- Group ID `custom` is reserved; use `CUSTOM_TOOLS` for bespoke picks.

```bash
# Enable all browser automation helpers alongside the base tools
TOOL_GROUPS="browser" node server.js

# Mix a group with individual extras
TOOL_GROUPS="social" CUSTOM_TOOLS="extract" node server.js
```

<table>
<tr>
<th align="left">Group ID</th>
<th align="left">Description</th>
<th align="left">Featured tools</th>
</tr>
<tr>
<td><code>ecommerce</code></td>
<td>Retail and marketplace datasets</td>
<td><code>web_data_amazon_product</code>, <code>web_data_walmart_product</code>, <code>web_data_google_shopping</code></td>
</tr>
<tr>
<td><code>social</code></td>
<td>Social, community, and creator insights</td>
<td><code>web_data_linkedin_posts</code>, <code>web_data_tiktok_posts</code>, <code>web_data_youtube_videos</code></td>
</tr>
<tr>
<td><code>browser</code></td>
<td>Bright Data Scraping Browser automation tools</td>
<td><code>scraping_browser_snapshot</code>, <code>scraping_browser_click_ref</code>, <code>scraping_browser_screenshot</code></td>
</tr>
<tr>
<td><code>business</code></td>
<td>Company, property, and finance intelligence</td>
<td><code>web_data_crunchbase_company</code>, <code>web_data_yahoo_finance_business</code>, <code>web_data_zillow_properties_listing</code></td>
</tr>
<tr>
<td><code>research</code></td>
<td>App store, news, and developer feeds</td>
<td><code>web_data_google_play_store</code>, <code>web_data_apple_app_store</code>, <code>web_data_reuter_news</code></td>
</tr>
<tr>
<td><code>advanced_scraping</code></td>
<td>Batch and AI-assisted extraction helpers</td>
<td><code>search_engine_batch</code>, <code>scrape_batch</code>, <code>extract</code></td>
</tr>
</table>

### Claude Desktop example

```json
{
"mcpServers": {
"Bright Data": {
"command": "npx",
"args": ["@brightdata/mcp"],
"env": {
"API_TOKEN": "<your-api-token-here>",
"TOOL_GROUPS": "browser,advanced_scraping",
"CUSTOM_TOOLS": "extract"
}
}
}
}
```

---

## ✨ Features

### 🔥 Core Capabilities
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"server.js",
"browser_tools.js",
"browser_session.js",
"aria_snapshot_filter.js"
"aria_snapshot_filter.js",
"tool_groups.js"
],
"mcpName": "io.github.brightdata/brightdata-mcp"
}
40 changes: 38 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {FastMCP} from 'fastmcp';
import {z} from 'zod';
import axios from 'axios';
import {tools as browser_tools} from './browser_tools.js';
import {GROUPS} from './tool_groups.js';
import {createRequire} from 'node:module';
const require = createRequire(import.meta.url);
const package_json = require('./package.json');
Expand All @@ -13,6 +14,29 @@ const browser_zone = process.env.BROWSER_ZONE || 'mcp_browser';
const pro_mode = process.env.PRO_MODE === 'true';
const pro_mode_tools = ['search_engine', 'scrape_as_markdown',
'search_engine_batch', 'scrape_batch'];
const tool_groups = process.env.GROUPS ?
process.env.GROUPS.split(',').map(g=>g.trim().toLowerCase())
.filter(Boolean) : [];
const custom_tools = process.env.TOOLS ?
process.env.TOOLS.split(',').map(t=>t.trim()).filter(Boolean) : [];

function build_allowed_tools(groups = [], customTools = []){
const allowed = new Set();
for (let groupId of groups)
{
const group = Object.values(GROUPS).find(g=>g.id==groupId);
if (group)

for (let tool of group.tools)
allowed.add(tool);

}
for (let tool of customTools)
allowed.add(tool);
return allowed;
}

const allowed_tools = build_allowed_tools(tool_groups, custom_tools);
function parse_rate_limit(rate_limit_str) {
if (!rate_limit_str)
return null;
Expand Down Expand Up @@ -126,9 +150,21 @@ let server = new FastMCP({
let debug_stats = {tool_calls: {}, session_calls: 0, call_timestamps: []};

const addTool = (tool) => {
if (!pro_mode && !pro_mode_tools.includes(tool.name))
if (pro_mode)
{
server.addTool(tool);
return;
server.addTool(tool);
}

if (allowed_tools.size>0)
{
if (allowed_tools.has(tool.name))
server.addTool(tool);
return;
}

if (pro_mode_tools.includes(tool.name))
server.addTool(tool);
};

addTool({
Expand Down
14 changes: 14 additions & 0 deletions server.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@
"isRequired": false,
"isSecret": false,
"format": "boolean"
},
{
"name": "TOOL_GROUPS",
"description": "Comma-separated tool group IDs (e.g., 'ecommerce,social,browser')",
"isRequired": false,
"isSecret": false,
"format": "string"
},
{
"name": "CUSTOM_TOOLS",
"description": "Comma-separated custom tool names to enable",
"isRequired": false,
"isSecret": false,
"format": "string"
}
]
}
Expand Down
162 changes: 162 additions & 0 deletions tool_groups.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
'use strict'; /*jslint node:true es9:true*/

const base_tools = ['search_engine', 'scrape_as_markdown'];

export const GROUPS = {
ECOMMERCE: {
id: 'ecommerce',
name: 'E-commerce',
description: 'Retail and marketplace datasets for product intelligence.',
tools: [
...base_tools,
'web_data_amazon_product',
'web_data_amazon_product_reviews',
'web_data_amazon_product_search',
'web_data_walmart_product',
'web_data_walmart_seller',
'web_data_ebay_product',
'web_data_homedepot_products',
'web_data_zara_products',
'web_data_etsy_products',
'web_data_bestbuy_products',
'web_data_google_shopping',
],
},
SOCIAL_MEDIA: {
id: 'social',
name: 'Social Media',
description: 'Social networks, UGC platforms, and creator insights.',
tools: [
...base_tools,
'web_data_linkedin_person_profile',
'web_data_linkedin_company_profile',
'web_data_linkedin_job_listings',
'web_data_linkedin_posts',
'web_data_linkedin_people_search',
'web_data_instagram_profiles',
'web_data_instagram_posts',
'web_data_instagram_reels',
'web_data_instagram_comments',
'web_data_facebook_posts',
'web_data_facebook_marketplace_listings',
'web_data_facebook_company_reviews',
'web_data_facebook_events',
'web_data_tiktok_profiles',
'web_data_tiktok_posts',
'web_data_tiktok_shop',
'web_data_tiktok_comments',
'web_data_x_posts',
'web_data_youtube_profiles',
'web_data_youtube_comments',
'web_data_youtube_videos',
'web_data_reddit_posts',
],
},
BROWSER: {
id: 'browser',
name: 'Browser Automation',
description: 'Bright Data Scraping Browser tools for interactive automation.',
tools: [
...base_tools,
'scraping_browser_navigate',
'scraping_browser_go_back',
'scraping_browser_go_forward',
'scraping_browser_snapshot',
'scraping_browser_click_ref',
'scraping_browser_type_ref',
'scraping_browser_screenshot',
'scraping_browser_network_requests',
'scraping_browser_wait_for_ref',
'scraping_browser_get_text',
'scraping_browser_get_html',
'scraping_browser_scroll',
'scraping_browser_scroll_to_ref',
],
},
FINANCE: {
id: 'finance',
name: 'Finance Intelligence',
description: 'Company, financial, and location intelligence datasets.',
tools: [
...base_tools,
'web_data_yahoo_finance_business',
],
},
BUSINESS: {
id: 'business',
name: 'Business Intelligence',
description: 'Company, and location intelligence datasets.',
tools: [
...base_tools,
'web_data_crunchbase_company',
'web_data_zoominfo_company_profile',
'web_data_google_maps_reviews',
'web_data_zillow_properties_listing',
'web_data_booking_hotel_listings',
],
},
RESEARCH: {
id: 'research',
name: 'Research',
description: 'App stores, news, and developer data feeds.',
tools: [
...base_tools,
'web_data_github_repository_file',
'web_data_reuter_news',
],
},
APP_STORES: {
id: 'app_stores',
name: 'App stores',
description: 'App stores.',
tools: [
...base_tools,
'web_data_google_play_store',
'web_data_apple_app_store',
],
},
TRAVEL: {
id: 'travel',
name: 'Travel',
description: 'Travel inforamtion.',
tools: [
...base_tools,
'web_data_booking_hotel_listings',
],
},
ADVANCED_SCRAPING: {
id: 'advanced_scraping',
name: 'Advanced Scraping',
description: 'Higher-throughput scraping utilities and batch helpers.',
tools: [
...base_tools,
'search_engine_batch',
'scrape_batch',
'scrape_as_html',
'extract',
'session_stats',
],
},
CUSTOM: {
id: 'custom',
name: 'Custom',
description: 'Placeholder for user-defined tool selections.',
tools: [...base_tools],
},
};

export const get_all_group_ids = ()=>{
return Object.values(GROUPS)
.map(group=>group.id)
.filter(id=>id!=='custom');
};

export const get_total_tool_count = ()=>{
const all_tools = new Set();
for (let group of Object.values(GROUPS))
for (let tool of group.tools)
all_tools.add(tool);
return all_tools.size;
};

export {base_tools};