modelcontextprotocol / php-sdk
git clone https://github.com/modelcontextprotocol/php-sdk.git
v0.9.0 Β· 2d ago
π₯ on GitHub Trending today
The official PHP SDK for Model Context Protocol servers and clients. Maintained in collaboration with The PHP Foundation.
+0
stars, 24h Β· #649
+10
stars, 7 days Β· #1,581
β
stars, 30 days
1.6k
β
total Β· +1% this week
185
forks Β· 55 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguagePHP
Licenseβ
Created2025-07-15 (1y ago)
Last pushtoday
Watchers24
OwnerOrganization
Seen on GitHub Trending
- 2026-10-20 β #8 daily in php
- 2026-10-20 β #9 weekly in php Β· +10 β
GitHub topics
Links
- GitHub: github.com/modelcontextprotocol/php-sdk
- Homepage: https://php.sdk.modelcontextprotocol.io
- Releases Β· Issues Β· Hacker News mentions
README excerpt
# MCP PHP SDK The official PHP SDK for the Model Context Protocol (MCP). It provides a framework-agnostic API for implementing MCP servers and clients in PHP β tools, resources, prompts, STDIO and HTTP transports, sessions, authorization, and both protocol eras (the `initialize` handshake and the stateless `2026-07-28` revision). This project represents a collaboration between the PHP Foundation and the Symfony project. It adopts development practices and standards from the Symfony project, including Coding Standards and the Backward Compatibility Promise. Until the first major release, this SDK is considered experimental, please see the roadmap for planned next steps and features. ## Protocol Conformance Measured weekly against the MCP Conformance Test Framework, as passing checks out of total. The `2026-07-28` scores run against the framework's `alpha` releases, so they move as upstream publishes new scenarios. | Revision | Server | Client | |:--------:|:------:|:------:| | `2026-07-28` | | | | `2025-11-25` | | | ## Installation [code] ## Build a server A server is a plain PHP class plus three lines of wiring: [code] The `setDiscovery()` call needs `symfony/finder`: [code] The walkthrough in First server explains each piece, and Try it with the Inspector shows it running. ## Build a client [code] See Transports for STDIO and HTTP, Connecting to a server for timeouts, and Server-initiated requests for the handlers that answer requests from the server. ## Documentation The full documentation is published at **php.sdk.modelcontextprotocol.io**. - **Get started** β Install the SDK and build your first server - **Servers** β Tools, resources, resource templates, prompts, and how to register them - **Inside your handler** β Talking back to the client, logging, and asking for input - **Running your server** β Server builder, STDIO and HTTP transports, framework integration, sessions, authorization - **Clients** β Client SDK for connecting to and communicating with MCP servers - **Protocol versions** β The two protocol eras, and what revision `2026-07-28` changed - **Advanced** β Events, protocol extensions (including MCP Apps), and custom message handlers - **Deprecation policy** β How deprecated features are handled - **SDK tier target** β Where the SDK stands on the MCP SDK tiers - **Examples** β Runnable server and client examples - **API Reference** β Generated class reference ## External Resources - **Model Context Protocol Documentation** β Official MCP documentation - **Model Context Protocol Specification** β Protocol specification - **Officially Supported Servers** β Reference server implementations ## PHP Libraries Using the MCP SDK - api-platform/mcp β MCP integration for API Platform - bnomei/kirby-mcp β MCP server for the Kirby CMS - drupal/mcp_server β MCP server for Drupal exposing configuration and entities as MCP elements - josbeir/cakephp-synapse β CakePHP plugin exposing application functionality over MCP - nette/mcp-inspect