NAME

Net::Async::MCP::Transport::InProcess - In-process MCP transport via direct MCP::Server calls

VERSION

version 0.001

SYNOPSIS

# Usually created automatically by Net::Async::MCP
use Net::Async::MCP;

my $mcp = Net::Async::MCP->new(server => $my_mcp_server);
$loop->add($mcp);

# Or construct directly for testing:
use Net::Async::MCP::Transport::InProcess;

my $transport = Net::Async::MCP::Transport::InProcess->new(
    server => $my_mcp_server,
);

DESCRIPTION

Net::Async::MCP::Transport::InProcess provides direct in-process communication with an MCP::Server instance. It calls handle() directly on the server object, making it the most efficient transport for Perl-based MCP servers running in the same process.

If a tool returns a Mojo::Promise (from an async MCP server implementation), the promise is resolved synchronously via wait(). For fully non-blocking async tools, use Net::Async::MCP::Transport::Stdio with a separate subprocess instead.

This transport is selected automatically by Net::Async::MCP when constructed with a server argument.

new

my $transport = Net::Async::MCP::Transport::InProcess->new(
    server => $mcp_server,
);

Constructs a new in-process transport. Requires a server argument which must be an MCP::Server instance (or any object with a handle method that accepts a JSON-RPC request hashref).

send_request

my $future = $transport->send_request($method, \%params);

Sends a JSON-RPC request to the MCP server by calling handle() directly. Returns a Future that resolves to the result value from the response, or fails with an error message if the server returns a JSON-RPC error.

send_notification

my $future = $transport->send_notification($method, \%params);

Sends a JSON-RPC notification (a request with no id, expecting no response) directly to the server via handle(). Returns an immediately resolved Future.

close

my $future = $transport->close;

No-op for the in-process transport since there is no external process or connection to close. Returns an immediately resolved Future.

SEE ALSO

SUPPORT

Issues

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

CONTRIBUTING

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

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

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