MCP::Se...t::Stdio(3)
π MCP::Server::Transport::Stdio β the stdio transport for MCP servers
okay so bestie, you're reading the User Contributed Perl Documentation for MCP::Server::Transport::Stdio and honestly? it's giving main character transport energy. let's get into it β¨
πΈ NAME πΈ
MCP::Server::Transport::Stdio β the stdio transport for MCP servers, periodt.
π SYNOPSIS π
like, literally just do this:
use MCP::Server::Transport::Stdio;
my $stdio = MCP::Server::Transport::Stdio->new;
slay. that's it. that's the whole setup π«Ά
π¦ DESCRIPTION π¦
MCP::Server::Transport::Stdio is a transport for an MCP (Model Context Protocol) server, and what it does is: it reads requests from standard input (STDIN) and writes responses to standard output (STDOUT). she's built for command-line tools and debugging tasks, iykyk π
here's the tea tho, and you need to hear it: all messages share the one channel. so when a "subscriptions/listen" request comes in, it gets answered with an acknowledgement notification and then it's justβ¦ left open π like the JSON-RPC response is withheld until the client cancels it. no cap.
requests are processed strictly in order, which means a "notifications/cancelled" notification cannot be read while the request it refers to is still in flight. so it can only cancel a subscription, that's it, that's all she can do π
bestie if you need cancellations to actually work on a running tool, use MCP::Server::Transport::HTTP instead β for workloads where cancelling a running tool matters, that's the one. don't fight the stdio girl about it π
β ATTRIBUTES β
MCP::Server::Transport::Stdio inherits all attributes from MCP::Server::Transport (she's a nepo baby but make it valid) and implements the following new ones π
π subscriptions
my $subscriptions = $stdio->subscriptions;
$stdio = $stdio->subscriptions({});
this is the registry of active MCP::Server::Subscription objects, keyed by the id of the request that opened them. think of it as the group chat member list but for subscriptions π
π₯ METHODS π₯
MCP::Server::Transport::Stdio inherits all methods from MCP::Server::Transport and implements the following new ones β she's an overachiever, we love her for it π
π handle_requests
$stdio->handle_requests;
reads requests from standard input and prints responses to standard output. literally what it says on the tin, iconic behaviour honestly β¨
π§ notify_all
my $bool = $stdio->notify_all($method);
my $bool = $stdio->notify_all($method, {foo => 'bar'});
sends a JSON-RPC notification to standard output β once for every subscription in "subscriptions" that asked for it. so if three of your subscriptions asked, three notifications go out. fair's fair π
π SEE ALSO π
go read them, they ate π«Ά
aaaand that's the page bestie! π this whole thing is running on perl v5.42.0, dated 2026-07-31, and it's the MCP::Se...t::Stdio(3) page β so yes, the footer said the same thing twice, we stan a consistent queen πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-MCP 0.150.0-bp160.1.1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms