
dtyq/php-mcp
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
서버 및 클라이언트 지원, STDIO 및 HTTP 전송, 및 프레임 워크 통합을 가진 Model Context Protocol (MCP)의 완전한 PHP 구현
개요
의 완전한 PHP 구현, 다중 전송 프로토콜에 대한 지원과 서버 및 클라이언트 기능을 제공. - ♨ - MCP 2025-03-26 사양 지원 - ✪ - 도구, 리소스, 신속한 지원 - STDIO ✅, HTTP ✅, Streamable HTTP - Ī - 어떤 PSR-compliant 프레임 워크, 내장 Hyperf 통합과 함께 작동 - 영어 및 중국어 종합 가이드 Hyperf 프레임 워크를 사용하는 경우, 통합은 매우 간단합니다: : - ☸ - 사용자 정의 인증 - Dynamic - 동적 도구 / 자원 등록 - ✈ - 자동 등록 도구, 자원 및 신속한 하이퍼프 통합 가이드 - - 모든 가이드 및 참조 - - 건축, 기능 및 사용 사례 - - 5 분 튜토리얼 - - MCP 서버를 구축 - - MCP 클라이언트 만들기 /examples 디렉토리 확인: - stdio-server-test.php - 완전한 STDIO 서버 - http-server-test.php - 도구가있는 HTTP 서버 - stdio-client-test.php - STDIO 클라이언트 예 - http-client-test.php - HTTP 클라이언트 예 - : 7.
개요(AI 번역)
** Model Context Protocol (MCP)**의 완전한 PHP 구현은 서버와 클라이언트 기능을 제공하여 여러 전송 프로토콜을 지원합니다.
Language: 한국어 | 한국어
✨ 주요 특징
- ♨ 최근 MCP 프로토콜 - MCP 2025-03-26 사양 지원
- ** 완료 구현 ** - 도구, 자원 및 신속한 지원
- 다중 전송 ** - STDIO ✅, HTTP ✅, Streamable HTTP
- ρ **Framework 호환 ** - 모든 PSR-compliant 프레임 워크, 내장 Hyperf 통합 작업
- WWell Documented - 영어 및 중국어 종합 가이드
⭐ 빠른 시작
설치
Hyperf Framework 빠른 통합
Hyperf 프레임 워크를 사용하는 경우, 통합은 매우 간단합니다:
**:
** 고급 옵션 **:
- ̇AuthenticatorInterface - 사용자 정의 인증
- H **HttpTransportAuthenticatedEvent ** - 동적 도구 / 리소스 등록
- ❤️Annotation System** - 자동등록 도구, 리소스 및 프롬프트
하이퍼프 통합 가이드
Basic Server 예제
Basic Client 예제
일부 방법:
문서
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
PHP MCP
A complete PHP implementation of the Model Context Protocol (MCP), providing both server and client functionality with support for multiple transport protocols.
✨ Key Features
- 🚀 Latest MCP Protocol - Supports MCP 2025-03-26 specification
- 🔧 Complete Implementation - Tools, resources, and prompts support
- 🔌 Multiple Transports - STDIO ✅, HTTP ✅, Streamable HTTP 🚧
- 🌐 Framework Compatible - Works with any PSR-compliant framework, built-in Hyperf integration
- 📚 Well Documented - Comprehensive guides in English and Chinese
🚀 Quick Start
Installation
composer require dtyq/php-mcp
Hyperf Framework Quick Integration
If you’re using Hyperf framework, integration is extremely simple:
// Just one line of code!
Router::addRoute(['POST', 'GET', 'DELETE'], '/mcp', function () {
return \Hyperf\Context\ApplicationContext::getContainer()->get(HyperfMcpServer::class)->handle('default');
});
Annotation-Based Registration:
class CalculatorService
{
#[McpTool(description: 'Mathematical calculations')]
public function calculate(string $operation, int $a, int $b): array
{
return ['result' => match($operation) {
'add' => $a + $b,
'multiply' => $a * $b,
default => 0
}];
}
#[McpResource(description: 'System information')]
public function systemInfo(): TextResourceContents
{
return new TextResourceContents('mcp://system/info',
json_encode(['php' => PHP_VERSION]), 'application/json');
}
}
Advanced Options:
- 🔐 AuthenticatorInterface - Custom authentication
- 📊 HttpTransportAuthenticatedEvent - Dynamic tool/resource registration
- 📝 Annotation System - Auto-register tools, resources and prompts
👉 View Complete Hyperf Integration Guide
Basic Server Example
<?php
require_once 'vendor/autoload.php';
use Dtyq\PhpMcp\Server\McpServer;
use Dtyq\PhpMcp\Shared\Kernel\Application;
// Create server with simple container
$container = /* your PSR-11 container */;
$app = new Application($container, ['sdk_name' => 'my-server']);
$server = new McpServer('my-server', '1.0.0', $app);
// Add a tool
$server->registerTool(
new \Dtyq\PhpMcp\Types\Tools\Tool('echo', [
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →