Skip to main content
Transports handle the underlying connection between your client and MCP servers. While the client can automatically select a transport based on what you pass to it, instantiating transports explicitly gives you full control over configuration.

STDIO Transport

STDIO transport communicates with MCP servers through subprocess pipes. When using STDIO, your client launches and manages the server process, controlling its lifecycle and environment.
STDIO servers run in isolated environments by default. They do not inherit your shell’s environment variables. You must explicitly pass any configuration the server needs.
For convenience, the client can infer STDIO transport from file paths, though this limits configuration options:

Environment Variables

Since STDIO servers do not inherit your environment, you need strategies for passing configuration. Selective forwarding passes only the variables your server needs:
Loading from .env files keeps configuration separate from code:

Session Persistence

STDIO transports maintain sessions across multiple client contexts by default (keep_alive=True). This reuses the same subprocess for multiple connections, improving performance.
For complete isolation between connections, disable session persistence:

HTTP Transport

HTTP transport connects to MCP servers running as web services. This is the recommended transport for production deployments.
FastMCP also provides authentication helpers:

SSL Verification

By default, HTTPS connections verify the server’s SSL certificate. You can customize this behavior with the verify parameter, which accepts the same values as httpx:
The verify parameter is also available directly on StreamableHttpTransport and SSETransport:

SSE Transport

Server-Sent Events transport is maintained for backward compatibility. Use Streamable HTTP for new deployments unless you have specific infrastructure requirements.

In-Memory Transport

In-memory transport connects directly to a FastMCP server instance within the same Python process. This eliminates both subprocess management and network overhead, making it ideal for testing.
Unlike STDIO transports, in-memory servers share the same memory space and environment variables as your client code.

Multi-Server Configuration

Connect to multiple servers defined in a configuration dictionary:

Tool Transformations

FastMCP supports tool transformations within the configuration. You can change names, descriptions, tags, and arguments for tools from a server.
To filter tools by tag, use include_tags or exclude_tags at the server level: