PHPackages                             byfareska/mcp-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. byfareska/mcp-sdk-php

ActiveLibrary[API Development](/categories/api)

byfareska/mcp-sdk-php
=====================

Model Context Protocol SDK for PHP. logiscape/mcp-sdk-php, but with cboden/ratchet dependency removed.

019PHP

Since Apr 10Pushed 1y agoCompare

[ Source](https://github.com/byfareska/mcp-sdk-php)[ Packagist](https://packagist.org/packages/byfareska/mcp-sdk-php)[ RSS](/packages/byfareska-mcp-sdk-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Model Context Protocol SDK for PHP
==================================

[](#model-context-protocol-sdk-for-php)

English | [中文](README.zh-CN.md)

This package provides a PHP implementation of the [Model Context Protocol](https://modelcontextprotocol.io), allowing applications to provide context for LLMs in a standardized way. It separates the concerns of providing context from the actual LLM interaction.

v2.0 Development
----------------

[](#v20-development)

We are currently developing v2.0 of the MCP SDK for PHP, which will implement the 2025-03-26 revision of the MCP Spec. Development will be done in the 2.0-dev branch, with merges to the main branch after testing to ensure the SDK is in a functional state. A v2.0 release will be tagged after the 2025-03-26 revision is fully implemented and tested.

### Completed Tasks

[](#completed-tasks)

- Implement protocol version negotiation
- Create classes for new spec features
- Add support for JSON-RPC batching

### In Progress

[](#in-progress)

- Implement streamable HTTP transport with optional SSE module

### To Do

[](#to-do)

- Implement authorization framework based on OAuth 2.1
- Fully test new spec features and remote MCP client/server connections over HTTP

Overview
--------

[](#overview)

This PHP SDK implements the full MCP specification, making it easy to:

- Build MCP clients that can connect to any MCP server
- Create MCP servers that expose resources, prompts and tools
- Use standard transports like stdio and SSE
- Handle all MCP protocol messages and lifecycle events

Based on the official [Python SDK](https://github.com/modelcontextprotocol/python-sdk) for the Model Context Protocol.

This SDK is primarily targeted at developers working on frontier AI integration solutions. Some functionality may be incomplete and implementations should undergo thorough testing and security review by experienced developers prior to production use.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require logiscape/mcp-sdk-php

```

### Requirements

[](#requirements)

- PHP 8.1 or higher
- ext-curl
- ext-pcntl (optional, recommended for CLI environments)

Basic Usage
-----------

[](#basic-usage)

### Creating an MCP Server

[](#creating-an-mcp-server)

Here's a complete example of creating an MCP server that provides prompts:

```
