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( )>
Starts the server loop. Listens for JSON-RPC requests on C<STDIN> and writes responses to C<STDOUT>. This transport is
compatible with standard MCP hosts.
=head1 AUTHOR
Sanko Robinson E<lt>sanko@cpan.orgE<gt>
=head1 COPYRIGHT
Copyright (C) 2026 by Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.
=cut
( run in 1.556 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )