MCP::Se...t::Stdio(3)

πŸ“¦
version 0.150.0 Β· 2 versions
, in opensuse-leap 16.0

πŸ’… 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