zapier MCP server

fukurou

the supreme coder
ADMIN
Here’s a clean Python walkthrough to connect your AI agent to Zapier MCP—no spaghetti, just the essentials. This setup lets your agent call real-world actions like checking rain alerts, sending emails, or posting to Slack using natural language.




🧰 Prerequisites​


  • Python 3.8+
  • Node.js (for Zapier MCP server, if self-hosted)
  • A Zapier account with Zapier MCP access
  • An AI agent framework (e.g. LangChain, Claude, Cursor, Windsurf)



🪄 Step-by-Step Python Setup​


1. Install MCP Client SDK

pip install "mcp[cli]" httpx


This gives you access to MCPClient and CLI tools.




2. Create a Config File


Create zapier_mcp.json:

JSON:
{
  "mcpServers": {
    "zapier": {
      "remote": "https://actions.zapier.com/mcp/YOUR_UNIQUE_ID"
    }
  }
}


Replace YOUR_UNIQUE_ID with your actual Zapier MCP endpoint from your dashboard.




3. Connect AI Agent to MCP


Here’s a minimal agent using LangChain + MCP:

Python:
from mcpus import MCPClient, MCPAgent
from langchain_openai import ChatOpenAI

# Load MCP config
client = MCPClient("zapier_mcp.json")

# Set up your LLM
llm = ChatOpenAI(model="gpt-4o", temperature=0.5)

# Create MCP-enabled agent
agent = MCPAgent(llm=llm, client=client)

# Run a natural language query
response = agent.run("Check rain alerts for Tokyo")
print(response)




4. Enable Actions in Zapier MCP


In your Zapier MCP dashboard:


  • Click + Add Tool
  • Choose an app (e.g. Weather, Gmail, Slack)
  • Select an action (e.g. “Get Weather Alerts”)
  • Configure inputs (e.g. location, severity)
  • Save and test



✅ Example Output​

JSON:
[
  {
    "event": "Heavy Rain Warning",
    "severity": "Severe",
    "description": "Rainfall expected to exceed 80mm/h in Tokyo...",
    "instruction": "Avoid low-lying areas and stay indoors."
  }
]


Your AI agent will reply:


⚠️ Heavy rain warning in Tokyo. Stay indoors and avoid low-lying areas.”



Want to add voice input or Arduino control next? I can show you how to absorb those into this setup too.
 

fukurou

the supreme coder
ADMIN
🧰 Step-by-Step: Direct MCP Tool Call with String Output

1. Install the MCP SDK

Bash:
pip install "mcp[cli]" httpx




2. Create Your Config File


Save this as zapier_mcp.json:

JSON:
{
  "mcpServers": {
    "zapier": {
      "remote": "https://actions.zapier.com/mcp/YOUR_UNIQUE_ID"
    }
  }
}


Replace YOUR_UNIQUE_ID with your actual Zapier MCP endpoint.(from https://zapier.com/)




3. Python Script to Call Tool and Convert Response to String

Python:
from mcpus import MCPClient
import json

# Load MCP config
client = MCPClient("zapier_mcp.json")

# Call the tool directly
response = client.call_tool("get_weather_by_city", {
    "city": "Tokyo",
    "units": "metric"
})

# Convert JSON response to a formatted string
response_str = json.dumps(response, indent=2)

print(response_str)


This uses json.dumps() to serialize the response into a readable string format.




✅ Output Example​

JSON:
{
  "event": "Heavy Rain Warning",
  "severity": "Severe",
  "description": "Rainfall expected to exceed 80mm/h in Tokyo...",
  "instruction": "Avoid low-lying areas and stay indoors."
}


Now it's a proper string—easy to log, send, or narrate.
 
Last edited:
Top