Skip to main content

Transport Overview

Transports handle the communication between MCP clients and your server. scala-mcp-sdk provides two transport options.

Available Transports

TransportUse CaseClient Examples
StdioCLI tools, local processesClaude Desktop, VS Code extensions
Streamable HTTPWeb services, remote accessWeb apps, multi-client scenarios

Choosing a Transport

Use Stdio When

  • Building a CLI tool or local integration
  • The client spawns your server as a subprocess
  • You want the simplest deployment (single binary)
  • Single client per server instance

Use Streamable HTTP When

  • Deploying as a web service
  • Multiple clients need to connect
  • You need bidirectional streaming
  • Integration with existing HTTP infrastructure

Transport Architecture

Both transports implement the same Transport[F] trait:

trait Transport[F[_]] {
def run(handler: RequestHandler[F]): Resource[F, Unit]
}

This means your McpServer works identically with either transport. You only change the transport layer, not your business logic.

Feature Differences

FeatureStdioStreamable HTTP
Multi-clientNo (1 client per process)Yes
Bidirectional streamingN/AYes
Session managementImplicitExplicit
Resource subscriptionsLimitedFull support
DeploymentBinary/scriptHTTP server

Next Steps