MCP.Transport.StreamableHTTP.Client (MCP Elixir SDK v1.1.0)

Copy Markdown View Source

Streamable HTTP client transport for MCP.

Sends JSON-RPC messages via HTTP POST and receives responses as either application/json or text/event-stream (SSE). Optionally opens a GET SSE stream for server-initiated messages.

Options

  • :owner (required) — pid to receive {:mcp_message, map} and {:mcp_transport_closed, reason} messages
  • :url (required) — the MCP endpoint URL (e.g., "http://localhost:8080/mcp")
  • :headers — extra HTTP headers to include on all requests
  • :protocol_version — MCP protocol version (default: "2025-11-25")

Session Management

The client automatically extracts the MCP-Session-Id header from the server's initialize response and includes it in all subsequent requests. On close, it sends an HTTP DELETE to terminate the session.

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.