Skip to content

修复 HyperfMcpServer 示例 handle 方法#1

Merged
lihq1403 merged 1 commit into
dtyq:masterfrom
huangdijia:codex/hyperfmcpserver-handle
Mar 15, 2026
Merged

修复 HyperfMcpServer 示例 handle 方法#1
lihq1403 merged 1 commit into
dtyq:masterfrom
huangdijia:codex/hyperfmcpserver-handle

Conversation

@huangdijia

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 15, 2026 09:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Hyperf integration documentation to reflect the correct HyperfMcpServer entrypoint method and the new server-based annotation registration model.

Changes:

  • Update Hyperf route examples from handler() to handle('default').
  • Replace annotation parameter group with server, and document version as part of registration.
  • Rename the docs section from group-based registration to server-based registration and update route examples accordingly.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
docs/en/server/hyperf-integration.md Updates Hyperf route and annotation docs to use handle() and server-based registration terminology.
docs/cn/server/hyperf-integration.md Same as EN doc, for CN localization.
README.md Updates the Hyperf quick integration snippet to call handle('default').
README_CN.md Same README update for CN localization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +279 to +291
// 注册 math MCP 服务
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp/math', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler('math');
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('math');
});

// 注册开发工具
// 注册 development MCP 服务
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp/dev', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler('development');
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('development');
});

// 注册所有工具(默认分组)
// 注册默认 MCP 服务
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler();
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('default');
name: 'advanced_calc',
description: 'Advanced mathematical calculations',
group: 'math'
server: 'math'
name: 'code_review',
description: 'Generate code review prompts',
group: 'development'
server: 'development'
Comment on lines +279 to +291
// Register the math MCP server
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp/math', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler('math');
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('math');
});

// Register development tools
// Register the development MCP server
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp/dev', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler('development');
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('development');
});

// Register all tools (default group)
// Register the default MCP server
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handler();
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('default');
name: 'advanced_calc',
description: '高级数学计算',
group: 'math'
server: 'math'
name: 'code_review',
description: '生成代码审查提示',
group: 'development'
server: 'development'
@lihq1403 lihq1403 merged commit 3bdde32 into dtyq:master Mar 15, 2026
3 of 4 checks passed
@huangdijia huangdijia deleted the codex/hyperfmcpserver-handle branch March 15, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants