Skip to main content
This is a very basic guide to get you started with connecting your agent to Zapier MCP servers. Please check out the official Model Context Protocol (MCP) documentation for more detailed information.

Connection examples

Below are examples of connecting to Zapier MCP from your MCP client using the server URL and secret.

Installation

npm install @modelcontextprotocol/sdk

// or

pnpm add @modelcontextprotocol/sdk

Usage

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

/**
 * Connect to the Zapier MCP server
 *
 * @param serverUrl URL for the MCP server for a specific user
 * @param secret Your Zapier MCP embed secret
 * @returns MCP client
 */
async function connectToZapierMcp(serverUrl: string, secret: string) {
  const transport = new StreamableHTTPClientTransport(new URL(serverUrl), {
    requestInit: {
      headers: {
        Authorization: `Bearer ${secret}`,
      },
    },
  });

  const client = new Client({
    name: "zapier-mcp",
    version: "1.0.0",
  });

  await client.connect(transport);

  return client;
}

async function main() {
  const client = await connectToZapierMcp(serverUrl, secret);

  const tools = await client.listTools();
  console.log("Available tools:", tools);

  await client.transport?.close();
  await client.close();
}