Skip to content

Commit 54d1e2a

Browse files
committed
feat(docs): add Hyperf integration guide to README files
1 parent 2e4275c commit 54d1e2a

File tree

5 files changed

+1542
-2
lines changed

5 files changed

+1542
-2
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ A complete PHP implementation of the **Model Context Protocol (MCP)**, providing
1515
- 🚀 **Latest MCP Protocol** - Supports MCP 2025-03-26 specification
1616
- 🔧 **Complete Implementation** - Tools, resources, and prompts support
1717
- 🔌 **Multiple Transports** - STDIO ✅, HTTP ✅, Streamable HTTP 🚧
18-
- 🌐 **Framework Compatible** - Works with any PSR-compliant framework
18+
- 🌐 **Framework Compatible** - Works with any PSR-compliant framework, built-in Hyperf integration
1919
- 📚 **Well Documented** - Comprehensive guides in English and Chinese
2020

2121
## 🚀 Quick Start
@@ -26,6 +26,31 @@ A complete PHP implementation of the **Model Context Protocol (MCP)**, providing
2626
composer require dtyq/php-mcp
2727
```
2828

29+
### Hyperf Framework Quick Integration
30+
31+
If you're using Hyperf framework, integration is just two steps away:
32+
33+
```php
34+
// 1. Register route
35+
Router::post('/mcp', function () {
36+
return di(HyperfMcpServer::class)->handler();
37+
});
38+
39+
// 2. Register tools (optional)
40+
$server->registerTool(
41+
new Tool('echo', [...], 'Echo a message'),
42+
function(array $args): array {
43+
return ['response' => $args['message']];
44+
}
45+
);
46+
```
47+
48+
**Advanced Options**:
49+
- 🔐 **AuthenticatorInterface** - Custom authentication
50+
- 📊 **HttpTransportAuthenticatedEvent** - Dynamic TransportMetadata management
51+
52+
👉 [View Complete Hyperf Integration Guide](./docs/en/server/hyperf-integration.md)
53+
2954
### Basic Server Example
3055

3156
```php

README_CN.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- 🚀 **最新 MCP 协议** - 支持 2025-03-26 版本的 MCP 协议
1616
- 🔧 **完整实现** - 支持工具、资源和提示
1717
- 🔌 **多种传输协议** - STDIO ✅、HTTP ✅、流式 HTTP 🚧
18-
- 🌐 **框架兼容** - 兼容任何符合 PSR 标准的框架
18+
- 🌐 **框架兼容** - 兼容任何符合 PSR 标准的框架,内置 Hyperf 集成
1919
- 📚 **文档完善** - 提供中英文完整指南
2020

2121
## 🚀 快速开始
@@ -26,6 +26,31 @@
2626
composer require dtyq/php-mcp
2727
```
2828

29+
### Hyperf 框架快速集成
30+
31+
如果您使用 Hyperf 框架,只需两步即可完成集成:
32+
33+
```php
34+
// 1. 注册路由
35+
Router::post('/mcp', function () {
36+
return di(HyperfMcpServer::class)->handler();
37+
});
38+
39+
// 2. 注册工具(可选)
40+
$server->registerTool(
41+
new Tool('echo', [...], '回显消息'),
42+
function(array $args): array {
43+
return ['response' => $args['message']];
44+
}
45+
);
46+
```
47+
48+
**高级选项**
49+
- 🔐 **AuthenticatorInterface** - 自定义认证
50+
- 📊 **HttpTransportAuthenticatedEvent** - 动态管理 TransportMetadata
51+
52+
👉 [查看完整 Hyperf 集成指南](./docs/cn/server/hyperf-integration.md)
53+
2954
### 基础服务器示例
3055

3156
```php

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Welcome to the PHP MCP documentation. This documentation is available in multipl
1717
#### Server / 服务端
1818
- [**📋 STDIO Server Guide**](./en/server/stdio-server.md) - Standard Input/Output transport server setup and usage ✅
1919
- [**🌐 HTTP Server Guide**](./en/server/http-server.md) - HTTP transport server setup and usage ✅
20+
- [**⚡ Hyperf Integration Guide**](./en/server/hyperf-integration.md) - Hyperf framework integration guide ✅
2021

2122
#### Client / 客户端
2223
- [**📋 STDIO Client Guide**](./en/client/stdio-client.md) - Standard Input/Output transport client setup and usage ✅
@@ -33,6 +34,7 @@ Welcome to the PHP MCP documentation. This documentation is available in multipl
3334
#### 服务端 / Server
3435
- [**📋 STDIO 服务端指南**](./cn/server/stdio-server.md) - 标准输入输出传输服务端设置和使用 ✅
3536
- [**🌐 HTTP 服务端指南**](./cn/server/http-server.md) - HTTP 传输服务端设置和使用 ✅
37+
- [**⚡ Hyperf 集成指南**](./cn/server/hyperf-integration.md) - Hyperf 框架集成指南 ✅
3638

3739
#### 客户端 / Client
3840
- [**📋 STDIO 客户端指南**](./cn/client/stdio-client.md) - 标准输入输出传输客户端设置和使用 ✅

0 commit comments

Comments
 (0)