ConduitMcp.Transport.StreamableHTTP (ConduitMCP v0.9.0)

Copy Markdown View Source

Streamable HTTP transport for MCP (recommended).

Provides a single POST endpoint for bidirectional communication. This is the modern replacement for SSE transport.

Options

  • :server_module (required) - The MCP server module to route requests to
  • :cors_origin - CORS allow-origin header (default: "*")
  • :cors_methods - CORS allow-methods header (default: "GET, POST, OPTIONS")
  • :cors_headers - CORS allow-headers header (default: "content-type, authorization")
  • :auth - Authentication plug configuration (optional)

Example

{Bandit,
 plug: {ConduitMcp.Transport.StreamableHTTP,
        server_module: MyApp.MCPServer,
        cors_origin: "https://myapp.com",
        cors_methods: "POST, OPTIONS",
        cors_headers: "content-type"},
 port: 4001}

With Authentication

{Bandit,
 plug: {ConduitMcp.Transport.StreamableHTTP,
        server_module: MyApp.MCPServer,
        auth: [
          enabled: true,
          strategy: :bearer_token,
          token: "my-secret-token"
        ]},
 port: 4001}

Or with custom verification:

{Bandit,
 plug: {ConduitMcp.Transport.StreamableHTTP,
        server_module: MyApp.MCPServer,
        auth: [
          strategy: :function,
          verify: &MyApp.Auth.verify_token/1
        ]},
 port: 4001}

Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Functions

call(conn, opts)

Callback implementation for Plug.call/2.

init(opts)

Callback implementation for Plug.init/1.