# tavily-ai/tavily-mcp architecture

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

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

## Overview

This repository is a local Tavily MCP server: an MCP client invokes a registered tool, the server dispatches the request to a Tavily operation, and formats the returned data for the client. The README also documents search, extract, map, and crawl, all exposed through the sampled server entry point. Source excerpts are partial, so the graph omits uncertain configuration and authentication wiring.

Main entry points: [`src/index.ts`](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts) (Tool dispatcher), [`src/format-results.ts`](https://github.com/tavily-ai/tavily-mcp/blob/main/src/format-results.ts) (Result formatter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mcp["MCP interface"]
  node_server["MCP server<br/>[index.ts]"]
  node_stdio["stdio transport<br/>[index.ts]"]
  node_registry["Tool registry<br/>[index.ts]"]
  node_dispatcher["Tool dispatcher<br/>[index.ts]"]
end

subgraph group_tools["Tavily operations"]
  node_search["Web search<br/>[index.ts]"]
  node_extract["Page extraction<br/>[index.ts]"]
  node_map["Website mapping<br/>[index.ts]"]
  node_crawl["Web crawling<br/>[index.ts]"]
end

subgraph group_results["Result handling"]
  node_formatter["Result formatter<br/>[format-results.ts]"]
  node_response["Tool response<br/>[index.ts]"]
end

node_client(("MCP client"))
node_tavily["Tavily API"]

node_client -->|"sends requests"| node_stdio
node_stdio -->|"connects transport"| node_server
node_server -->|"lists tools"| node_registry
node_server -->|"handles calls"| node_dispatcher
node_dispatcher -->|"dispatches search"| node_search
node_dispatcher -->|"dispatches extract"| node_extract
node_dispatcher -->|"dispatches map"| node_map
node_dispatcher -->|"dispatches crawl"| node_crawl
node_search -->|"posts search"| node_tavily
node_extract -->|"posts extraction"| node_tavily
node_map -->|"posts map"| node_tavily
node_crawl -->|"posts crawl"| node_tavily
node_dispatcher -->|"formats results"| node_formatter
node_formatter -->|"returns text"| node_response
node_response -->|"sends response"| node_client

click node_server "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_stdio "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_registry "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_dispatcher "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_search "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_extract "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_map "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_crawl "https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts"
click node_formatter "https://github.com/tavily-ai/tavily-mcp/blob/main/src/format-results.ts"
click node_response "https://github.com/tavily-ai/tavily-mcp/blob/main/src/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_server,node_stdio,node_registry,node_dispatcher,node_client toneBlue
class node_search,node_extract,node_map,node_crawl toneAmber
class node_formatter,node_response,node_tavily toneMint
```

## Components

### MCP interface

- [MCP server](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [stdio transport](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [Tool registry](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [Tool dispatcher](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`

### Tavily operations

- [Web search](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [Page extraction](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [Website mapping](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`
- [Web crawling](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`

### Result handling

- [Result formatter](https://github.com/tavily-ai/tavily-mcp/blob/main/src/format-results.ts): `src/format-results.ts`
- [Tool response](https://github.com/tavily-ai/tavily-mcp/blob/main/src/index.ts): `src/index.ts`

### Other components

- **MCP client**
- **Tavily API**

## Connections

- MCP client → stdio transport: sends requests
- stdio transport → MCP server: connects transport
- MCP server → Tool registry: lists tools
- MCP server → Tool dispatcher: handles calls
- Tool dispatcher → Web search: dispatches search
- Tool dispatcher → Page extraction: dispatches extract
- Tool dispatcher → Website mapping: dispatches map
- Tool dispatcher → Web crawling: dispatches crawl
- Web search → Tavily API: posts search
- Page extraction → Tavily API: posts extraction
- Website mapping → Tavily API: posts map
- Web crawling → Tavily API: posts crawl
- Tool dispatcher → Result formatter: formats results
- Result formatter → Tool response: returns text
- Tool response → MCP client: sends response
