Acme-MCP

 view release on metacpan or  search on metacpan

lib/Acme/MCP.pod  view on Meta::CPAN

=pod

=encoding utf-8

=head1 NAME

Acme::MCP - Cheap Model Context Protocol (MCP) Server

=head1 SYNOPSIS

    use Acme::MCP;

    my $mcp = Acme::MCP->new(
        name    => 'MathServer',
        version => '1.0.0'
    );

    # Define a tool for AI agents
    $mcp->add_tool(
        name        => 'add',
        description => 'Adds two numbers',
        schema      => {
            type       => 'object',
            properties => {
                a => { type => 'number' },
                b => { type => 'number' }
            },
            required => ['a', 'b']
        },
        code => sub ($args) {
            return $args->{a} + $args->{b};
        }
    );

    # Start the server (STDIO transport)
    $mcp->run();

=head1 DESCRIPTION

C<Acme::MCP> implements a painfully basic server for the Model Context Protocol (MCP). It allows you to expose your
Perl modules, local data, or internal tools to AI agents (like Claude or custom LLMs) through a standardized JSON-RPC
2.0 interface.

=head1 PUBLIC METHODS

=head2 C<add_tool( %params )>

Registers a new tool that the AI agent can call.

=over

=item C<name>: Unique tool identifier.

=item C<description>: Human-readable explanation of what the tool does.

=item C<schema>: JSON Schema describing the required arguments.

=item C<code>: Coderef executed when the tool is called.

=back

=head2 C<run( )>



( run in 0.560 second using v1.01-cache-2.11-cpan-13bb782fe5a )