Complete MCP Protocol Support
Full implementation of the Model Context Protocol specification with type-safe PHP 8.1+ features. Tools, resources, prompts, and sampling โ all covered.
The most complete Model Context Protocol implementation for PHP. Connect LLMs to your data, APIs, and tools with a production-ready async SDK.
Get up and running 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;
$server = new McpServer(
new Implementation('hello-world-server', '1.0.0')
);
$server->tool(
'say_hello',
'Says hello to someone',
[
'type' => 'object',
'properties' => [
'name' => ['type' => 'string', 'description' => 'Name to greet']
],
'required' => ['name']
],
function (array $args): array {
return [
'content' => [['type' => 'text', 'text' => "Hello, {$args['name']}!"]]
];
}
);
async(function () use ($server) {
$transport = new StdioServerTransport();
$server->connect($transport)->await();
})->await();Add to your claude_desktop_config.json:
{
"mcpServers": {
"hello-world": {
"command": "php",
"args": ["/path/to/your/server.php"]
}
}
}Explore PHP MCP SDK without any local setup:
Run PHP code instantly in your browser with 3v4l.org โ no installation needed.
Open PHP Sandbox โVisually test and debug your MCP server using the official MCP Inspector tool.
MCP Inspector โA complete, runnable Hello World example to copy, paste, and start customising.
View Example โWhat are developers building with PHP MCP SDK?
Connect Claude, GPT-4, or any LLM to your PHP application data โ databases, APIs, CMS content โ and let AI answer questions in real time.
Give AI agents read access to your ERP, CRM, or analytics platform so non-technical users can query complex data with natural language.
Build MCP servers that expose code analysis, CI/CD pipelines, and deployment tools directly into AI coding assistants like Claude Code.
Automate complex multi-step workflows with AI orchestration across microservices โ approvals, notifications, data transformation, and more.
Let AI agents interact with your product catalog, inventory, and order systems to assist customers and automate merchandising tasks.
Build AI-assisted CMS tools that can draft, edit, categorise, and publish content while accessing your full content library as context.
PHP MCP SDK is designed for production workloads:
Built on Amphp โ PHP's battle-tested async framework. Handle multiple concurrent MCP sessions without the overhead of multi-threading.
No blocking calls ยท Event-loop driven ยท Coroutine-basedHTTP Streaming uses chunked transfer for low-latency, memory-efficient message delivery. STDIO transport has near-zero overhead for local use.
Chunked streaming ยท Connection pooling ยท Keep-alive supportResources are streamed and never fully loaded into memory. Large file and database operations stay lean regardless of dataset size.
Lazy loading ยท Generator-based streaming ยท Configurable limitsThe full Model Context Protocol spec โ not a partial port. Tools, resources, prompts, sampling, roots, and elicitation are all implemented and tested.
PSR-compliant throughout. Drop-in support for Laravel and Symfony means you spend time on features, not plumbing.
Built from the ground up for AI agents. Multi-agent coordination, tool orchestration, and complex workflow automation are first-class citizens.
Docker deployment, microservices architecture, monitoring, observability, and security hardening guides โ ready for production from day one.
20+ working code examples, comprehensive API reference, integration guides, and troubleshooting resources. If you're stuck, the answer is in the docs.
Complete API orchestration with authentication, rate limiting, and distributed monitoring across microservices.
View Example โAI-assisted content management system with user management, media handling, and analytics integration.
View Example โMulti-agent system with specialised agents for research, writing, coding, and task management with human-in-the-loop workflows.
View Example โHigh-throughput data processing pipeline with AI-powered transformation, validation, and enrichment.
View Example โAutomated code review and quality analysis tool powered by AI with custom rule engines and reporting.
View Example โAI-enhanced project management with natural language task creation, prioritisation, and automated status updates.
View Example โAdd these to your project's README to show PHP MCP SDK integration:
[](https://phpmcpsdk.com)
[](https://php.net)
[](https://modelcontextprotocol.io)
[](https://github.com/dalehurley/php-mcp-sdk/blob/main/LICENSE)