MCP API Reference
Context Managers
mcp
Connect to a local MCP server using stdio transport.command(str): Command to run (e.g., “python”, “node”, “npx”)*args(str): Arguments for the commandenv(dict[str, str] | None): Environment variables
MCPServer
mcp_sse
Connect to a remote MCP server using SSE transport.url(str): SSE endpoint URLheaders(dict[str, str] | None): HTTP headers
MCPServer
mcp_http
Connect to a remote MCP server using Streamable HTTP transport.url(str): HTTP endpoint URLheaders(dict[str, str] | None): HTTP headers
MCPServer
Non-Context Manager Functions
connect_mcp
connect_mcp_sse
connect_mcp_http
Utility Functions
merge_tools
Combine multiple tool sources into a single ToolSet.*tool_sources(ToolSet | MCPServer): Tool sources to merge
ToolSet (dict[str, Tool])