StreamableHTTP

NAME

MCP::Transport::StreamableHTTP - Streamable HTTP transport implementation

DESCRIPTION

Implements the MCP Streamable HTTP transport using Cro::HTTP. Supports client-side POST/GET with SSE, and server-side handling of POST requests plus optional server-initiated SSE streams.

CLASSES

StreamableHTTPServerTransport

Server-side transport that listens on an HTTP endpoint and dispatches JSON-RPC messages received via POST. Supports session management and SSE streaming for server-initiated messages.

my $transport = StreamableHTTPServerTransport.new(
        host => 'localhost', port => 8080, path => '/mcp');

Attributes:

  • host — Bind address (default: localhost).

  • port — Bind port (default: 8080).

  • path — URL path for the MCP endpoint (default: /mcp).

StreamableHTTPClientTransport

Client-side transport that connects to an MCP HTTP server. Sends JSON-RPC messages via POST and receives responses and server-initiated messages via SSE.

my $transport = StreamableHTTPClientTransport.new(
        url => 'http://localhost:8080/mcp');

Attributes:

  • url — Server endpoint URL.

  • headers — Optional additional HTTP headers (e.g., for authentication).

Key methods:

  • terminate-session(-- Promise)> — Send DELETE to terminate the session.

MCP v0.33.6

Model Context Protocol SDK for Raku - Build MCP servers and clients

Authors

  • Waclaw Kusnierczyk

License

MIT

Dependencies

JSON::FastCro::HTTPMIME::Base64

Provides

  • MCP
  • MCP::Client
  • MCP::JSONRPC
  • MCP::OAuth
  • MCP::OAuth::Client
  • MCP::OAuth::Server
  • MCP::Server
  • MCP::Server::Prompt
  • MCP::Server::Resource
  • MCP::Server::Tool
  • MCP::Transport::Base
  • MCP::Transport::SSE
  • MCP::Transport::Stdio
  • MCP::Transport::StreamableHTTP
  • MCP::Types

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.