# brave/brave-search-mcp-server architecture

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

- Interactive diagram: https://gitdiagram.com/brave/brave-search-mcp-server
- Repository: https://github.com/brave/brave-search-mcp-server

## Overview

Brave Search MCP Server exposes Brave’s search capabilities as MCP tools. An MCP client connects over the default STDIO transport or optional Streamable HTTP; the server registers configured tools, which validate requests, call the Brave API, and format results for the client. The tool set covers web, local, place, image, video, news, LLM-context, and summarizer searches. HTTP additionally supports sessions and DNS-rebinding protection. Source excerpts show several tool implementations; other tool/API links are supported by the SOURCE INDEX, while the web-to-summarizer prerequisite is documented in the README.

Main entry points: [`src/tools/index.ts`](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/index.ts) (Tool Registry), [`src/BraveAPI/index.ts`](https://github.com/brave/brave-search-mcp-server/blob/main/src/BraveAPI/index.ts) (API Client), [`src/server.ts`](https://github.com/brave/brave-search-mcp-server/blob/main/src/server.ts) (MCP Server), [`src/protocols/http.ts`](https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/http.ts) (HTTP Transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["MCP Runtime"]
  node_entry["Process Entry<br/>[index.ts]"]
  node_config["Runtime Config<br/>[config.ts]"]
  node_server["MCP Server<br/>[server.ts]"]
  node_schema["Schema Dialect"]
end

subgraph group_transport["Transports"]
  node_protocols["Transport Select<br/>[index.ts]"]
  node_stdio["STDIO Transport<br/>[stdio.ts]"]
  node_http["HTTP Transport<br/>[http.ts]"]
  node_rebinding["Rebinding Guard<br/>[rebinding.ts]"]
end

subgraph group_search["Search Tools"]
  node_toolset["Tool Registry<br/>[index.ts]"]
  node_web["Web Search<br/>[index.ts]"]
  node_local["Local Search<br/>[index.ts]"]
  node_place["Place Search<br/>[index.ts]"]
  node_images["Image Search<br/>[index.ts]"]
  node_videos["Video Search<br/>[index.ts]"]
  node_news["News Search<br/>[index.ts]"]
  node_llm["LLM Context<br/>[index.ts]"]
  node_summarizer["Summarizer<br/>[index.ts]"]
end

subgraph group_api["Brave API"]
  node_brave["Brave Search API"]
  node_api_client["API Client<br/>[index.ts]"]
end

node_client(("MCP Client"))

node_client -->|"connects via"| node_stdio
node_client -.->|"connects via"| node_http
node_entry -->|"loads"| node_config
node_entry -->|"selects"| node_protocols
node_protocols -->|"dispatches"| node_stdio
node_protocols -->|"dispatches"| node_http
node_stdio -->|"creates"| node_server
node_http -->|"creates"| node_server
node_http -->|"guards requests"| node_rebinding
node_server -->|"checks permissions"| node_config
node_server -->|"registers tools"| node_toolset
node_server -->|"enforces dialect"| node_schema
node_toolset -->|"includes"| node_web
node_toolset -->|"includes"| node_local
node_toolset -->|"includes"| node_place
node_toolset -->|"includes"| node_images
node_toolset -->|"includes"| node_videos
node_toolset -->|"includes"| node_news
node_toolset -->|"includes"| node_llm
node_toolset -->|"includes"| node_summarizer
node_web -->|"requests"| node_api_client
node_local -->|"requests"| node_api_client
node_local -->|"formats fallback"| node_web
node_place -->|"requests"| node_api_client
node_images -->|"requests"| node_api_client
node_videos -->|"requests"| node_api_client
node_news -->|"requests"| node_api_client
node_llm -->|"requests"| node_api_client
node_summarizer -->|"requests"| node_api_client
node_web -->|"provides summary key"| node_summarizer
node_api_client -->|"calls endpoints"| node_brave

click node_entry "https://github.com/brave/brave-search-mcp-server/blob/main/src/index.ts"
click node_config "https://github.com/brave/brave-search-mcp-server/blob/main/src/config.ts"
click node_server "https://github.com/brave/brave-search-mcp-server/blob/main/src/server.ts"
click node_schema "https://github.com/brave/brave-search-mcp-server/blob/main/src/jsonSchemaDialect.ts"
click node_protocols "https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/index.ts"
click node_stdio "https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/stdio.ts"
click node_http "https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/http.ts"
click node_rebinding "https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/rebinding.ts"
click node_toolset "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/index.ts"
click node_web "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/web/index.ts"
click node_local "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/local/index.ts"
click node_place "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/place_search/index.ts"
click node_images "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/images/index.ts"
click node_videos "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/videos/index.ts"
click node_news "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/news/index.ts"
click node_llm "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/llm_context/index.ts"
click node_summarizer "https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/summarizer/index.ts"
click node_api_client "https://github.com/brave/brave-search-mcp-server/blob/main/src/BraveAPI/index.ts"

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_entry,node_config,node_server,node_schema,node_client toneBlue
class node_protocols,node_stdio,node_http,node_rebinding toneAmber
class node_toolset,node_web,node_local,node_place,node_images,node_videos,node_news,node_llm,node_summarizer toneMint
class node_brave,node_api_client toneRose
```

## Components

### MCP Runtime

- [Process Entry](https://github.com/brave/brave-search-mcp-server/blob/main/src/index.ts): `src/index.ts`
- [Runtime Config](https://github.com/brave/brave-search-mcp-server/blob/main/src/config.ts): `src/config.ts`
- [MCP Server](https://github.com/brave/brave-search-mcp-server/blob/main/src/server.ts): `src/server.ts`
- [Schema Dialect](https://github.com/brave/brave-search-mcp-server/blob/main/src/jsonSchemaDialect.ts): `src/jsonSchemaDialect.ts`

### Transports

- [Transport Select](https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/index.ts): `src/protocols/index.ts`
- [STDIO Transport](https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/stdio.ts): `src/protocols/stdio.ts`
- [HTTP Transport](https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/http.ts): `src/protocols/http.ts`
- [Rebinding Guard](https://github.com/brave/brave-search-mcp-server/blob/main/src/protocols/rebinding.ts): `src/protocols/rebinding.ts`

### Search Tools

- [Tool Registry](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/index.ts): `src/tools/index.ts`
- [Web Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/web/index.ts): `src/tools/web/index.ts`
- [Local Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/local/index.ts): `src/tools/local/index.ts`
- [Place Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/place_search/index.ts): `src/tools/place_search/index.ts`
- [Image Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/images/index.ts): `src/tools/images/index.ts`
- [Video Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/videos/index.ts): `src/tools/videos/index.ts`
- [News Search](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/news/index.ts): `src/tools/news/index.ts`
- [LLM Context](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/llm_context/index.ts): `src/tools/llm_context/index.ts`
- [Summarizer](https://github.com/brave/brave-search-mcp-server/blob/main/src/tools/summarizer/index.ts): `src/tools/summarizer/index.ts`

### Brave API

- **Brave Search API**
- [API Client](https://github.com/brave/brave-search-mcp-server/blob/main/src/BraveAPI/index.ts): `src/BraveAPI/index.ts`

### Other components

- **MCP Client**

## Connections

- MCP Client → STDIO Transport: connects via (evidence: `README.md`)
- MCP Client → HTTP Transport: connects via (evidence: `README.md`)
- Process Entry → Runtime Config: loads (evidence: `src/index.ts`)
- Process Entry → Transport Select: selects (evidence: `src/index.ts`)
- Transport Select → STDIO Transport: dispatches (evidence: `src/protocols/index.ts`)
- Transport Select → HTTP Transport: dispatches (evidence: `src/protocols/index.ts`)
- STDIO Transport → MCP Server: creates (evidence: `src/protocols/stdio.ts`)
- HTTP Transport → MCP Server: creates (evidence: `src/protocols/http.ts`)
- HTTP Transport → Rebinding Guard: guards requests (evidence: `src/protocols/http.ts`)
- MCP Server → Runtime Config: checks permissions (evidence: `src/server.ts`)
- MCP Server → Tool Registry: registers tools (evidence: `src/server.ts`)
- MCP Server → Schema Dialect: enforces dialect (evidence: `src/server.ts`)
- Tool Registry → Web Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → Local Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → Place Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → Image Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → Video Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → News Search: includes (evidence: `src/tools/index.ts`)
- Tool Registry → LLM Context: includes (evidence: `src/tools/index.ts`)
- Tool Registry → Summarizer: includes (evidence: `src/tools/index.ts`)
- Web Search → API Client: requests (evidence: `src/tools/web/index.ts`)
- Local Search → API Client: requests (evidence: `src/tools/local/index.ts`)
- Local Search → Web Search: formats fallback (evidence: `src/tools/local/index.ts`)
- Place Search → API Client: requests (evidence: `src/tools/place_search/index.ts`)
- Image Search → API Client: requests (evidence: `src/tools/images/index.ts`)
- Video Search → API Client: requests (evidence: `src/tools/videos/index.ts`)
- News Search → API Client: requests (evidence: `src/tools/news/index.ts`)
- LLM Context → API Client: requests (evidence: `src/tools/llm_context/index.ts`)
- Summarizer → API Client: requests (evidence: `src/tools/summarizer/index.ts`)
- Web Search → Summarizer: provides summary key (evidence: `README.md`)
- API Client → Brave Search API: calls endpoints (evidence: `src/BraveAPI/index.ts`)
