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.7.3(4w ago)368116.8k↓25%505MITPHPPHP &gt;=8.1CI passing

Since Dec 22Pushed 6d ago10 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 3d ago

READMEChangelog (10)Dependencies (14)Versions (32)Used By (5)

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

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

[![CI](https://github.com/logiscape/mcp-sdk-php/actions/workflows/ci.yml/badge.svg)](https://github.com/logiscape/mcp-sdk-php/actions/workflows/ci.yml)[![MCP Conformance](https://github.com/logiscape/mcp-sdk-php/actions/workflows/conformance.yml/badge.svg)](https://github.com/logiscape/mcp-sdk-php/actions/workflows/conformance.yml)

Note

**This `main` branch contains the pre-alpha v2 of the logiscape/mcp-sdk-php SDK.**

For the stable v1 code and documentation, see the [`1.x` branch](https://github.com/logiscape/mcp-sdk-php/tree/1.x).

This package provides a PHP implementation of the [Model Context Protocol](https://modelcontextprotocol.io). The primary goal of this project is to provide both an MCP server and an 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

This SDK offers two major advantages for the MCP and PHP developer communities:

- This SDK features a 100% pass rate on the applicable required [MCP Conformance Tests](https://github.com/modelcontextprotocol/conformance) as of testing suite v0.1.16 and aims to maintain full conformance as the spec and tests evolve, not including tests still marked as experimental or optional extensions.
- The SDK can demonstrate both a functional MCP client and MCP server with a single Composer command. See the [Webclient Example](webclient/README.md).

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:

```
