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

# Set up Tavily MCP Server

> Connect Tavily, an AI-optimized web search API for RAG agents, as a fully managed MCP server on the TrueFoundry MCP Gateway.

[Tavily](https://docs.tavily.com) is an AI-optimized search API built for RAG agents and LLM applications, returning clean, structured results ready to pass straight into a prompt. TrueFoundry provisions it as a [TrueFoundry Managed MCP](/docs/ai-gateway/mcp/tfy-managed-mcp-server) - the platform manages the server URL, auth, scopes and credentials, so your agents can use Tavily without any configuration or infrastructure setup on your end.

## Using Tavily through the MCP Gateway

The [TrueFoundry MCP Gateway](/docs/ai-gateway/mcp/mcp-overview) centralizes access to Tavily - agents connect through one endpoint instead of maintaining separate server configurations per client. As a [TrueFoundry Managed MCP](/docs/ai-gateway/mcp/tfy-managed-mcp-server), Tavily's URL, outbound auth, scopes, and credentials are owned and kept current by the platform.

When you use Tavily MCP server through the Gateway, TrueFoundry provides:

* **Authentication** — Clients [authenticate inbound](/docs/ai-gateway/mcp/mcp-gateway-auth-security#inbound-authentication) to the Gateway with a Personal Access Token, Virtual Account, or IDE OAuth flow. For outbound access, the Gateway runs the [OAuth2 Authorization Code flow](/docs/ai-gateway/mcp/mcp-gateway-auth-security#outbound-authentication) so each user authorizes their own Tavily account; tokens are stored, refreshed and injected per user on tool calls.
* **Access control** — [Collaborators and role-based policies](/docs/ai-gateway/mcp/mcp-gateway-auth-security#access-control) define who can use the server and which tools they can invoke. Enable or disable individual Tavily tools from the server detail page.
* **Observability** — Tool calls are traced with caller identity, tool name, inputs, and latency. Monitor server- and tool-level usage in [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) and export traces to your observability stack via OpenTelemetry.
* **Guardrails** — Apply [pre-tool and post-tool guardrails](/docs/ai-gateway/guardrails-overview) on MCP tool calls. Pre-tool checks run before execution and can block the call; post-tool checks run on the response before it returns to the agent.

## Adding Tavily MCP server to TrueFoundry

<Steps>
  <Step title="Open the MCP Server catalog">
    Navigate to **MCP Servers** in the TrueFoundry sidebar and click **Add new MCP Server**. On the next screen, select **Connect TrueFoundry Managed MCPs** - this opens the catalog of pre-vetted, fully configured MCP servers managed by TrueFoundry.

    <Frame>
      <img src="https://mintcdn.com/truefoundry/ojT1y2RfjAVtlRwX/images/docs/ai-gateway/tavily-step1-add-managed-mcp.png?fit=max&auto=format&n=ojT1y2RfjAVtlRwX&q=85&s=8ee300c64d31cbd24dd67987095f64a8" alt="TrueFoundry Add MCP Server screen with the Connect TrueFoundry Managed MCPs option selected" width="1992" height="1976" data-path="images/docs/ai-gateway/tavily-step1-add-managed-mcp.png" />
    </Frame>
  </Step>

  <Step title="Add Tavily">
    Find **tavily** in the catalogue and click **+ Add**. TrueFoundry provisions the server with no additional configuration and opens the Tavily MCP server detail page.

    <Frame>
      <img src="https://mintcdn.com/truefoundry/ojT1y2RfjAVtlRwX/images/docs/ai-gateway/tavily-step2-add-tavily.png?fit=max&auto=format&n=ojT1y2RfjAVtlRwX&q=85&s=8865d07352cd1c6a3a43f95c24553bf4" alt="Tavily entry in the TrueFoundry managed MCP catalog with the Add button" width="2000" height="1984" data-path="images/docs/ai-gateway/tavily-step2-add-tavily.png" />
    </Frame>
  </Step>

  <Step title="Authenticate">
    To authenticate, click **Connect Now**. A popup appears, review the details and click **Approve** to complete the authorization flow.

    <Frame>
      <img src="https://mintcdn.com/truefoundry/BnCVX4yDRWEulylV/images/docs/ai-gateway/tavily-step3-connect-now.png?fit=max&auto=format&n=BnCVX4yDRWEulylV&q=85&s=a03c8e6e83ee4dea6c987fe3736cc85a" alt="Tavily Tools tab showing the Connect Now button before authentication" width="3498" height="1984" data-path="images/docs/ai-gateway/tavily-step3-connect-now.png" />
    </Frame>

    <Frame>
      <img src="https://mintcdn.com/truefoundry/BnCVX4yDRWEulylV/images/docs/ai-gateway/tavily-step4-approve-oauth.png?fit=max&auto=format&n=BnCVX4yDRWEulylV&q=85&s=9b19760e2a57c3cf51b988c9cdfe5746" alt="Connect via TrueFoundry Gateway popup showing the MCP Gateway URL and redirect URL with an Approve button" width="1328" height="1112" data-path="images/docs/ai-gateway/tavily-step4-approve-oauth.png" />
    </Frame>
  </Step>

  <Step title="Verify tools">
    After approving, the **Tools** tab lists Tavily's available tools (search, extract, crawl, map, research, and more). Click **Try** on any tool to test it and inspect the JSON output before using it in an agent.

    <Frame>
      <img src="https://mintcdn.com/truefoundry/BnCVX4yDRWEulylV/images/docs/ai-gateway/tavily-step5-tools-list.png?fit=max&auto=format&n=BnCVX4yDRWEulylV&q=85&s=bd52695a5b78d79238ccbd84f790b102" alt="Tavily Tools tab populated with Tavily's tools after a successful connection" width="3490" height="1988" data-path="images/docs/ai-gateway/tavily-step5-tools-list.png" />
    </Frame>
  </Step>
</Steps>

## Connecting to an MCP Client

Open the **How To Use** tab on the Tavily server detail page for your tenant-specific Gateway URL and ready-to-paste client snippets - don't build the endpoint manually.

The tab includes snippets for Claude Code, VS Code, Claude Web, Claude Desktop, Cursor, Windsurf, Codex, and the Python and TypeScript MCP SDKs. Use **Show API Key** if your client requires a Gateway token in a header.

<Frame>
  <img src="https://mintcdn.com/truefoundry/pWpNVFWw2nxy0lxv/images/docs/ai-gateway/tavily-how-to-use-clients.png?fit=max&auto=format&n=pWpNVFWw2nxy0lxv&q=85&s=c2a42beccdedaf0fccb11ab53ae6c29e" alt="Tavily How To Use tab showing connection commands for multiple MCP clients" width="3490" height="1982" data-path="images/docs/ai-gateway/tavily-how-to-use-clients.png" />
</Frame>

## Using the Tool Playground

Before deploying an agent, you can test any Tavily MCP server tool directly in TrueFoundry:

<Steps>
  <Step title="Open a tool">
    On the Tavily MCP server detail page, click **Try** next to any tool - for example `tavily_search`.
  </Step>

  <Step title="Fill in the inputs">
    For `tavily_search`, the key parameters are:

    | Parameter                   | Description                                  |
    | --------------------------- | -------------------------------------------- |
    | **Query** (required)        | The search string                            |
    | **Max results**             | Number of results to return (default 5)      |
    | **Search depth**            | `basic`, `advanced`, `fast`, or `ultra-fast` |
    | **Topic**                   | `general` or a domain-specific filter        |
    | **Time range**              | Restrict results to a recency window         |
    | **Include/Exclude domains** | Allowlist or blocklist specific sites        |
  </Step>

  <Step title="Execute and inspect">
    Click **Execute Tool** and inspect the JSON output in the right panel. The output contains a `results` array where each item includes a `url`, `title`, `content` snippet, and a relevance `score`. The `tavily_research` tool returns a synthesized `answer` field in addition to the raw results.
  </Step>
</Steps>

<Frame>
  <img src="https://mintcdn.com/truefoundry/ojT1y2RfjAVtlRwX/images/docs/ai-gateway/tavily-tool-playground.png?fit=max&auto=format&n=ojT1y2RfjAVtlRwX&q=85&s=d504a8e189eb749529abf2a5e3ce5770" alt="Tavily tool playground showing input fields and the JSON output panel" width="2696" height="1986" data-path="images/docs/ai-gateway/tavily-tool-playground.png" />
</Frame>

## Tool Metrics

The **Tool Metrics** tab on the Tavily server detail page tracks how agents use each tool:

* **Invocation count** - which tools are called most often
* **Latency** - how long each tool takes to respond
* **Error rates** - which tools are failing in production

See [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) for server- and tool-level dashboards across your Gateway.

## Disabling Individual Tools

On the **Tools** tab, toggle off any Tavily tools your agents don't need:

* **Disabled tools** are hidden from MCP clients and cannot be invoked.
* **Enabled tools** remain available to agents as usual.
