diff --git a/README.md b/README.md index e2d544a..3078385 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE ⚡ Rapid Mode (Free tier) 💎 Pro Mode + 🔧 Custom Mode @@ -129,7 +130,7 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE

Pay-as-you-go

-

Every thing in rapid and 60+ Advanced Tools

+

Everything in rapid plus 60+ tools


✅ Browser Control
✅ Web Data APIs
@@ -138,11 +139,105 @@ https://mcp.brightdata.com/mcp?token=YOUR_API_TOKEN_HERE
PRO_MODE=true + +

Usage-based

+

Pick the tools you need

+
+

✅ Combine tool groups
+ ✅ Add individual tools
+ ❌ Overrides Pro eligibility

+
+ GROUPS="browser"
+ TOOLS="scrape_as_html" + -> **💡 Note:** Pro mode is **not included** in the free tier and incurs additional charges based on usage. +> **💡 Note:** Pro mode is **not included** in the free tier and incurs +> additional charges based on usage. + +--- + +## 🧠 Advanced Tool Selection + +- `GROUPS` lets you enable curated tool bundles. Use comma-separated group + IDs such as `ecommerce,browser`. +- `TOOLS` adds explicit tool names on top of the selected groups. +- Mode priority: `PRO_MODE=true` (all tools) → `GROUPS` / `TOOLS` + (whitelist) → default rapid mode (base toolkit). +- Base tools always enabled: `search_engine`, `search_engine_batch`, + `scrape_as_markdown`, `scrape_batch`. +- Group ID `custom` is reserved; use `TOOLS` for bespoke picks. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Group IDDescriptionFeatured tools
ecommerceRetail and marketplace datasetsweb_data_amazon_product, + web_data_walmart_product, + web_data_google_shopping
socialSocial, community, and creator insightsweb_data_linkedin_posts, + web_data_tiktok_posts, + web_data_youtube_videos
browserBright Data Scraping Browser automation toolsscraping_browser_snapshot, + scraping_browser_click_ref, + scraping_browser_screenshot
businessCompany, property, and finance intelligenceweb_data_crunchbase_company, + web_data_yahoo_finance_business, + web_data_zillow_properties_listing
researchApp store, news, and developer feedsweb_data_google_play_store, + web_data_apple_app_store, + web_data_reuter_news
advanced_scrapingBatch and AI-assisted extraction helperssearch_engine_batch, + scrape_batch, + extract
+ +### Claude Desktop example + +```json +{ + "mcpServers": { + "Bright Data": { + "command": "npx", + "args": ["@brightdata/mcp"], + "env": { + "API_TOKEN": "", + "GROUPS": "browser,advanced_scraping", + "TOOLS": "extract" + } + } + } +} +``` --- diff --git a/package.json b/package.json index c273b7b..9dda3a3 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/server.js b/server.js index eee36a6..2e539de 100644 --- a/server.js +++ b/server.js @@ -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'); @@ -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 = [], custom_tools = []){ + const allowed = new Set(); + for (const group_id of groups) + { + const group = Object.values(GROUPS) + .find(g=>g.id===group_id); + if (!group) + continue; + for (const tool of group.tools) + allowed.add(tool); + } + for (const tool of custom_tools) + 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; @@ -49,7 +73,8 @@ function check_rate_limit(){ const now = Date.now(); const window_start = now - rate_limit_config.window; - debug_stats.call_timestamps = debug_stats.call_timestamps.filter(timestamp=>timestamp>window_start); + debug_stats.call_timestamps = debug_stats.call_timestamps + .filter(timestamp=>timestamp>window_start); if (debug_stats.call_timestamps.length>=rate_limit_config.limit) throw new Error(`Rate limit exceeded: ${rate_limit_config.display}`); @@ -126,9 +151,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({ diff --git a/server.json b/server.json index 71377d5..45bfe93 100644 --- a/server.json +++ b/server.json @@ -44,6 +44,20 @@ "isRequired": false, "isSecret": false, "format": "boolean" + }, + { + "name": "GROUPS", + "description": "Comma-separated tool group IDs (e.g., 'ecommerce,browser')", + "isRequired": false, + "isSecret": false, + "format": "string" + }, + { + "name": "TOOLS", + "description": "Comma-separated tool names to enable", + "isRequired": false, + "isSecret": false, + "format": "string" } ] } diff --git a/tool_groups.js b/tool_groups.js new file mode 100644 index 0000000..a662f1b --- /dev/null +++ b/tool_groups.js @@ -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 intel.', + 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 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 information.', + 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};