Skip to content

Add Streamable HTTP transport support (MCP spec 2025-11-25) #33

@alexei-led

Description

@alexei-led

Summary

MCP spec revision 2025-11-25 replaced the HTTP+SSE transport with Streamable HTTP. Our server currently supports stdio and sse transports — sse is now legacy (spec 2024-11-05).

Spec Reference

Current State

File: src/aws_mcp_server/__main__.py (lines 37-49)
File: src/aws_mcp_server/config.py (line 22)

# config.py
TRANSPORT = os.environ.get("AWS_MCP_TRANSPORT", "stdio")

# __main__.py  
if TRANSPORT not in ("stdio", "sse"):
    logger.error(f"Invalid transport protocol: {TRANSPORT}. Must be 'stdio' or 'sse'")
    sys.exit(1)
# ...
mcp.run(transport=TRANSPORT)

Required Changes

  1. Add streamable-http as a valid transport — update validation in __main__.py to accept "stdio", "sse", and "streamable-http"
  2. Make streamable-http the recommended HTTP transport — update README/docs to recommend streamable-http over sse
  3. Deprecate sse transport — add deprecation warning when sse is selected, suggest migration to streamable-http
  4. Update config.py — add streamable-http to the docstring for AWS_MCP_TRANSPORT
  5. Verify FastMCP supportfastmcp>=2.13.0 should support streamable-http natively via mcp.run(transport="streamable-http"). Confirm and bump minimum version if needed.

Streamable HTTP Key Requirements (from spec)

  • Server provides a single HTTP endpoint supporting POST and GET
  • POST for client→server JSON-RPC messages
  • GET for server→client SSE stream (optional, for notifications)
  • Must validate Origin header (return 403 for invalid)
  • Bind to 127.0.0.1 locally (already handled for SSE via is_docker_environment())
  • Session management via Mcp-Session-Id header

Migration Notes

The sse transport should remain functional for backward compatibility but emit a deprecation warning. Example:

if TRANSPORT == "sse":
    logger.warning(
        "SSE transport is deprecated per MCP spec 2025-11-25. "
        "Use 'streamable-http' instead. Set AWS_MCP_TRANSPORT=streamable-http"
    )

Testing

  • Verify streamable-http transport starts correctly
  • Verify SSE still works with deprecation warning
  • Test Docker environment binding (0.0.0.0 vs 127.0.0.1)
  • Integration test with MCP client (e.g., Claude Desktop)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions