Transport

The communication layer that handles message exchange between MCP clients and servers, supporting stdio and HTTP protocols with JSON-RPC formatting.

Transport

The transport layer handles the actual communication between MCP clients and servers. All transports use JSON-RPC 2.0 to exchange messages, providing a standardized way to connect different applications regardless of their implementation language.

Transport Types

Transport Use Case Characteristics
Stdio Local processes Uses standard input/output, ideal for same-machine communication
HTTP Remote connections Uses HTTP POST with optional Server-Sent Events for streaming

Message Format

All transports use JSON-RPC 2.0 with four message types:

// Request (expects response)
{
  "jsonrpc": "2.0",
  "method": "tools/list", 
  "id": 1
}

// Result (successful response)
{
  "jsonrpc": "2.0",
  "result": { "tools": [...] },
  "id": 1
}

// Error (failed response)  
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32601,
    "message": "Method not found"
  },
  "id": 1
}

// Notification (one-way message)
{
  "jsonrpc": "2.0", 
  "method": "notifications/initialized"
}

Connection Lifecycle

  1. Initialization - Client sends initialize request
  2. Capability Exchange - Server responds with supported features
  3. Acknowledgment - Client sends initialized notification
  4. Message Exchange - Normal request/response flow begins
  5. Termination - Clean shutdown or error conditions

Transport Selection

  • Local Communication - Use stdio for efficiency and simple process management
  • Remote Communication - Use HTTP for network compatibility and security features

Related Terms

  • MCP Client
  • MCP Server
  • Host
© 2025 👨‍💻 with ❤️ by Full Stack Craft
"Any sufficiently advanced technology is indistinguishable from magic."