modelcontextprotocol/php-sdk
The official PHP SDK for Model Context Protocol servers and clients. Maintained in collaboration with The PHP Foundation.
What it solves
It provides a standardized way for PHP developers to build servers and clients that follow the Model Context Protocol (MCP). This allows PHP applications to expose tools, resources, and prompts to AI models and other MCP-compatible clients in a consistent, framework-agnostic manner.
How it works
The SDK offers a framework-agnostic API that handles the complexities of the MCP protocol. Developers can create a server by defining a plain PHP class and using attributes (like #[McpTool] and #[McpResource]) to mark methods that should be exposed to the AI. It supports multiple transport methods, including STDIO and HTTP, and manages sessions, authorization, and different protocol versions (including the initialize handshake and the stateless 2026-07-28 revision).
Who it’s for
PHP developers who want to integrate their applications with AI models by creating MCP servers to provide context or tools, or building MCP clients to interact with existing MCP servers.
Highlights
- Framework-agnostic: Works across different PHP environments and integrates with frameworks like Symfony, Drupal, and CakePHP.
- Attribute-based registration: Simplifies the creation of tools and resources using PHP attributes.
- Flexible transports: Supports both STDIO and HTTP for communication.
- Protocol compliance: Supports multiple protocol eras and versions to ensure compatibility.
関連
- プロジェクト
- プロジェクト
- プロジェクト
- プロジェクト
- プロジェクト