MCPServerAdapter wraps MCP tools as CrewAI-compatible tools. It requires a context manager to manage the connection lifecycle:
Code
from crewai_tools import MCPServerAdapterMEWCP_API_KEY = "API_KEY"server_params = { "url": "https://gateway.mewcp.com/personal/mcp", "transport": "streamable-http", "headers": {"Authorization": f"Bearer {MEWCP_API_KEY}"},}with MCPServerAdapter(server_params) as mcp_tools: print("Available tools:", [t.name for t in mcp_tools]) # -> ["search", "get_schema", "list_accounts", "call_tool"]
Note: transport must be "streamable-http" (hyphenated).
You get four tools rather than the tools of each app. Your agent uses them to reach every app you have connected. See How MewCP works.
Call a tool directly
Code
with MCPServerAdapter(server_params) as mcp_tools: call_tool = next(t for t in mcp_tools if t.name == "call_tool") result = call_tool.run({ "server_maskedId": "google-calendar", "tool_name": "list_events", "args": { "calendar_id": "primary", "time_min": "2026-01-15T00:00:00Z", "time_max": "2026-01-16T00:00:00Z", }, }) print(result)
If you have connected more than one account for the same app, add "alias": "work" to select one.
Use with a CrewAI agent
Hand all four tools to the agent and let it work out the rest:
Code
from crewai import Agent, Task, Crewfrom crewai_tools import MCPServerAdapterserver_params = { "url": "https://gateway.mewcp.com/personal/mcp", "transport": "streamable-http", "headers": {"Authorization": f"Bearer {MEWCP_API_KEY}"},}with MCPServerAdapter(server_params) as mcp_tools: agent = Agent( role="Assistant", goal="Answer questions using the user's connected apps", backstory="Expert at finding and using the right tool for the job.", tools=list(mcp_tools), verbose=True, ) task = Task( description="Check what is on my calendar tomorrow and summarise the day.", expected_output="A short summary of tomorrow's schedule.", agent=agent, ) crew = Crew(agents=[agent], tasks=[task]) crew.kickoff()