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 inherit only a small allowlist of environment variables — just enough to locate an interpreter and a home directory. Anything else in your shell, including API keys and other credentials, does not reach the server unless you pass it through env explicitly.The allowlist is platform-specific. On POSIX systems it is HOME, LOGNAME, PATH, SHELL, TERM, and USER; on Windows it is APPDATA, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATH, PATHEXT, PROCESSOR_ARCHITECTURE, SYSTEMDRIVE, SYSTEMROOT, TEMP, USERNAME, and USERPROFILE.
For convenience, the client can infer STDIO transport from file paths, though this limits configuration options:

Environment Variables

Values you pass through env are merged on top of the inherited allowlist, so you add configuration rather than replacing the base environment. Anything your server needs beyond those six variables has to be listed explicitly. 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 httpx2 (documented in httpx’s SSL guide, which httpx2 follows):
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: