1. Go to this page and download the library: Download tinywan/webman-mcp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tinywan / webman-mcp example snippets
declare(strict_types=1);
namespace app\mcp;
use Tinywan\Mcp\Contracts\ToolInterface;
use Tinywan\Mcp\Runtime\ExecutionContext;
use Tinywan\Mcp\Tool\Content\TextContent;
use Tinywan\Mcp\Tool\ToolCall;
use Tinywan\Mcp\Tool\ToolDefinition;
use Tinywan\Mcp\Tool\ToolResult;
final class CalculatorTool implements ToolInterface
{
public function definition(): ToolDefinition
{
return new ToolDefinition(
'calculate',
'Add two numbers.',
[
'type' => 'object',
'properties' => [
'left' => ['type' => 'number'],
'right' => ['type' => 'number'],
],
'
declare(strict_types=1);
namespace app\mcp;
use Tinywan\Mcp\Registry\RegisteredTool;
use Tinywan\Mcp\Registry\ServerDefinition;
use Tinywan\Mcp\Registry\ServerIdentity;
use Tinywan\Mcp\Security\AllowAllAuthorizer;
use Tinywan\Mcp\Security\AllowAnonymousAuthenticator;
final class CalculatorServer
{
public static function definition(): ServerDefinition
{
$tool = new CalculatorTool();
return new ServerDefinition(
'calculator',
'/mcp/calculator',
new ServerIdentity('Calculator', '1.0.0'),
[new RegisteredTool($tool->definition(), CalculatorTool::class)],
new AllowAnonymousAuthenticator(),
new AllowAllAuthorizer(),
);
}
}
declare(strict_types=1);
use app\mcp\CalculatorServer;
return [
'servers' => [CalculatorServer::definition()],
];
use app\neuron\WebmanMcpTransport;
use NeuronAI\MCP\McpClient;
$client = new McpClient([
'transport' => new WebmanMcpTransport(
'http://127.0.0.1:8787/mcp/calculator',
),
]);
$response = $client->callTool('calculate', [
'left' => 6,
'right' => 7,
]);
$value = $response['result']['structuredContent']['value'];