MCP class reads your connection string and picks the right transport automatically — you never set a transport flag.
http(s):// with a path.
Quick Start
1
Streamable HTTP (path required)
2
stdio, SSE, or WebSocket
Detection Rules
TheMCP 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
Always include a path for HTTP servers
Always include a path for HTTP servers
A bare
https://host POSTs to / and fails with Session terminated. Pass the full endpoint, commonly /mcp.Use /sse only for legacy servers
Use /sse only for legacy servers
URLs ending in
/sse select the deprecated SSE transport. Prefer Streamable HTTP for new servers.Use ws:// or wss:// for real-time
Use ws:// or wss:// for real-time
WebSocket is auto-detected from the scheme and suits long-lived, bidirectional connections.
Command strings default to stdio
Command strings default to stdio
Anything that is not a URL runs as a local subprocess over stdio.
Related
MCP Transports
Full guide to each transport
MCP Integration
Connect agents to MCP servers

