Complete MCP Protocol Support
Full implementation of the Model Context Protocol specification with type-safe PHP 8.1+ features
Build intelligent AI agents and applications with seamless integration between LLMs and external data sources
Get up and running with PHP MCP SDK in minutes:
composer require dalehurley/php-mcp-sdk
#!/usr/bin/env php
<?php
require_once __DIR__ . '/vendor/autoload.php';
use MCP\Server\McpServer;
use MCP\Server\Transport\StdioServerTransport;
use MCP\Types\Implementation;
use function Amp\async;
// Create the simplest possible MCP server
$server = new McpServer(
new Implementation('hello-world-server', '1.0.0')
);
// Add a simple "say_hello" tool
$server->tool(
'say_hello',
'Says hello to someone',
[
'type' => 'object',
'properties' => [
'name' => [
'type' => 'string',
'description' => 'Name of the person to greet'
]
],
'required' => ['name']
],
function (array $args): array {
$name = $args['name'] ?? 'World';
return [
'content' => [
[
'type' => 'text',
'text' => "Hello, {$name}! 👋 Welcome to MCP!"
]
]
];
}
);
// Start the server
async(function () use ($server) {
echo "🚀 Hello World MCP Server starting...\n";
$transport = new StdioServerTransport();
$server->connect($transport)->await();
})->await();
Add to your Claude Desktop configuration:
{
"mcpServers": {
"hello-world": {
"command": "php",
"args": ["/path/to/your/hello-world-server.php"]
}
}
}
20+ working examples from simple "Hello World" to complex real-world applications like Blog CMS, Task Manager, and API Gateway.
Seamless integration with Laravel, Symfony, and other PHP frameworks through PSR-compliant design.
Built specifically for creating intelligent AI agents with multi-agent coordination and tool orchestration.
Production-ready features including Docker deployment, microservices architecture, monitoring, and observability.
The most comprehensive MCP SDK documentation in the ecosystem with tested examples and migration guides.
Complete API orchestration system with authentication, rate limiting, and monitoring
View Example →Multi-agent system with specialized agents for different tasks and coordination
View Example →