NAME

Net::Async::MCP::Server::Transport::Stdio - Stdio transport for Net::Async::MCP::Server

VERSION

version 0.001

SYNOPSIS

use Net::Async::MCP::Server::Transport::Stdio;

my $transport = Net::Async::MCP::Server::Transport::Stdio->new(
    server => $server,
);
$transport->handle_requests;

DESCRIPTION

Stdio transport for MCP server using newline-delimited JSON-RPC over stdin/stdout.

Each line is a JSON-RPC 2.0 message. Requests are read from stdin, responses written to stdout.

This transport is suitable for MCP clients that communicate via standard input/output, such as command-line AI tools.

PROTOCOL

Each JSON-RPC message is a single line terminated by a newline character. Request format:

{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}

Response format:

{"jsonrpc": "2.0", "id": 1, "result": {...}}

Error format:

{"jsonrpc": "2.0", "id": 1, "error": {"code": -32600, "message": "Invalid Request"}}

server

my $server = $transport->server;

Returns the associated MCP server instance.

handle_requests

$transport->handle_requests;

Enters the main loop, reading JSON-RPC requests from stdin and writing responses to stdout. This method blocks until stdin is closed or an error occurs.

SEE ALSO

Net::Async::MCP::Server, IO::Async::Notifier.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-net-async-mcp-server/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.