Skip to main content
The MCP class reads your connection string and picks the right transport automatically — you never set a transport flag.
The user passes one URL; the agent connects over Streamable HTTP because the URL is http(s):// with a path.

Quick Start

1

Streamable HTTP (path required)

2

stdio, SSE, or WebSocket


Detection Rules

The MCP class routes URL classification through a single helper, get_transport_type, so every transport follows the same rules.
For Streamable HTTP, the URL is used verbatim — include the endpoint path your server exposes (commonly /mcp). A bare-host URL will POST to / and fail with Session terminated. See PraisonAI #3032.

How It Works

The helper checks the URL scheme and suffix in order, then defaults to stdio for anything that is not a URL.

Common Patterns

Override auto-detection only when you must — pass a URL that already fits the transport you want.

Best Practices

A bare https://host POSTs to / and fails with Session terminated. Pass the full endpoint, commonly /mcp.
URLs ending in /sse select the deprecated SSE transport. Prefer Streamable HTTP for new servers.
WebSocket is auto-detected from the scheme and suits long-lived, bidirectional connections.
Anything that is not a URL runs as a local subprocess over stdio.

MCP Transports

Full guide to each transport

MCP Integration

Connect agents to MCP servers