> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tavily.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tavily MCP

> Connect Tavily's search, extract, crawl, map, and research tools to Claude, ChatGPT, Codex, Cursor, VS Code, or any MCP client.

Connect to Tavily using MCP in one click. Pick your client below:

> [tab] Claude & Claude Code
>
> [Add to Claude](https://claude.ai/directory/tavily)
>
> ```bash Claude Code theme={null}
> claude mcp add tavily --transport http https://mcp.tavily.com/mcp/
> ```
>
> **Claude** (claude.ai, Claude Desktop, and Cowork): click **Add to Claude**, then **Connect**, and sign in to Tavily. **Claude Code**: run the command above, then start a new session to sign in. See [Connect to Claude Code](#connect-to-claude-code) and the [Claude guide](https://docs.tavily.com/documentation/integrations/claude.md) for more options.

> [tab] ChatGPT & Codex
>
> [Add to ChatGPT and Codex](https://chatgpt.com/plugins/plugin_asdk_app_69f271663a288191ac98f46bed7cb032?search=tavily)
>
> ```bash Codex theme={null}
> codex mcp add tavily --url https://mcp.tavily.com/mcp/
> codex mcp login tavily
> ```
>
> Click **Add to ChatGPT and Codex** to open the Tavily plugin, then connect it and sign in to Tavily. To use the MCP server in Codex instead, run the commands above.

> [tab] Cursor
>
> [Add to Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=tavily\&config=eyJ1cmwiOiJodHRwczovL21jcC50YXZpbHkuY29tL21jcC8ifQ==)
>
> ```json mcp.json theme={null}
> {
>   "mcpServers": {
>     "tavily": {
>       "url": "https://mcp.tavily.com/mcp/"
>     }
>   }
> }
> ```
>
> Click **Add to Cursor** and sign in to Tavily when Cursor prompts you, or add the server to `~/.cursor/mcp.json` yourself. See [Connect to Cursor](#connect-to-cursor) to use an API key instead.

> [tab] VS Code
>
> [Add to VS Code](vscode:mcp/install?%7B%22name%22%3A%22tavily%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.tavily.com%2Fmcp%2F%22%7D)
>
> ```bash Terminal theme={null}
> code --add-mcp '{"name":"tavily","type":"http","url":"https://mcp.tavily.com/mcp/"}'
> ```
>
> Click **Add to VS Code** or run the command above, then start the server from the **MCP Servers** list and sign in to Tavily.

> [tab] Other clients
>
> ```json Remote (HTTP) theme={null}
> {
>   "mcpServers": {
>     "tavily": {
>       "url": "https://mcp.tavily.com/mcp/"
>     }
>   }
> }
> ```
>
> ```json Local bridge (stdio) theme={null}
> {
>   "mcpServers": {
>     "tavily": {
>       "command": "npx",
>       "args": ["-y", "mcp-remote", "https://mcp.tavily.com/mcp/"]
>     }
>   }
> }
> ```
>
> Use **Remote (HTTP)** if your client supports remote MCP servers. Otherwise, use the **Local bridge**, which connects stdio-only clients to the remote server through [`mcp-remote`](#clients-that-dont-support-remote-mcps).

> [!TIP]
>
> No account yet? [Keyless access](https://docs.tavily.com/documentation/keyless.md) lets you call Search and Extract with no API key.

## What you get

The Tavily MCP server gives your agent these tools:

| Tool | What it does |
| - | - |
| `tavily_search` | Search the web for current, relevant sources. |
| `tavily_extract` | Pull clean content from one or more URLs. |
| `tavily_crawl` | Read many pages across a site. |
| `tavily_map` | Discover a site's structure. |
| `tavily_research` | Run multi-source research and return a detailed answer. |

## Client setup details

### Connect to Claude Code

[Claude Code](https://docs.anthropic.com/en/docs/claude-code) natively supports remote MCP servers with OAuth authentication. Add Tavily to your Claude Code configuration by running:

```bash theme={null}
claude mcp add tavily --transport http https://mcp.tavily.com/mcp/
```

When you start a new conversation, Claude Code will open a browser window for you to complete the OAuth flow and authorize access to your Tavily account. No API key needed in the URL — authentication is handled automatically via OAuth.

You can also manually add the following to your `.claude/settings.json`:

```json theme={null}
{
  "mcpServers": {
    "tavily": {
      "type": "http",
      "url": "https://mcp.tavily.com/mcp/"
    }
  }
}
```

Alternatively, you can also connect using `mcp-remote`:

```bash theme={null}
claude mcp add tavily -- npx -y mcp-remote https://mcp.tavily.com/mcp
```

### Connect to Claude Desktop

Click **Add to Claude** at the top of this page, or open the [Tavily connector](https://claude.ai/directory/tavily) in Claude's directory, click **Connect**, and sign in to Tavily. See the [Claude guide](https://docs.tavily.com/documentation/integrations/claude.md) for organization-wide access and the Tavily plugin.

### Connect to Cursor

For the recommended Tavily plugin, standalone setup options, and examples, see the [Cursor guide](https://docs.tavily.com/documentation/integrations/cursor.md).

The **Add to Cursor** button above installs the server with OAuth. To use an API key instead, add this to your `mcp.json` and replace `<your-api-key>` with your [Tavily API key](https://app.tavily.com):

```json theme={null}
{
  "mcpServers": {
    "tavily": {
      "command": "npx -y mcp-remote https://mcp.tavily.com/mcp/?tavilyApiKey=<your-api-key>",
      "env": {}
    }
  }
}
```

### OpenAI Responses API

Allow OpenAI models to use the remote Tavily MCP server to perform tasks.

* Export your `OPENAI_API_KEY`.
* Replace `<your-api-key>` with your [Tavily API key](https://app.tavily.com).

```python theme={null}
import json

from openai import OpenAI

client = OpenAI()

resp = client.responses.create(
    model="gpt-4.1",
    tools=[
        {
            "type": "mcp",
            "server_label": "tavily",
            "server_url": "https://mcp.tavily.com/mcp/?tavilyApiKey=<your-api-key>",
            "require_approval": "never",
            ## Optional default parameters:
            "headers": {
                "DEFAULT_PARAMETERS": json.dumps({
                    "include_favicon": True,
                    "include_images": False,
                    "include_raw_content": False,
                }),
            },
        },
    ],
    input="Do you have access to the tavily mcp server?",
)

print(resp.output_text)
```

### Clients that don't support remote MCPs

mcp-remote is a lightweight bridge that lets MCP clients that can only talk to local (stdio) servers securely connect to remote MCP servers over HTTP + SSE with OAuth-based auth, so you can host and update your server in the cloud while existing clients keep working. It serves as an experimental stop-gap until popular MCP clients natively support remote, authorized servers.

```json theme={null}
{
    "tavily": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://mcp.tavily.com/mcp/?tavilyApiKey=<your-api-key>"
      ]
    }
}
```

## OAuth Authentication

The Tavily Remote MCP server supports secure OAuth authentication, allowing you to connect and authorize seamlessly with compatible clients.

> [accordion] Using MCP Inspector
>
> Open the MCP Inspector and click "Open Auth Settings". Select the OAuth flow and complete these steps:
>
> 1. Metadata discovery
> 2. Client registration
> 3. Preparing authorization
> 4. Request authorization and obtain the authorization code
> 5. Token request
> 6. Authentication complete
>
> Once finished, you will receive an access token that lets you securely make authenticated requests to the Tavily Remote MCP server.

> [accordion] Using Other MCP Clients
>
> You can configure your MCP client to use OAuth without including your Tavily API key in the URL. For example, in Cursor's `mcp.json`:
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "tavily": {
>       "command": "npx mcp-remote https://mcp.tavily.com/mcp",
>       "env": {}
>     }
>   }
> }
> ```
>
> If you need to clear stored OAuth credentials and reauthenticate, run:
>
> ```bash theme={null}
> rm -rf ~/.mcp-auth
> ```

> [!NOTE]
>
> **Choosing an account for OAuth**
>
> Each time you connect, Tavily asks whether to use your personal account or one of your organizations. To switch Tavily logins, choose **Use a different account**.
>
> * **Key used**: the account's `mcp_auth_default` key. Tavily creates it if it doesn't exist.
> * **Organization keys**: used even if another member created the key or your organization restricts key access.
> * **Workspaces**: an organization has one `mcp_auth_default` key, used whichever workspace it's in, including by members outside that workspace. If it doesn't exist, Tavily creates it in the Default workspace. See [Organizations and workspaces](https://docs.tavily.com/documentation/platform/managing-organizations.md).
> * **Personal accounts off**: if an organization you belong to disables personal accounts, Personal isn't offered.
> * **Lost access**: if you lose access to the account or its key is deleted, requests fail and ask you to reconnect. Tavily never switches accounts on its own.
>
> OAuth is optional. You can also authenticate with your API key in the URL (`?tavilyApiKey=...`) or the `Authorization` header.

## Default Parameters

When using the remote MCP, you can specify default parameters for all requests by including a `DEFAULT_PARAMETERS` header containing a JSON object with your desired defaults. Example:

```
{"include_images":true, "search_depth": "advanced", "max_results": 10}
```

## Session & User Attribution

The remote MCP server automatically attaches identifiers to every Tavily API call so requests can be attributed back to a session. It generates `X-Session-Id` on its own, while `X-Human-Id` is forwarded only when supplied by the client.

* **`X-Session-Id`** — generated per MCP session (the `mcp-session-id` returned during the MCP `initialize` handshake). All tool calls within the same MCP session share the same value.
* **`X-Human-Id`** — if your client provides an `X-Human-Id` header (or `humanId` query parameter on the MCP URL), it is forwarded through to the Tavily API, helping Tavily better understand multi-step interactions and improve response quality. For security, Tavily hashes human IDs before processing or storing them.

See [Session Tracking](https://docs.tavily.com/documentation/api-headers.md#session-tracking) for the underlying API contract.

## Local Installation

You can also run the Tavily MCP server on your own machine instead of using the remote server.

### Prerequisites

> [accordion] Required Tools
>
> * [Tavily API key](https://app.tavily.com/home)
>   * If you don't have a Tavily API key, you can sign up for a free account [here](https://app.tavily.com/home)
> * An MCP client, such as [Claude Desktop](https://claude.ai/download) or [Cursor](https://cursor.com)
> * [Node.js](https://nodejs.org/) (v20 or higher)
>   * You can verify your Node.js installation by running:
>     ```bash theme={null}
>     node --version
>     ```

> [accordion] Git Installation (Optional)
>
> Only needed if using Git installation method:
>
> * On macOS: `brew install git`
> * On Linux:
>   * Debian/Ubuntu: `sudo apt install git`
>   * RedHat/CentOS: `sudo yum install git`
> * On Windows: Download [Git for Windows](https://git-scm.com/download/win)

```bash NPX theme={null}
npx -y tavily-mcp@latest
```

```bash Git theme={null}
git clone https://github.com/tavily-ai/tavily-mcp.git
cd tavily-mcp
npm install
npm run build
```

> [!NOTE]
>
> Although you can launch a server on its own, it's not particularly helpful in
> isolation. Instead, you should integrate it into an MCP client.

### Configuring MCP Clients

> [tab] Cursor
>
> Follow the [local MCP setup in the Cursor guide](https://docs.tavily.com/documentation/integrations/cursor.md#local-mcp-server) to configure the server in `mcp.json`, add your Tavily API key, and enable its tools in **Customize**.

> [tab] Claude Desktop
>
> ```bash macOS theme={null}
> # Create the config file if it doesn't exist
> touch "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
>
> # Opens the config file in TextEdit
> open -e "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
>
> # Alternative method using Visual Studio Code
> code "$HOME/Library/Application Support/Claude/claude_desktop_config.json"
> ```
>
> ```bash Windows theme={null}
> code %APPDATA%\Claude\claude_desktop_config.json
> ```
>
> Add this configuration (replace `tvly-YOUR_API_KEY-here` with your [Tavily API key](https://app.tavily.com)):
>
> ```json Configuration theme={null}
> {
>   "mcpServers": {
>     "tavily-mcp": {
>       "command": "npx",
>       "args": ["-y", "tavily-mcp@latest"],
>       "env": {
>         "TAVILY_API_KEY": "tvly-YOUR_API_KEY-here"
>       }
>     }
>   }
> }
> ```

### Default parameters for local servers

For local MCP setups, you can set default parameter values using the `DEFAULT_PARAMETERS` environment variable. This allows you to configure default search behavior without specifying these parameters in every request.

```json theme={null}
{
  "mcpServers": {
    "tavily-mcp": {
      "command": "npx",
      "args": ["-y", "tavily-mcp@latest"],
      "env": {
        "TAVILY_API_KEY": "your-api-key-here",
        "DEFAULT_PARAMETERS": "{\"include_images\": true, \"max_results\": 15, \"search_depth\": \"advanced\"}"
      }
    }
  }
}
```

### Session attribution for local servers

The local MCP server automatically attaches identifiers to every Tavily API call so requests can be attributed back to a session:

* **`X-Session-Id`** — auto-generated once per MCP process and reused for every tool call.
* **`X-Human-Id`** — if you set the `HUMAN_ID` environment variable, that value is forwarded through to the Tavily API on every request, helping Tavily better understand multi-step interactions and improve response quality. For security, Tavily hashes human IDs before processing or storing them.

See [Session Tracking](https://docs.tavily.com/documentation/api-headers.md#session-tracking) for the underlying API contract.

## Usage Examples

> [accordion] Tavily Search Examples
>
> 1. **General Web Search**:
>
> ```
> Can you search for recent developments in quantum computing?
> ```
>
> 2. **News Search**:
>
> ```
> Search for news articles about AI startups from the last 7 days.
> ```
>
> 3. **Domain-Specific Search**:
>
> ```
> Search for climate change research on nature.com and sciencedirect.com
> ```

> [accordion] Tavily Extract Examples
>
> **Extract Article Content**:
>
> ```
> Extract the main content from this article: https://example.com/article
> ```

> [accordion] Combined Usage
>
> ```
> Search for news articles about AI startups from the last 7 days and extract the main content from each article to generate a detailed report.
> ```

## Troubleshooting

> [accordion] Server Not Found
>
> If you encounter server connection issues, run these commands to verify your environment:
>
> ```bash theme={null}
> npm --version
> node --version
> ```
>
> Make sure to also check your configuration syntax for any errors.

> [accordion] NPX Issues
>
> If experiencing problems with npx, locate your executable:
>
> ```bash theme={null}
> which npx
> ```
>
> > [!TIP]
> >
> > Once you have the path, update your configuration to use the full path to the npx executable.

> [accordion] API Key Issues
>
> When troubleshooting API key problems, verify that your key is:
>
> * Properly formatted with the `tvly-` prefix
>
> * Valid and active in your Tavily dashboard
>
> * Correctly configured in your environment variables
>
> > [!TIP]
> >
> > You can test your API key validity by making a simple test request through the [Tavily Playground](https://app.tavily.com/playground)

## Resources

> [card] [GitHub](https://github.com/tavily-ai/tavily-mcp)
>
> `tavily-ai/tavily-mcp`
>
> ![GitHub Repo stars](https://img.shields.io/github/stars/tavily-ai/tavily-mcp?style=social)

> [card] [npm](https://www.npmjs.com/package/tavily-mcp)
>
> `tavily-mcp`
>
> ![npm](https://img.shields.io/npm/dt/tavily-mcp)

> [card] [Tutorial: Tavily MCP with Neo4j](https://medium.com/@dustin_36183/building-a-knowledge-graph-assistant-combining-tavily-and-neo4j-mcp-servers-with-claude-db92de075df9)
>
> Build a knowledge graph assistant by combining the Tavily and Neo4j MCP servers with Claude.

> [card] [Model Context Protocol](https://modelcontextprotocol.io)
>
> Read the MCP specification.
