> ## 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** on the **Connect** 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

<Steps>
  <Step title="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**.
  </Step>

  <Step title="Generate a connection token">
    * Select the <img src="https://cdn.zapier.com/storage/photos/baa5b3a64988a15f0dc8497c52ec257b.png" alt="link icon" noZoom style={{ display: "inline-block", width: "14px", margin: "0 0.15em", verticalAlign: "baseline" }} /> **Connect** tab.
    * Click **Generate token**.
    * Copy the token from **Or manually 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.
    </Warning>
  </Step>

  <Step title="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"
    ```
  </Step>

  <Step title="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:

    <Tabs>
      <Tab title="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"
            }]
          }'
        ```
      </Tab>

      <Tab title="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));
        ```
      </Tab>

      <Tab title="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)
        ```
      </Tab>
    </Tabs>

    The <img src="https://cdn.zapier.com/storage/photos/baa5b3a64988a15f0dc8497c52ec257b.png" alt="link icon" noZoom style={{ display: "inline-block", width: "14px", margin: "0 0.15em", verticalAlign: "baseline" }} /> **Connect** tab also gives you a copy-ready version of this request with your token already filled in.

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

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

## Next steps

<CardGroup cols={2}>
  <Card title="How tools work" href="/mcp/overview/how-tools-work">
    What each meta-tool does, and how dynamic tool discovery works.
  </Card>

  <Card title="How connections work" href="/mcp/overview/how-connections-work">
    How connection tokens work, and how to manage them.
  </Card>
</CardGroup>
