# brightdata/brightdata-mcp architecture

> Architecture diagram of the GitHub repository brightdata/brightdata-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/brightdata/brightdata-mcp
- Repository: https://github.com/brightdata/brightdata-mcp

## Overview

Bright Data MCP exposes web-data and browser capabilities to MCP-compatible agents. The main workflow is a client tool request routed by the server into search, page fetching, structured scraper collection, or browser actions, then returned as a tool result; scraper jobs additionally expose progress and results. The graph includes documented LLM response collection and dataset tools. Source excerpts show key orchestration and browser/session details, but not every runtime path, so unsampled subsystem links are omitted where their wiring is uncertain.

Main entry points: [`server.js`](https://github.com/brightdata/brightdata-mcp/blob/main/server.js) (Tool server), [`errors.js`](https://github.com/brightdata/brightdata-mcp/blob/main/errors.js) (Error formatting), [`scraper_tools.js`](https://github.com/brightdata/brightdata-mcp/blob/main/scraper_tools.js) (Scraper tools), [`browser_tools.js`](https://github.com/brightdata/brightdata-mcp/blob/main/browser_tools.js) (Browser actions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["MCP orchestration"]
  node_server["Tool server<br/>[server.js]"]
  node_groups["Tool groups<br/>[tool_groups.js]"]
end

subgraph group_webdata["Web data tools"]
  node_search["Web search<br/>[search_utils.js]"]
  node_fetch["Page fetch<br/>[fetch_api.js]"]
  node_dataset["Dataset search"]
  node_catalog["Scraper catalog<br/>[scraper_catalog.js]"]
  node_scraper_tools["Scraper tools<br/>[scraper_tools.js]"]
  node_scraper_run["Scraper execution<br/>[scraper_run.js]"]
  node_assistant["LLM responses"]
end

subgraph group_browser["Browser automation"]
  node_browser_tools["Browser actions<br/>[browser_tools.js]"]
  node_browser_session["Browser sessions<br/>[browser_session.js]"]
  node_browser_rules["Browser rules<br/>[browser_rules.js]"]
  node_aria["ARIA filtering"]
end

subgraph group_safety["Safety and errors"]
  node_content_gate["Content approval gate<br/>[content_gate.js]"]
  node_untrusted["Untrusted content"]
  node_errors["Error formatting<br/>[errors.js]"]
  node_safe_error["Credential redaction<br/>[safe_error.js]"]
end

node_agent(("MCP client / agent"))
node_brightdata{{"Bright Data APIs"}}
node_remote_browser{{"Remote browser"}}

node_agent -->|"invokes tools"| node_server
node_server -->|"resolves tools"| node_groups
node_server -->|"runs searches"| node_search
node_server -->|"fetches pages"| node_fetch
node_server -->|"validates dataset filters"| node_dataset
node_server -->|"registers scraper tools"| node_scraper_tools
node_scraper_tools -.->|"looks up scrapers"| node_catalog
node_scraper_tools -.->|"runs collections"| node_scraper_run
node_server -->|"requests answers"| node_assistant
node_server -.->|"registers browser tools"| node_browser_tools
node_browser_tools -->|"uses sessions"| node_browser_session
node_browser_session -->|"filters snapshots"| node_aria
node_browser_session -->|"connects over CDP"| node_remote_browser
node_server -.->|"applies tool rules"| node_browser_rules
node_server -.->|"gates page results"| node_content_gate
node_server -.->|"handles untrusted text"| node_untrusted
node_server -->|"formats failures"| node_errors
node_server -->|"redacts failures"| node_safe_error
node_search -->|"formats tool errors"| node_errors
node_fetch -->|"formats API errors"| node_errors
node_errors -->|"redacts URLs"| node_safe_error
node_server -->|"calls service APIs"| node_brightdata
node_browser_tools -->|"gets browser credentials"| node_brightdata

click node_server "https://github.com/brightdata/brightdata-mcp/blob/main/server.js"
click node_groups "https://github.com/brightdata/brightdata-mcp/blob/main/tool_groups.js"
click node_search "https://github.com/brightdata/brightdata-mcp/blob/main/search_utils.js"
click node_fetch "https://github.com/brightdata/brightdata-mcp/blob/main/fetch_api.js"
click node_dataset "https://github.com/brightdata/brightdata-mcp/blob/main/search_dataset_schema.js"
click node_catalog "https://github.com/brightdata/brightdata-mcp/blob/main/scraper_catalog.js"
click node_scraper_tools "https://github.com/brightdata/brightdata-mcp/blob/main/scraper_tools.js"
click node_scraper_run "https://github.com/brightdata/brightdata-mcp/blob/main/scraper_run.js"
click node_assistant "https://github.com/brightdata/brightdata-mcp/blob/main/sophie_assistant.js"
click node_browser_tools "https://github.com/brightdata/brightdata-mcp/blob/main/browser_tools.js"
click node_browser_session "https://github.com/brightdata/brightdata-mcp/blob/main/browser_session.js"
click node_browser_rules "https://github.com/brightdata/brightdata-mcp/blob/main/browser_rules.js"
click node_aria "https://github.com/brightdata/brightdata-mcp/blob/main/aria_snapshot_filter.js"
click node_content_gate "https://github.com/brightdata/brightdata-mcp/blob/main/content_gate.js"
click node_untrusted "https://github.com/brightdata/brightdata-mcp/blob/main/untrusted_content.js"
click node_errors "https://github.com/brightdata/brightdata-mcp/blob/main/errors.js"
click node_safe_error "https://github.com/brightdata/brightdata-mcp/blob/main/safe_error.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_groups,node_agent,node_remote_browser toneBlue
class node_search,node_fetch,node_dataset,node_catalog,node_scraper_tools,node_scraper_run,node_assistant toneAmber
class node_browser_tools,node_browser_session,node_browser_rules,node_aria,node_brightdata toneMint
class node_content_gate,node_untrusted,node_errors,node_safe_error toneRose
```

## Components

### MCP orchestration

- [Tool server](https://github.com/brightdata/brightdata-mcp/blob/main/server.js): `server.js`
- [Tool groups](https://github.com/brightdata/brightdata-mcp/blob/main/tool_groups.js): `tool_groups.js`

### Web data tools

- [Web search](https://github.com/brightdata/brightdata-mcp/blob/main/search_utils.js): `search_utils.js`
- [Page fetch](https://github.com/brightdata/brightdata-mcp/blob/main/fetch_api.js): `fetch_api.js`
- [Dataset search](https://github.com/brightdata/brightdata-mcp/blob/main/search_dataset_schema.js): `search_dataset_schema.js`
- [Scraper catalog](https://github.com/brightdata/brightdata-mcp/blob/main/scraper_catalog.js): `scraper_catalog.js`
- [Scraper tools](https://github.com/brightdata/brightdata-mcp/blob/main/scraper_tools.js): `scraper_tools.js`
- [Scraper execution](https://github.com/brightdata/brightdata-mcp/blob/main/scraper_run.js): `scraper_run.js`
- [LLM responses](https://github.com/brightdata/brightdata-mcp/blob/main/sophie_assistant.js): `sophie_assistant.js`

### Browser automation

- [Browser actions](https://github.com/brightdata/brightdata-mcp/blob/main/browser_tools.js): `browser_tools.js`
- [Browser sessions](https://github.com/brightdata/brightdata-mcp/blob/main/browser_session.js): `browser_session.js`
- [Browser rules](https://github.com/brightdata/brightdata-mcp/blob/main/browser_rules.js): `browser_rules.js`
- [ARIA filtering](https://github.com/brightdata/brightdata-mcp/blob/main/aria_snapshot_filter.js): `aria_snapshot_filter.js`

### Safety and errors

- [Content approval gate](https://github.com/brightdata/brightdata-mcp/blob/main/content_gate.js): `content_gate.js`
- [Untrusted content](https://github.com/brightdata/brightdata-mcp/blob/main/untrusted_content.js): `untrusted_content.js`
- [Error formatting](https://github.com/brightdata/brightdata-mcp/blob/main/errors.js): `errors.js`
- [Credential redaction](https://github.com/brightdata/brightdata-mcp/blob/main/safe_error.js): `safe_error.js`

### Other components

- **MCP client / agent**
- **Bright Data APIs**
- **Remote browser**

## Connections

- MCP client / agent → Tool server: invokes tools (evidence: `README.md`)
- Tool server → Tool groups: resolves tools (evidence: `server.js`)
- Tool server → Web search: runs searches (evidence: `server.js`)
- Tool server → Page fetch: fetches pages (evidence: `server.js`)
- Tool server → Dataset search: validates dataset filters (evidence: `server.js`)
- Tool server → Scraper tools: registers scraper tools (evidence: `server.js`)
- Scraper tools → Scraper catalog: looks up scrapers (evidence: `scraper_tools.js`)
- Scraper tools → Scraper execution: runs collections (evidence: `scraper_tools.js`)
- Tool server → LLM responses: requests answers (evidence: `server.js`)
- Tool server → Browser actions: registers browser tools (evidence: `server.js`)
- Browser actions → Browser sessions: uses sessions (evidence: `browser_tools.js`)
- Browser sessions → ARIA filtering: filters snapshots (evidence: `browser_session.js`)
- Browser sessions → Remote browser: connects over CDP (evidence: `browser_session.js`)
- Tool server → Browser rules: applies tool rules (evidence: `server.js`)
- Tool server → Content approval gate: gates page results (evidence: `server.js`)
- Tool server → Untrusted content: handles untrusted text (evidence: `server.js`)
- Tool server → Error formatting: formats failures (evidence: `server.js`)
- Tool server → Credential redaction: redacts failures (evidence: `server.js`)
- Web search → Error formatting: formats tool errors (evidence: `search_utils.js`)
- Page fetch → Error formatting: formats API errors (evidence: `fetch_api.js`)
- Error formatting → Credential redaction: redacts URLs (evidence: `errors.js`)
- Tool server → Bright Data APIs: calls service APIs (evidence: `server.js`)
- Browser actions → Bright Data APIs: gets browser credentials (evidence: `browser_tools.js`)
