PHPackages                             hunzhiwange/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. hunzhiwange/mcp-sdk-php

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

hunzhiwange/mcp-sdk-php
=======================

Model Context Protocol SDK for PHP

v1.0.1(1y ago)00MITPHPPHP &gt;=8.4.1

Since May 7Pushed 1y agoCompare

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

READMEChangelogDependencies (2)Versions (3)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.

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

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-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)

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

```
