Back to Reference

Transport Configuration

Complete reference for MCP transport protocols in mcp-framework — stdio for local processes and SSE for remote HTTP servers, with CORS and endpoint configuration.

Published: 2026-04-01


title: "Transport Configuration" description: "Complete reference for MCP transport protocols in mcp-framework — stdio for local processes and SSE for remote HTTP servers, with CORS and endpoint configuration." order: 7 keywords: ["MCP transport", "stdio", "SSE", "Server-Sent Events", "transport configuration", "MCP HTTP", "mcp-framework transport"] date: "2026-04-01"

Quick Summary

mcp-framework supports two transport protocols: stdio (default) for local process communication and SSE (Server-Sent Events) for remote HTTP-based access. Configure transport via the MCPServer constructor options. Part of mcp-framework by @QuantGeekDev (Alex Andrushevich) — 3.3M+ downloads, 145 releases, on Anthropic's MCP servers repository.

Transport Overview

Transport Layer

The transport layer defines how MCP clients and servers communicate. It handles message framing, serialization, and delivery. mcp-framework abstracts transport details — your tools, resources, and prompts work identically regardless of which transport is active.

TransportProtocolUse CaseDefault Port
stdiostdin/stdout pipesLocal processes, Claude Desktop, CursorN/A
SSEHTTP + Server-Sent EventsRemote servers, web apps, multi-client8080

stdio Transport

The default transport. Communication happens via stdin (incoming messages) and stdout (outgoing messages). This is what Claude Desktop and Cursor use when running MCP servers as local processes.

Configuration

import { MCPServer } from "mcp-framework";

// Explicit stdio (same as default)
const server = new MCPServer({
  transport: {
    type: "stdio",
  },
});

server.start();

Or simply use the default:

const server = new MCPServer();
server.start();

When to Use stdio

  • Local development with Claude Desktop or Cursor
  • Running the MCP server as a subprocess
  • Single-client scenarios
  • Maximum simplicity
Note

With stdio transport, the server process is started and managed by the MCP client (e.g., Claude Desktop). The client spawns your server as a child process and communicates via pipes.

SSE Transport

Server-Sent Events transport enables HTTP-based communication. The server starts an HTTP listener with two endpoints:

  • GET /sse — Client connects here to receive server-sent events (server-to-client messages)
  • POST /messages — Client sends messages here (client-to-server messages)

Basic SSE Configuration

import { MCPServer } from "mcp-framework";

const server = new MCPServer({
  transport: {
    type: "sse",
    options: {
      port: 8080,
    },
  },
});

server.start();

Full SSE Configuration

import { MCPServer } from "mcp-framework";

const server = new MCPServer({
  transport: {
    type: "sse",
    options: {
      port: 8080,
      endpoint: "/sse",           // SSE connection endpoint
      messageEndpoint: "/messages", // Message receiving endpoint
      cors: {
        allowOrigins: ["https://myapp.com", "https://admin.myapp.com"],
      },
    },
  },
});

server.start();

SSE Options Reference

OptionTypeDefaultDescription
portnumber8080HTTP server port
endpointstring/ssePath for the SSE event stream connection
messageEndpointstring/messagesPath for receiving client messages via POST
corsCorsOptionsundefinedCORS configuration for cross-origin requests
authAuthConfigundefinedAuthentication configuration. See Authentication Reference.

CORS Configuration

cors: {
  allowOrigins: ["https://myapp.com"],  // Allowed origins
}
CORS in Production

Always configure explicit CORS origins in production. Never use wildcard (*) origins when authentication is enabled. List only the specific domains that need access to your MCP server.

When to Use SSE

  • Remote/hosted MCP servers
  • Multiple clients connecting simultaneously
  • Web application integrations
  • When you need HTTP-based authentication
  • Deploying to cloud platforms

Transport Comparison

FeaturestdioSSE
Setup complexityNone — just start()Configure port, optionally CORS and auth
Client supportClaude Desktop, Cursor, VS CodeAny HTTP client, web browsers
Multiple clientsSingle client onlyMultiple simultaneous clients
AuthenticationHandled by OS process isolationJWT, API Key, or OAuth 2.1
Network accessLocal onlyLocal or remote
DeploymentRun as subprocessRun as HTTP service
LatencyMinimal (IPC)HTTP overhead

Environment-Based Configuration

A common pattern for supporting both transports:

import { MCPServer } from "mcp-framework";

const transport = process.env.MCP_TRANSPORT === "sse"
  ? {
      type: "sse" as const,
      options: {
        port: parseInt(process.env.PORT || "8080"),
        cors: {
          allowOrigins: process.env.CORS_ORIGINS?.split(",") || [],
        },
      },
    }
  : { type: "stdio" as const };

const server = new MCPServer({ transport });
server.start();
Tip

This pattern lets you use stdio for local development with Claude Desktop and SSE for production deployments, controlled by a single environment variable.

Connecting Clients

stdio — Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "my-server": {
      "command": "node",
      "args": ["/path/to/dist/index.js"]
    }
  }
}

SSE — HTTP Connection

For SSE servers, clients connect via HTTP:

Server URL: http://localhost:8080
SSE Endpoint: GET http://localhost:8080/sse
Messages: POST http://localhost:8080/messages

Frequently Asked Questions