# Model Context Protocol SDK for PHP

A pure-PHP SDK implementing the full Model Context Protocol specification, for building MCP clients and servers that run in ordinary PHP, Apache, and cPanel hosting environments.

mcp-sdk-php is a PHP SDK implementing the full Model Context Protocol specification, designed to run in typical PHP, Apache, and cPanel hosting environments. It supports building MCP clients that connect to any MCP server and MCP servers that expose resources, prompts, and tools, over stdio or HTTP transports, and negotiates automatically between a range of spec revisions.

Version 2 adds day-one support for the latest stateless-core spec revision, which drops the initialize handshake and session IDs so every request is self-contained, a good fit for typical PHP hosting where each request runs in a fresh process, along with an extension for attaching a host-rendered HTML UI to a tool. It also adds a tasks extension for long-running tool calls that clients can poll, cancel, and feed input to, backed by a file-based store that works on shared hosting, and dual-era negotiation so one codebase serves both modern and legacy clients.

It passes the applicable required MCP conformance tests and installs through Composer, under the MIT license.

Website: https://github.com/logiscape/mcp-sdk-php
