NAME

Claude::Agent::MCP - MCP (Model Context Protocol) server integration

SYNOPSIS

use Claude::Agent qw(tool create_sdk_mcp_server);
use Claude::Agent::Options;

# Create a custom tool
my $calculator = tool(
    'calculate',
    'Perform mathematical calculations',
    {
        type => 'object',
        properties => {
            expression => { type => 'string' }
        },
        required => ['expression'],
    },
    sub {
        my ($args) = @_;
        my $result = eval $args->{expression};
        return {
            content => [{ type => 'text', text => "Result: $result" }]
        };
    }
);

# Create an SDK MCP server
my $server = create_sdk_mcp_server(
    name    => 'math',
    tools   => [$calculator],
    version => '1.0.0',
);

# Use in options
my $options = Claude::Agent::Options->new(
    mcp_servers   => { math => $server },
    allowed_tools => ['mcp__math__calculate'],
);

DESCRIPTION

This module provides MCP (Model Context Protocol) server integration for the Claude Agent SDK, allowing you to create custom tools that Claude can use.

MCP SERVER TYPES

  • sdk - In-process server running within your application

  • stdio - External process communicating via stdin/stdout

  • sse - Remote server using Server-Sent Events

  • http - Remote server using HTTP

MCP CLASSES

AUTHOR

LNATION, <email at lnation.org>

LICENSE

This software is Copyright (c) 2026 by LNATION.

This is free software, licensed under The Artistic License 2.0 (GPL Compatible).