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

# Zapier MCP for the Anthropic API: setup with a token

> Connect the Anthropic Messages API to Zapier MCP by creating a server and generating a connection token, then adding Zapier to mcp_servers in your request.

Use this page only when the user is calling the Anthropic Messages API directly. If they are connecting Claude, Claude Code, or another MCP client, follow that MCP client's page instead. The server and the token come first: the request cannot run until step two is done.

When adapting the request to an Anthropic SDK, keep the endpoint URL, the `authorization_token`, the `mcp_toolset` entry, and the MCP connector beta header.

The token is a credential, so do not ask the user to paste it into chat and do not write it into a file for them. If it is exposed, have them click **Rotate token** in the **API token** section of the **Settings** tab.

This page shows how to use Zapier MCP tools in Anthropic API requests using a connection token.

## Before you begin

* A [Zapier account](https://zapier.com/sign-up).
* An [Anthropic API key](https://console.anthropic.com/settings/keys).

## Connect the Anthropic API to Zapier MCP

**1. Create an MCP server**

* Go to [mcp.zapier.com](https://mcp.zapier.com).
* Click **Add MCP server**.
* Under **Choose your AI agent**, search for and select **Anthropic API**.

**2. Generate a connection token**

* Select the ![settings icon](https://cdn.zapier.com/storage/photos/3451c46a93d480da52444589a8fc84ff.png) **Settings** tab.
* In the **API token** section, click **Generate token**.
* Copy the **Token**.

The token is only shown once. If you lose it, click **Rotate token** to get a new one. The previous token stops working straight away, so update anywhere you used it.

> [!WARNING]
>
> Treat your connection token like a password. Anyone with the token, or with a server URL that contains it, can run tools on this server and access your data.

**3. Set your credentials as environment variables**

```bash theme={null}
export ANTHROPIC_API_KEY="YOUR_ANTHROPIC_API_KEY"
export ZAPIER_MCP_TOKEN="YOUR_ZAPIER_MCP_TOKEN"
```

**4. Send a request with Zapier as an MCP server**

Add Zapier to the `mcp_servers` array, and reference it from an `mcp_toolset` tool. The request reads your keys from the `ANTHROPIC_API_KEY` and `ZAPIER_MCP_TOKEN` environment variables:

**cURL**

```bash theme={null}
curl https://api.anthropic.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" \
  -d '{
    "model": "claude-sonnet-4-5-20250929",
    "max_tokens": 1000,
    "messages": [{"role": "user", "content": "What tools do you have available?"}],
    "mcp_servers": [{
      "type": "url",
      "url": "https://mcp.zapier.com/api/v1/connect",
      "name": "zapier",
      "authorization_token": "'"$ZAPIER_MCP_TOKEN"'"
    }],
    "tools": [{
      "type": "mcp_toolset",
      "mcp_server_name": "zapier"
    }]
  }'
```

**JavaScript**

Install the Anthropic SDK:

```bash theme={null}
npm install @anthropic-ai/sdk
```

Or with pnpm:

```bash theme={null}
pnpm add @anthropic-ai/sdk
```

Send the request:

```javascript theme={null}
import { Anthropic } from "@anthropic-ai/sdk";

const anthropic = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const response = await anthropic.beta.messages.create({
  model: "claude-sonnet-4-5-20250929",
  max_tokens: 1000,
  messages: [
    {
      role: "user",
      content: "What tools do you have available?",
    },
  ],
  mcp_servers: [
    {
      type: "url",
      url: "https://mcp.zapier.com/api/v1/connect",
      name: "zapier",
      authorization_token: process.env.ZAPIER_MCP_TOKEN,
    },
  ],
  tools: [
    {
      type: "mcp_toolset",
      mcp_server_name: "zapier",
    },
  ],
  betas: ["mcp-client-2025-11-20"],
});

console.log(JSON.stringify(response, null, 2));
```

**Python**

Install the Anthropic SDK:

```bash theme={null}
pip install anthropic
```

Or with uv:

```bash theme={null}
uv pip install anthropic
```

Send the request:

```python theme={null}
import os

import anthropic

client = anthropic.Anthropic(
    # API key defaults to os.environ.get("ANTHROPIC_API_KEY")
)

response = client.beta.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1000,
    messages=[{"role": "user", "content": "What tools do you have available?"}],
    mcp_servers=[
        {
            "type": "url",
            "url": "https://mcp.zapier.com/api/v1/connect",
            "name": "zapier",
            "authorization_token": os.environ["ZAPIER_MCP_TOKEN"],
        }
    ],
    tools=[
        {
            "type": "mcp_toolset",
            "mcp_server_name": "zapier",
        }
    ],
    betas=["mcp-client-2025-11-20"],
)

print(response)
```

For request options, check Anthropic's [MCP connector documentation](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector).

You've now connected the Anthropic API to Zapier MCP.

## Next steps

> **[How tools work](/mcp/overview/how-tools-work)**
>
> What each meta-tool does, and how dynamic tool discovery works.

> **[How connections work](/mcp/overview/how-connections-work)**
>
> How connection tokens work, and how to manage them.
