table of contents
| MCP::Server::Legacy(3) | User Contributed Perl Documentation | MCP::Server::Legacy(3) |
NAME¶
MCP::Server::Legacy - Fallback for clients speaking a previous protocol version
SYNOPSIS¶
use MCP::Server::Legacy qw(legacy_request);
my $version = legacy_request('2025-11-25', {jsonrpc => '2.0', id => 1, method => 'tools/call'});
DESCRIPTION¶
MCP::Server::Legacy answers the "initialize" handshake of clients speaking a protocol revision older than "PROTOCOL_VERSION" in MCP::Constants, so they can still list and call tools, prompts and resources while the ecosystem catches up. Nothing beyond that is supported, in particular no notifications and no multi round-trip requests. It is a temporary convenience and will be removed again in a future release.
FUNCTIONS¶
MCP::Server::Legacy implements the following functions, which can be imported individually.
legacy_context¶
my $context = legacy_context($params, $context);
Populate an MCP::Server::Context with the values a current request would have carried in "_meta".
legacy_request¶
my $version = legacy_request($version, $request);
The protocol revision a request was made with, or "undef" if it is not legacy, based on the "MCP-Protocol-Version" header and the JSON-RPC request. A request carrying "_meta.io.modelcontextprotocol/protocolVersion" is never legacy, whatever the header says, so a current client with a misconfigured header still gets a proper error. Revisions before "2025-06-18" predate the header, so a request without one is assumed to be legacy.
legacy_result¶
my $result = legacy_result($server, $method, $version);
The result for a "initialize" or "ping" request, or "undef" for every other method. The handshake echoes the requested protocol revision and advertises the same primitives as "server/discover", but never "listChanged", since list change notifications are not supported.
SEE ALSO¶
MCP, <https://mojolicious.org>, <https://modelcontextprotocol.io>.
| 2026-07-31 | perl v5.44.0 |