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

AbandonedArchivedLibrary[API Development](/categories/api)

huangdijia/mcp-sdk-php
======================

Model Context Protocol SDK for PHP

v0.1.1(1y ago)3255MITPHPPHP ^8.1

Since Apr 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/huangdijia/mcp-sdk-php)[ Packagist](https://packagist.org/packages/huangdijia/mcp-sdk-php)[ Docs](https://github.com/huangdijia/mcp-sdk-php)[ RSS](/packages/huangdijia-mcp-sdk-php/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (8)Versions (4)Used By (0)

MCP PHP SDK
===========

[](#mcp-php-sdk)

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Installation](#installation)
- [Quickstart](#quickstart)
- [What is MCP?](#what-is-mcp)
- [Core Concepts](#core-concepts)
    - [Server](#server)
    - [Resources](#resources)
    - [Tools](#tools)
    - [Prompts](#prompts)
- [Running Your Server](#running-your-server)
    - [stdio](#stdio)
    - [HTTP with SSE](#http-with-sse)
    - [Testing and Debugging](#testing-and-debugging)
- [Examples](#examples)
    - [Echo Server](#echo-server)
    - [SQLite Explorer](#sqlite-explorer)
- [Advanced Usage](#advanced-usage)
    - [Low-Level Server](#low-level-server)
    - [Writing MCP Clients](#writing-mcp-clients)
    - [Server Capabilities](#server-capabilities)

Overview
--------

[](#overview)

The Model Context Protocol allows applications to provide context for LLMs in a standardized way, separating the concerns of providing context from the actual LLM interaction. 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

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

[](#installation)

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

Quick Start
-----------

[](#quick-start)

Let's create a simple MCP server that exposes a calculator tool and some data:

```
