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.
This gives you access to MCPClient and CLI tools.
Create zapier_mcp.json:
Replace YOUR_UNIQUE_ID with your actual Zapier MCP endpoint from your dashboard.
Here’s a minimal agent using LangChain + MCP:
In your Zapier MCP dashboard:
Your AI agent will reply:
Want to add voice input or Arduino control next? I can show you how to absorb those into this setup too.
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]" httpxThis 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.