This package provides a high-performance, asynchronous, event-driven HTTP transport for the official PHP MCP SDK.
It runs as a standalone, single process server, capable of handling multiple concurrent sessions and long-running, multi-yield tool calls without blocking. This makes it an ideal choice for high-concurrency environments or for developers who prefer an asynchronous programming model.
- Asynchronous & Non-Blocking: Built on the ReactPHP event loop for superior I/O performance.
- Single Process: Runs as a persistent, standalone server. No web server (like Nginx or Apache) is required.
- Multi-Session Support: Correctly manages state and Fiber lifecycles for multiple concurrent client sessions.
- Community-Driven: A robust transport option provided by the community.
composer require codewithkyrian/mcp-reactphp-transportCreate your MCP server script. This single script will start a persistent process that listens for HTTP requests.
server.php
<?php
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload.php';
use Mcp\Server;
use CodeWithKyrian\McpReactPhpTransport\ReactPhpHttpTransport;
$server = Server::builder()
->setServerInfo('ReactPHP Async Server', '1.0.0')
->setDiscovery(__DIR__, ['src']) // Discover tools from a local src/ dir
->build();
$transport = new ReactPhpHttpTransport('127.0.0.1', 8080);
$server->run($transport);Start the server from your terminal:
php server.phpYour MCP server is now running and can be accessed by any MCP client configured to connect to http://127.0.0.1:8080.
This project is licensed under the MIT License - see the LICENSE file for details.