> ## 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.

# Vercel Connect

> Connect Tavily to Vercel apps and agents with managed OAuth or API keys, then search through MCP, REST, or Eve.

[Vercel Connect](https://vercel.com/connect/tavily) manages credentials for apps and agents that call Tavily's [MCP server](https://docs.tavily.com/documentation/mcp.md) or [REST API](https://docs.tavily.com/documentation/api-reference/endpoint/search.md). Use OAuth when each user connects their own Tavily account, or an API key for shared application access.

Connect handles credentials; **Eve** runs agents; **AI Gateway** routes model requests. You can use Connect without either. For Tavily tools used directly in the AI SDK, see [Vercel AI SDK](https://docs.tavily.com/documentation/integrations/vercel.md).

## Prerequisites

* A [Vercel account](https://vercel.com/signup) and permission to create connectors and link projects.
* A [Tavily account](https://app.tavily.com) with credits. API-key connections also need a Tavily API key.
* Node.js 22 or newer for the scripts below, or Node.js 24 or newer for Eve, and the [Vercel CLI](https://vercel.com/docs/cli).

## Set up the connector

**1. Choose MCP or API**

Open [Tavily on Vercel Connect](https://vercel.com/connect/tavily), select **Create Connector**, and choose your team. Select **MCP** for agent tools or **API** for direct REST calls.

![Vercel Connect offering MCP and API connections for Tavily](https://mintcdn.com/tavilyai/-_eGcyuwNnmExXCE/images/vercel-connect-method.png?fit=max\&auto=format\&n=-_eGcyuwNnmExXCE\&q=85\&s=1c47c3c5cf0580f5df6489e94f50ca9f)

**2. Configure authentication**

For MCP OAuth, keep **Managed**, enter a name, and continue. Vercel manages the OAuth client. For the API connection, enter your key from the [Tavily dashboard](https://app.tavily.com).

![Managed OAuth configuration with connector name and optional UID](https://mintcdn.com/tavilyai/-_eGcyuwNnmExXCE/images/vercel-connect-managed-oauth.png?fit=max\&auto=format\&n=-_eGcyuwNnmExXCE\&q=85\&s=1a8ecda5d871f06443aaca41ece19627)

**3. Create the connector**

Leave the optional icon and colors as they are, or customize them. Select **Create Connector**, then **Continue**. Copy the connector's UID for your code; the examples use `tavily/your-connector-name` as a placeholder.

> **Customization and completion screens**
>
> ![Optional connector branding and Create Connector button](https://mintcdn.com/tavilyai/-_eGcyuwNnmExXCE/images/vercel-connect-customize.png?fit=max\&auto=format\&n=-_eGcyuwNnmExXCE\&q=85\&s=a272ec11b00ab2d0bb906922056951b1)
>
> ![Confirmation that the Tavily connector has been created](https://mintcdn.com/tavilyai/-_eGcyuwNnmExXCE/images/vercel-connect-ready.png?fit=max\&auto=format\&n=-_eGcyuwNnmExXCE\&q=85\&s=5e1eb0c9aec2f76fd1106d9b3fbe918a)

**4. Link a project**

In the connector's **Projects** section, select **Connect Project**, choose your project, and enable **Development** for local testing. If it is already linked, check the enabled environments. A deployment is not required.

![Tavily connector page with the Connect Project button](https://mintcdn.com/tavilyai/-_eGcyuwNnmExXCE/images/vercel-connect-project.png?fit=max\&auto=format\&n=-_eGcyuwNnmExXCE\&q=85\&s=b44c29e650c392eb9e130b1c96af78c3)

The Projects section of a Tavily connector; your connector name and UID will differ.

## Prepare a local project

Use an existing project directory, or create one:

```bash theme={null}
mkdir tavily-connect-example
cd tavily-connect-example
npm init -y
npm install @vercel/connect @ai-sdk/mcp
vercel login
vercel link
vercel env pull
```

Select the same project you linked to the connector. `vercel env pull` creates `.env.local` with a development `VERCEL_OIDC_TOKEN`. Keep this file out of Git and refresh it with the same command if the token expires. See [Vercel's authentication guide](https://vercel.com/docs/connect/concepts/authentication).

## Example usage

Find three sources about a company's product announcements, then use the results in a news feed, account brief, or research agent. Choose the example that matches your connector.

**MCP with OAuth**

Save this as `search.mjs`. The first run prints an authorization link. Open it, sign in to Tavily, approve access, and rerun the script.

```javascript search.mjs theme={null}
import {
  getToken,
  startAuthorization,
  UserAuthorizationRequiredError,
} from '@vercel/connect';
import { createMCPClient } from '@ai-sdk/mcp';

const connector = process.env.TAVILY_CONNECTOR_ID;
if (!connector) throw new Error('Set TAVILY_CONNECTOR_ID.');
const subject = { type: 'user', id: 'local-user' };

async function main() {
  let token;
  try {
    token = await getToken(connector, { subject });
  } catch (error) {
    if (!(error instanceof UserAuthorizationRequiredError)) throw error;
    const { url } = await startAuthorization(connector, { subject });
    console.log('Authorize Tavily, then rerun this script:', url);
    return;
  }

  const client = await createMCPClient({
    transport: {
      type: 'http',
      url: 'https://mcp.tavily.com/mcp',
      headers: { Authorization: `Bearer ${token}` },
    },
  });
  try {
    const result = await client.callTool({
      name: 'tavily_search',
      arguments: {
        query: 'Stripe agentic commerce product announcements',
        time_range: 'month',
        max_results: 3,
      },
    });
    if (result.isError) throw new Error('Tavily search failed.');
    console.log(JSON.stringify(result, null, 2));
  } finally {
    await client.close();
  }
}

await main();
```

```bash theme={null}
TAVILY_CONNECTOR_ID='tavily/your-connector-name' node --env-file=.env.local search.mjs
```

The response contains search results with titles, URLs, and content snippets. Creating a connector does not authorize a user: the grant belongs to the same user ID used in both calls. In an application, replace `local-user` with the signed-in user's ID from your server-side session.

To let a model choose and call tools, follow [Vercel's AI SDK and MCP guide](https://vercel.com/docs/connect/frameworks/ai-sdk-and-mcp).

**REST with an API key**

Use the UID of an **API** connector configured with a Tavily key. Save this as `search-rest.mjs`:

```javascript search-rest.mjs theme={null}
import { getToken } from '@vercel/connect';

const connector = process.env.TAVILY_CONNECTOR_ID;
if (!connector) throw new Error('Set TAVILY_CONNECTOR_ID.');
const apiKey = await getToken(connector, { subject: { type: 'app' } });

const response = await fetch('https://api.tavily.com/search', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${apiKey}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    query: 'Stripe agentic commerce product announcements',
    time_range: 'month',
    max_results: 3,
  }),
});
if (!response.ok) throw new Error(`Tavily returned ${response.status}`);
const { results } = await response.json();
console.table(results.map(({ title, url }) => ({ title, url })));
```

```bash theme={null}
TAVILY_CONNECTOR_ID='tavily/your-api-connector' node --env-file=.env.local search-rest.mjs
```

Connect supplies the stored key at runtime. This app-scoped call uses the shared credential and does not prompt each user to authorize Tavily.

**Eve agent**

[Eve](https://eve.dev/docs/getting-started) is Vercel's agent framework. Create an agent with Node.js 24 or newer, then connect a model through Eve's `/login` flow:

```bash theme={null}
npx eve@latest init tavily-agent
```

Exit the terminal UI and run these commands inside `tavily-agent`. Select a Vercel project when prompted. For this example, create an **MCP API-key** connector and enter your Tavily key at the CLI prompt:

```bash theme={null}
npm install @vercel/connect
vercel link
vercel connect create tavily --connection-method mcp-api-key --name tavily-agent
vercel connect attach 'tavily/your-connector-name' --environment development
vercel env pull
```

Replace the UID above and below with the UID returned by `create`. Add `agent/connections/tavily.ts`:

```typescript agent/connections/tavily.ts theme={null}
import { defineMcpClientConnection } from 'eve/connections';
import { connect } from '@vercel/connect/eve';

export default defineMcpClientConnection({
  url: 'https://mcp.tavily.com/mcp',
  tools: { allow: ['tavily_search', 'tavily_extract'] },
  auth: connect({
    connector: 'tavily/your-connector-name',
    principalType: 'app',
  }),
});
```

Run `npm run dev` and ask:

> Use Tavily to find three recent Stripe product announcements. Give each title, a one-sentence summary, the publication date if verified, and a source link.

This example shares one Tavily credential across the agent. For individual OAuth accounts, use an MCP OAuth connector and `principalType: 'user'` with an authenticated user principal. See [Eve authorization with Connect](https://vercel.com/docs/connect/frameworks/eve#authorize-an-mcp-connection).

## Resources

* [Tavily on Vercel Connect](https://vercel.com/connect/tavily)
* [Vercel Connect quickstart](https://vercel.com/docs/connect/quickstart)
* [Connect SDK reference](https://vercel.com/docs/connect/ts-sdk-reference)
* [Tavily MCP server](https://docs.tavily.com/documentation/mcp.md)
* [Tavily Search API](https://docs.tavily.com/documentation/api-reference/endpoint/search.md)
* [Tavily with Vercel AI SDK](https://docs.tavily.com/documentation/integrations/vercel.md)
