An open API service indexing awesome lists of open source software.

https://github.com/hyperf/mcp-incubator


https://github.com/hyperf/mcp-incubator

Last synced: 4 months ago
JSON representation

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