- Explore MCP Servers
- mcp-incubator
Mcp Incubator
What is Mcp Incubator
MCP-Incubator is a framework designed to implement the Model Context Protocol (MCP), facilitating stateful long connections for applications.
Use cases
Use cases include implementing a real-time chat system, creating a live data dashboard, or developing collaborative editing tools where multiple users interact simultaneously.
How to use
To use MCP-Incubator, install it via Composer with ‘composer require hyperf/mcp’. Then, configure your server settings in ‘autoload/server.php’ to adapt to the mcp-sse protocol, ensuring your Nginx supports long connections.
Key features
Key features include support for stateful long connections, easy integration with Hyperf framework, and the ability to define tools with annotations for various functionalities.
Where to use
MCP-Incubator can be used in web applications that require real-time data processing and communication, such as chat applications, live notifications, and collaborative tools.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Incubator
MCP-Incubator is a framework designed to implement the Model Context Protocol (MCP), facilitating stateful long connections for applications.
Use cases
Use cases include implementing a real-time chat system, creating a live data dashboard, or developing collaborative editing tools where multiple users interact simultaneously.
How to use
To use MCP-Incubator, install it via Composer with ‘composer require hyperf/mcp’. Then, configure your server settings in ‘autoload/server.php’ to adapt to the mcp-sse protocol, ensuring your Nginx supports long connections.
Key features
Key features include support for stateful long connections, easy integration with Hyperf framework, and the ability to define tools with annotations for various functionalities.
Where to use
MCP-Incubator can be used in web applications that require real-time data processing and communication, such as chat applications, live notifications, and collaborative tools.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
Model Context Protocol (MCP)
开始使用模型上下文协议 Model Context Protocol (MCP)。
安装
composer require hyperf/mcp-incubator
使用
Stdio
<?php
use Hyperf\Mcp\Annotation\Tool;
use Hyperf\Mcp\Server\Annotation\Server;
#[Server(name: 'stdio', signature: 'mcp:command', description: '这是一个测试命令')]
class Foo
{
#[Tool(name: 'sum', description: '计算两个数的和', serverName: 'stdio')]
public function sum(#[Description('这是A参数')] int $a, #[Description('这是B参数')] int $b = 0): int
{
return $a + $b;
}
}
SSE
修改autoload/server.php (新增 mcp-sse 协议)
注意: SSE 协议属于有状态长连接协议, 请确保你的 Nginx 配置支持长连接, 并且根据sessionId 参数进行负载均衡。
<?php
use Hyperf\Server\Server;
use Hyperf\Server\Event;
use Hyperf\Mcp\Server\McpServer;
return [
'type' => Hyperf\Server\CoroutineServer::class, # 建议协程风格
'servers' => [
'mcp-sse' => [
'type' => Server::SERVER_HTTP,
'host' => '0.0.0.0',
'port' => 3000,
'sock_type' => SWOOLE_SOCK_TCP,
'callbacks' => [
Event::ON_REQUEST => [McpServer::class, 'onRequest'],
Event::ON_CLOSE => [McpServer::class, 'onClose'],
],
'options' => [
'mcp_path' => '/sse',
],
],
],
];
<?php
use Hyperf\Mcp\Annotation\Tool;
use Hyperf\Mcp\Server\Annotation\Server;
#[Server(name: 'mcp-sse', description: '这是一个测试命令')]
class Foo
{
#[Tool(name: 'sum', description: '计算两个数的和', serverName: 'mcp-sse')]
public function sum(#[Description('这是A参数')] int $a, #[Description('这是B参数')] int $b = 0): int
{
return $a + $b;
}
}
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










