PHPackages                             logiscape/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. logiscape/mcp-sdk-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

logiscape/mcp-sdk-php
=====================

Model Context Protocol SDK for PHP

v1.5.1(1mo ago)36274.1k—7.6%504MITPHPPHP &gt;=8.1

Since Dec 22Pushed 1mo ago11 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (23)Used By (4)

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). The primary goal of this project is to provide both a MCP server and a MCP client using pure PHP, making it easy to use in PHP/Apache/cPanel hosting environments with typical server configurations.

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 HTTP
- Handle all MCP protocol messages and lifecycle events

This SDK began as a PHP port of the official [Python SDK](https://github.com/modelcontextprotocol/python-sdk) for the Model Context Protocol. It has since been expanded to fully support MCP using native PHP functions, helping to maximize compatibility with most standard web hosting environments.

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-json
- ext-pcntl (optional, recommended for CLI environments)
- monolog/monolog (optional, used by example clients/servers for logging)

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

[](#basic-usage)

### Creating an MCP Server

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

For detailed documentation and examples of MCP servers, see the [Server Development Guide](docs/server-dev.md).

Here's a complete example of an MCP server that provides a simple tool:

```
