Skip to main content

What are Transports?

Transports define how your MCP server communicates with clients. FastMCP supports three transport types:
  • stdio - Standard input/output for local, single-client connections
  • httpStream - HTTP streaming for remote, multi-client connections
  • SSE - Server-Sent Events (automatically enabled with httpStream)
Each transport has different characteristics and use cases.

stdio Transport

The stdio transport uses standard input/output for communication. It’s ideal for local, single-client connections.

Basic Usage

When to Use stdio

Use stdio when

  • Running locally on the same machine as the client
  • Integrating with IDEs and desktop applications
  • Single client connections
  • Simple deployment scenarios

Avoid stdio when

  • Need remote access
  • Multiple concurrent clients
  • Web-based clients
  • Load balancing required

Configuration

No additional configuration is needed for stdio transport.

HTTP Stream Transport

The HTTP streaming transport provides efficient communication over HTTP. It’s ideal for remote, multi-client scenarios.

Basic Usage

This starts the server on http://localhost:8080/mcp for HTTP streaming and http://localhost:8080/sse for SSE.

Configuration Options

When to Use HTTP Stream

Use httpStream when

  • Remote access needed
  • Multiple concurrent clients
  • Web-based applications
  • Load balancing required
  • Cloud deployment

Consider alternatives when

  • Local-only access needed
  • Single client scenario
  • Maximum simplicity desired

Client Connection

Connect from a client using the HTTP streaming transport:

SSE Transport

Server-Sent Events are automatically enabled when using HTTP Stream transport.

SSE Endpoint

When you start an HTTP Stream server, SSE is available at /sse:

Client Connection

Connect using SSE from a client:

HTTPS Support

Secure your HTTP transport with SSL/TLS:

SSL Options

Generate Test Certificates

For testing, generate self-signed certificates:
For production, obtain certificates from a trusted CA like Let’s Encrypt.

Stateless Mode

Enable stateless operation for serverless deployments:

Stateless Mode Characteristics

  • No persistent sessions tracked
  • Each request creates a temporary session
  • Reduced memory usage
  • Better scalability
  • Perfect for serverless environments
Stateless mode is only available with HTTP streaming transport. Features that depend on persistent sessions will not be available.

CLI and Environment Variables

Enable stateless mode via CLI or environment:

Transport Comparison

Characteristics:
  • Local connections only
  • Single client
  • No network configuration
  • Fastest for local use
  • IDE integration
Best for:
  • Development tools
  • Desktop applications
  • Local automation
  • Single-user scenarios

Edge Runtime

For edge runtimes like Cloudflare Workers, use EdgeFastMCP:

Edge vs Standard FastMCP

Complete Examples

stdio Example

HTTP Stream Example

HTTPS Example

API Reference

StartOptions Type