NAME
Net::Async::MCP::Transport::HTTP - Streamable HTTP MCP transport via Net::Async::HTTP
VERSION
version 0.002
SYNOPSIS
# Usually created automatically by Net::Async::MCP
use IO::Async::Loop;
use Net::Async::MCP;
my $loop = IO::Async::Loop->new;
my $mcp = Net::Async::MCP->new(
url => 'https://example.com/mcp',
);
$loop->add($mcp);
DESCRIPTION
Net::Async::MCP::Transport::HTTP communicates with a remote MCP server over HTTP using the Streamable HTTP transport defined in the MCP specification (2025-11-25). Requests are sent as HTTP POST with JSON-RPC bodies, and responses may arrive as either application/json or text/event-stream (Server-Sent Events).
Session management is handled automatically via the Mcp-Session-Id header. If the server assigns a session ID during initialization, it is included in all subsequent requests.
This transport is selected automatically by Net::Async::MCP when constructed with a url argument.
send_request
my $future = $transport->send_request($method, \%params);
Sends a JSON-RPC request as an HTTP POST to the MCP endpoint. The request includes Accept: application/json, text/event-stream to support both direct JSON responses and SSE streams.
Returns a Future that resolves to the result value from the JSON-RPC response. Handles both application/json and text/event-stream response content types.
If the server returns HTTP 404, this indicates an expired session. The future will fail with an appropriate error message.
send_notification
my $future = $transport->send_notification($method, \%params);
Sends a JSON-RPC notification (no id field, no response expected) as an HTTP POST. The server typically responds with HTTP 202 Accepted. Returns an immediately resolved Future once the HTTP request completes.
close
my $future = $transport->close;
Terminates the MCP session by sending an HTTP DELETE request to the MCP endpoint with the Mcp-Session-Id header. If no session is active, returns an immediately resolved Future.
SEE ALSO
Net::Async::MCP - Main client module that uses this transport
Net::Async::MCP::Transport::InProcess - Alternative transport for in-process Perl servers
Net::Async::MCP::Transport::Stdio - Alternative transport for external subprocesses
Net::Async::HTTP - HTTP client used internally
https://modelcontextprotocol.io/specification/2025-11-25/basic/transports - MCP Streamable HTTP transport specification
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-mcp/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de> https://raudss.us/
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.