-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Copy link
Labels
BugSomething isn't workingSomething isn't working
Description
Describe the bug
I'm trying to implement the most basic mcp server, but the tools list is empty.
To Reproduce
<?php
require __DIR__ . '/../vendor/autoload.php';
use Mcp\Server;
use Mcp\Server\Transport\StdioTransport;
use Psr\Log\NullLogger;
Server::make()
->withLogger(new NullLogger())
->withServerInfo('Stdio Calculator', '1.1.0', 'Basic Calculator over STDIO transport.')
->withTool(function (float $a, float $b, string $operation = 'add'): float {
return match ($operation) {
'add' => $a + $b,
'subtract' => $a - $b,
'multiply' => $a * $b,
'divide' => $a / $b,
default => throw new InvalidArgumentException('Invalid operation'),
};
}, name: 'calculator', description: 'Perform basic math operations (add, subtract, multiply, divide)')
->build()
->connect(new StdioTransport());npx @modelcontextprotocol/inspector php calc.php
Expected behavior
There should be calculator tool in the list.
Metadata
Metadata
Assignees
Labels
BugSomething isn't workingSomething isn't working