mcp-sdk

This repository provides a PHP SDK for the Model Context Protocol, facilitating communication between client and server applications. It offers Symfony integration for console commands and server-sent events, enabling easy

35
1

Model Context Protocol PHP SDK [WIP]

Model Context Protocol SDK for building Client and Server applications in PHP.

See Demo App for a working example.

Installation

composer require php-llm/mcp-sdk

Usage with Symfony

Server integration points are tailored for Symfony Console and HttpFoundation (Laravel compatible).

Console Command for STDIO Server

Provides a Symfony Console command to start an MCP server using standard input/output. It utilizes SymfonyConsoleTransport to handle communication.

Controller for Server-Sent Events Server

Offers a Symfony Controller to establish an MCP server using Server-Sent Events (SSE). It uses StreamTransport and CachePoolStore for managing SSE connections and message storage. The controller defines routes for SSE stream initiation and message handling.

Exposing Tools

Leverages LLM Chain's ToolBox for tool registration and execution. With the Symfony Bundle, tools can be exposed using the #[AsTool] attribute, enabling integration with Language Model (LLM) chains.

Repository

PH
php-llm

php-llm/mcp-sdk

Created

March 7, 2025

Updated

March 28, 2025

Language

PHP

Category

Developer Tools