Download the PHP package friendsofhyperf/mcp-server without Composer
On this page you can find all versions of the php package friendsofhyperf/mcp-server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download friendsofhyperf/mcp-server
More information about friendsofhyperf/mcp-server
Files in friendsofhyperf/mcp-server
Download friendsofhyperf/mcp-server
More information about friendsofhyperf/mcp-server
Files in friendsofhyperf/mcp-server
Vendor friendsofhyperf
Package mcp-server
Short Description MCP Server - A Model Context Protocol server implementation for Hyperf framework with Redis session management and annotation-based configuration
License MIT
Homepage https://github.com/friendsofhyperf/mcp-server
Package mcp-server
Short Description MCP Server - A Model Context Protocol server implementation for Hyperf framework with Redis session management and annotation-based configuration
License MIT
Homepage https://github.com/friendsofhyperf/mcp-server
Please rate this library. Is it a good library?
Informations about the package mcp-server
MCP Server
MCP Server 是一个基于 Hyperf 框架的 Model Context Protocol (MCP) 服务器实现,提供了完整的 MCP 协议支持,包括工具、资源和提示管理功能。
🚀 特性
- 完整的 MCP 协议支持 - 实现了 Model Context Protocol 规范
- 多传输方式 - 支持 STDIO 和 HTTP 两种传输协议
- 会话管理 - 基于 Redis 的分布式会话存储
- 注解驱动 - 支持通过注解自动发现和注册工具、资源和提示
- 灵活配置 - 丰富的配置选项,支持多服务器实例
- Hyperf 集成 - 完全集成 Hyperf 框架的依赖注入和事件系统
- 命令行支持 - 内置命令行工具用于启动 MCP 服务器
📋 要求
- PHP >= 8.1
- Hyperf ~3.1.0
- Redis 扩展
- Composer
📦 安装
⚙️ 配置
发布配置文件
配置示例:
🔧 使用
1. 创建工具
使用 #[McpTool] 注解创建工具:
2. 创建资源
使用 #[McpResource] 注解创建资源:
3. 创建提示
使用 #[McpPrompt] 注解创建提示:
4. 启动服务器
MCP 服务器会自动:
- 注册 HTTP 路由端点(默认为
/mcp) - 注册命令行工具(用于 STDIO 传输)
- 根据配置自动发现并注册工具、资源和提示
🏗️ 架构
核心组件
- ServerManager - 服务器管理器,负责创建和配置 MCP 服务器实例
- RegisterMcpServerListener - 应用启动监听器,自动注册配置的 MCP 服务器
- ConfigProvider - Hyperf 配置提供者,注册服务依赖
关键特性
- 多服务器支持 - 支持在单个应用中运行多个 MCP 服务器实例
- 灵活的传输层 - 支持 STDIO 和 HTTP 传输协议
- 会话管理 - 支持内存和 Redis 会话存储
- 自动发现 - 基于注解的自动组件发现和注册
- 事件驱动 - 集成 Hyperf 事件系统
🔌 扩展
自定义会话存储
实现 SessionInterface 接口:
自定义处理器
实现请求和通知处理器:
🧪 测试
📝 配置选项
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
enabled |
bool | true |
是否启用服务器 |
name |
string | 'MCP Server' |
服务器名称 |
version |
string | '1.0.0' |
服务器版本 |
description |
string | 'A MCP server.' |
服务器描述 |
protocol_version |
string | '2024-11-05' |
MCP 协议版本 |
pagination_limit |
int | 100 |
分页限制 |
logger |
string | - | 日志服务名称 |
capabilities |
array | - | 服务器能力配置 |
session.ttl |
int | 3600 |
会话 TTL(秒) |
discovery.scan_dirs |
array | ['.', 'src', 'app'] |
自动发现扫描目录 |
discovery.exclude_dirs |
array | ['vendor', 'tests'] |
排除的扫描目录 |
router.path |
string | '/mcp' |
HTTP 路由路径 |
router.options |
array | [] |
路由中间件等选项 |
command.signature |
string | 'mcp:stdio' |
命令行工具签名 |
command.description |
string | 'Run MCP stdio server.' |
命令行工具描述 |
🤝 贡献
欢迎提交 Issue 和 Pull Request!
- Fork 项目
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 打开 Pull Request
📄 许可证
本项目采用 MIT 许可证。详见 LICENSE 文件。
🔗 相关链接
📞 支持
- 问题反馈: GitHub Issues
- 官方文档: Hyperf Wiki
- 社区讨论: Hyperf 官方群
All versions of mcp-server with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.1
ext-redis Version *
hyperf/command Version ~3.1.0
hyperf/context Version ~3.1.0
hyperf/di Version ~3.1.0
hyperf/framework Version ~3.1.0
hyperf/http-server Version ~3.1.0
hyperf/redis Version ~3.1.0
mcp/sdk Version ^0.1.0
ext-redis Version *
hyperf/command Version ~3.1.0
hyperf/context Version ~3.1.0
hyperf/di Version ~3.1.0
hyperf/framework Version ~3.1.0
hyperf/http-server Version ~3.1.0
hyperf/redis Version ~3.1.0
mcp/sdk Version ^0.1.0
The package friendsofhyperf/mcp-server contains the following files
Loading the files please wait ...