If you have connected more than one account for the same app, add "alias": "work" to select one.
Use with an agent
Code
import asynciofrom agents import Agent, Runnerfrom agents.mcp import MCPServerStreamableHttpasync def main(): async with MCPServerStreamableHttp( name="mewcp", params={ "url": "https://gateway.mewcp.com/personal/mcp", "headers": {"Authorization": f"Bearer {MEWCP_API_KEY}"}, }, ) as server: agent = Agent( name="Assistant", instructions="You are a helpful assistant with access to the user's connected apps.", mcp_servers=[server], ) result = await Runner.run(agent, "What is on my calendar tomorrow?") print(result.final_output)asyncio.run(main())
The agent will call search to find the calendar tool, get_schema for its parameters, then call_tool to run it.