Pipedream Google Calendar

This example shows how to use the Google Calendar Pipedream MCP server with Kern Agents.

Code

1"""
2 Pipedream Google Calendar MCP
3
4This example shows how to use Pipedream MCP servers (in this case the Google Calendar one) with Kern Agents.
5
61. Connect your Pipedream and Google Calendar accounts: https://mcp.pipedream.com/app/google-calendar
72. Get your Pipedream MCP server url: https://mcp.pipedream.com/app/google-calendar
83. Set the MCP_SERVER_URL environment variable to the MCP server url you got above
94. Install dependencies: uv pip install kern-ai mcp-sdk
10"""
11
12import asyncio
13import os
14
15from kern.agent import Agent
16from kern.models.openai import OpenAIResponses
17from kern.tools.mcp import MCPTools
18from kern.utils.log import log_exception
19
20mcp_server_url = os.getenv("MCP_SERVER_URL")
21
22
23async def run_agent(task: str) -> None:
24 try:
25 async with MCPTools(
26 url=mcp_server_url, transport="sse", timeout_seconds=20
27 ) as mcp:
28 agent = Agent(
29 model=OpenAIResponses(id="gpt-5.2"),
30 tools=[mcp],
31 markdown=True,
32 )
33 await agent.aprint_response(
34 message=task,
35 stream=True,
36 )
37 except Exception as e:
38 log_exception(f"Unexpected error: {e}")
39
40
41if __name__ == "__main__":
42 asyncio.run(
43 run_agent("Tell me about all events I have in my calendar for tomorrow")
44 )