Skip to main content

Transport Overview

MCP Framework supports multiple transport mechanisms for communication between the client and server. Each transport type has its own characteristics, advantages, and use cases.

Available Transports

The framework currently supports the following transport types:

  • STDIO Transport: The default transport that uses standard input/output streams
  • HTTP Stream Transport: Streamable HTTP transport that implements the MCP 2025-03-26 specification
  • SSE Transport: ⚠️ DEPRECATED - Server-Sent Events based transport that has been replaced by HTTP Stream Transport

Comparison

FeatureSTDIO TransportHTTP Stream TransportSSE Transport (Deprecated)
ProtocolStandard I/O streamsHTTP/SSEHTTP/SSE
ConnectionDirect process communicationNetwork-basedNetwork-based
AuthenticationNot applicableSupports JWT and API KeySupports JWT and API Key
Session ManagementNot applicableBuilt-inLimited
ResumabilityNot applicableSupportedNo
Use CaseCLI tools, local integrationsWeb applications, distributed systemsLegacy systems
ConfigurationMinimalHighly configurableConfigurable
ScalabilitySingle processMultiple clientsMultiple clients
MCP SpecificationCompliant2025-03-26 compliantLegacy (2024-11-05)

Choosing a Transport

Choose your transport based on your application's needs:

  • Use STDIO Transport when:

    • Building CLI tools
    • Need direct process communication
    • Working with local integrations
    • Want minimal configuration
  • Use HTTP Stream Transport when:

    • Building web applications
    • Need network-based communication
    • Require authentication or session management
    • Want to support multiple clients
    • Need resumable connections
    • Need to scale horizontally
    • Require compliance with latest MCP specification
  • Use SSE Transport only for:

    • Legacy applications that depend on the older transport

Configuration

STDIO Transport (Default)

const server = new MCPServer();
// or explicitly:
const server = new MCPServer({
transport: { type: "stdio" }
});

HTTP Stream Transport

const server = new MCPServer({
transport: {
type: "http-stream",
options: {
port: 8080, // Optional (default: 8080)
endpoint: "/mcp", // Optional (default: "/mcp")
responseMode: "batch", // Optional (default: "batch")
cors: {
allowOrigin: "*" // Optional CORS configuration
},
auth: {
// Optional authentication configuration
}
}
}
});

SSE Transport (Deprecated)

const server = new MCPServer({
transport: {
type: "sse",
options: {
port: 8080, // Optional (default: 8080)
endpoint: "/sse", // Optional (default: "/sse")
messageEndpoint: "/messages", // Optional (default: "/messages")
auth: {
// Optional authentication configuration
}
}
}
});

For detailed information about each transport type, see: