Skip to content

Transport Modes

AWS Logs MCP supports two different transport modes for communication between the client and the MCP server. Each mode serves different use cases and deployment scenarios.

Available Transport Modes

1. STDIO Mode

How it works: Communicates through standard input/output streams (stdin/stdout).

Configuration: Activated by: - Running with the --stdio flag: pnpm start -- --stdio - Setting the environment variable: MCP_TRANSPORT=stdio

Implementation: Uses StdioServerTransport from the MCP SDK.

When to use: - Command-line applications and scripts - Direct integration with AI models that support stdio communication - Docker containers that need direct pipe communication - Environments where HTTP isn't feasible or desired - Single-session, embedded usage scenarios

Benefits: - Simple, direct communication with no network overhead - No port configuration required - Suitable for CI/CD pipelines and automation scripts - Works well in restricted environments

2. Streamable HTTP Mode (Default)

How it works: Runs as an HTTP server with endpoints for MCP communication.

Configuration: Default mode when not explicitly using stdio.

Implementation: Uses StreamableHTTPServerTransport from the MCP SDK.

Server endpoints: - /mcp - Main MCP streamable HTTP endpoint - /sse - Legacy endpoint (using streamable HTTP under the hood) - /health - Health check endpoint - /metrics - Metrics reporting

When to use: - Running as a standalone service - Supporting multiple simultaneous clients/sessions - Web-based or networked applications - When you need health monitoring and metrics - Long-running services that need to handle multiple requests

Benefits: - Supports multiple concurrent sessions - Provides monitoring endpoints - Can be accessed over a network - Integrates with existing HTTP infrastructure - Suitable for production deployments

Mode Selection

The transport mode is determined at startup:

// Check if being run directly as a CLI application or if forced via environment variable
const isStdioMode = process.argv.includes('--stdio') || process.env.MCP_TRANSPORT === 'stdio';

If running in stdio mode, the server doesn't start an HTTP server, making it lightweight for embedded use cases.

Example Usage

Using STDIO Mode

# Using command line flag
pnpm start -- --stdio

# Using environment variable
MCP_TRANSPORT=stdio pnpm start

Using HTTP Mode (Default)

# Start server in HTTP mode (default)
pnpm start

# The server will be available at:
# - http://localhost:3000/mcp (primary endpoint)
# - http://localhost:3000/sse (legacy endpoint)

Implementation Details

Both transport modes use the same underlying MCP server with the same tool implementations. The only difference is how clients communicate with the server:

  • STDIO Mode: Direct pipe-based communication using standard input/output
  • HTTP Mode: Network-based communication using HTTP protocol with streaming support

This flexibility allows the AWS Logs MCP to be deployed in various environments while maintaining the same functionality.