
php-mcp/server
Deployment & DevOpsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
モデルコンテキストプロトコル(MCP)サーバー向けのコアPHP実装
概要
このSDKにより、PHPアプリケーションの機能を標準化されたMCP、、およびとして公開でき、AnthropicのClaudeやCursor IDE、OpenAIのChatGPTなどのAIアシスタントがMCP標準を使ってバックエンドとやり取りできます。 - : PHP 8.1+機能、PSR標準、モジュール設計で構築 - : stdio、http+sse、新機能(再開可能)をサポート - : ゼロ構成要素登録にPHP 8属性(#[McpTool]、#[McpResource]など)を使用 - : クロージャー、クラスメソッド、静的メソッド、呼び出し可能なクラスのサポート - : メソッドシグネチャからの自動JSONスキーマ生成とオプションの#[Schema]属性強化 - : 複数のストレージバックエンドを備えた高度なセッション処理 - : 高同時実行性と非ブロッキング操作のためのReactPHPベース - : JSON-RPCバッチリクエストの完全サポート - : 発見された要素のインテリジェントキャッシュと手動オーバーライド優先 - : ツールやプロンプトにおける引数補完の組み込みサポート - : 完全なPSR-11コンテナサポート...
概要(AI 翻訳)
モデルコンテキストプロトコル(MCP)サーバーを構築するための包括的なPHP SDKです。現代的なアーキテクチャ、広範なテスト、柔軟なトランスポートオプションを備えたPHPで本番環境対応のMCPサーバーを作成できます。
このSDKにより、PHPアプリケーションの機能を標準化されたMCP Tools、Resources、Promptとして公開でき、AIアシスタント(AnthropicのClaude、Cursor IDE、OpenAIのChatGPTなど)がMCP標準を使ってバックエンドとやり取りできるようにします。
🚀 主な特徴
- ** 🏗️ モダンアーキテクチャ**:PHP 8.1+機能、PSR標準、モジュール設計で構築されています
- ** 📡 マルチプルトランスポート**:
stdio、http+sseおよび新しいストリーム可能なHTTPと再開可能をサポートしています - ** 🎯 属性ベース定義**:ゼロ設定要素登録にPHP 8属性(
#[McpTool]、#[McpResource]など)を使用してください - ** 🔧 柔軟なハンドラ**:クロージャー、クラスメソッド、静的メソッド、呼び出し可能なクラスのサポート
- ** 📝 スマートスキーマ生成**:オプションの
#[Schema]属性強化付き、メソッド署名から自動JSONスキーマ生成 - ** ⚡ セッション管理**:複数のストレージバックエンドを用いた高度なセッション処理
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
PHP MCP Server SDK
A comprehensive PHP SDK for building Model Context Protocol (MCP) servers. Create production-ready MCP servers in PHP with modern architecture, extensive testing, and flexible transport options.
This SDK enables you to expose your PHP application’s functionality as standardized MCP Tools, Resources, and Prompts, allowing AI assistants (like Anthropic’s Claude, Cursor IDE, OpenAI’s ChatGPT, etc.) to interact with your backend using the MCP standard.
🚀 Key Features
- 🏗️ Modern Architecture: Built with PHP 8.1+ features, PSR standards, and modular design
- 📡 Multiple Transports: Supports
stdio,http+sse, and new streamable HTTP with resumability - 🎯 Attribute-Based Definition: Use PHP 8 Attributes (
#[McpTool],#[McpResource], etc.) for zero-config element registration - 🔧 Flexible Handlers: Support for closures, class methods, static methods, and invokable classes
- 📝 Smart Schema Generation: Automatic JSON schema generation from method signatures with optional
#[Schema]attribute enhancements - ⚡ Session Management: Advanced session handling with multiple storage backends
- 🔄 Event-Driven: ReactPHP-based for high concurrency and non-blocking operations
- 📊 Batch Processing: Full support for JSON-RPC batch requests
- 💾 Smart Caching: Intelligent caching of discovered elements with manual override precedence
- 🧪 Completion Providers: Built-in support for argument completion in tools and prompts
- 🔌 Dependency Injection: Full PSR-11 container support with auto-wiring
- 📋 Comprehensive Testing: Extensive test suite with integration tests for all transports
This package supports the 2025-03-26 version of the Model Context Protocol with backward compatibility.
📋 Requirements
- PHP >= 8.1
- Composer
- For HTTP Transport: An event-driven PHP environment (CLI recommended)
- Extensions:
json,mbstring,pcre(typically enabled by default)
📦 Installation
composer require php-mcp/server
💡 Laravel Users: Consider using
php-mcp/laravelfor enhanced framework integration, configuration management, and Artisan commands.
⚡ Quick Start: Stdio Server with Discovery
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →設定
{
"mcpServers": {
"php-calculator": {
"command": "php",
"args": ["/absolute/path/to/your/mcp-server.php"]
}
}
}