Beginner LevelAI, LLMs, Embeddings & MCP
What is the difference between Stdio and SSE Transports in Model Context Protocol (MCP)?
❓ Interview Prompt: Compare Stdio process streams vs Server-Sent Events (SSE) HTTP transport in MCP architecture.
The Model Context Protocol (MCP) supports two official Transport Layers for JSON-RPC communication:
1. Stdio Transport (StdioServerTransport):
•
Communicates via standard input/output streams (
stdin/stdout) of child CLI processes.•
Use Case: Local development tools, IDE extensions, local filesystem MCP servers spawned directly by a host client (e.g. Cursor or Claude Desktop).
2. SSE Transport (SSEServerTransport):
•
Communicates over HTTP using Server-Sent Events (SSE) for server-to-client messages and HTTP POST for client-to-server messages.
•
Use Case: Remote, cloud-hosted MCP servers shared across network environments.
Code Implementation Example
typescript
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new Server({ name: 'my-local-mcp', version: '1.0.0' }, { capabilities: { tools: {} } });
// Connect server via Stdio transport (local CLI process)
const transport = new StdioServerTransport();
await server.connect(transport);💡Connecting local MCP server using StdioServerTransport.
🎯 Interview Key Takeaway
Stdio connects local subprocess MCP servers via stdin/stdout; SSE connects remote cloud-hosted MCP servers over HTTP.
#MCP#Stdio#SSE#Transport#Beginner
Back to all AI, LLMs, Embeddings & MCP Questions→