MCP::Server::Transport::Stdio(3pm)

NAME
MCP::Server::Transport::Stdio - Stdio transport for MCP servers

SYNOPSIS
  use MCP::Server::Transport::Stdio;

  my $stdio = MCP::Server::Transport::Stdio->new;

DESCRIPTION
MCP::Server::Transport::Stdio is a transport for MCP (Model Context Protocol) server that reads requests from standard input (STDIN) and writes responses to standard output (STDOUT). It is designed for command-line tools and debugging tasks.

ATTRIBUTES
MCP::Server::Transport::Stdio inherits all attributes from MCP::Server::Transport.

METHODS
MCP::Server::Transport::Stdio inherits all methods from MCP::Server::Transport and implements the following new ones.

  handle_requests
  $stdio->handle_requests;

Reads requests from standard input and prints responses to standard output.

  notify
  my $bool = $stdio->notify($session_id, $method);
  my $bool = $stdio->notify($session_id, $method, {foo => 'bar'});

Send a JSON-RPC notification to standard output. The $session_id is ignored.

  notify_all
  my $bool = $stdio->notify_all($method);
  my $bool = $stdio->notify_all($method, {foo => 'bar'});

Send a JSON-RPC notification to standard output.

SEE ALSO
MCP, <https://mojolicious.org>, <https://modelcontextprotocol.io>.