https://github.com/hyperf/mcp-incubator
https://github.com/hyperf/mcp-incubator
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hyperf/mcp-incubator
- Owner: hyperf
- Created: 2025-03-24T10:27:08.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-04-09T01:35:03.000Z (10 months ago)
- Last Synced: 2025-09-21T02:32:36.853Z (4 months ago)
- Language: PHP
- Size: 63.5 KB
- Stars: 22
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Model Context Protocol (MCP)
开始使用模型上下文协议 Model Context Protocol (MCP)。
## 安装
```bash
composer require hyperf/mcp-incubator
```
## 使用
### Stdio
```php
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