# mcp-sdk

> MCP Server

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

## Overview

- **Category:** Developer Tools
- **Language:** PHP
- **Stars:** 34
- **Forks:** 1
- **Owner:** php-llm
- **GitHub:** https://github.com/php-llm/mcp-sdk
- **Created:** 2025-03-07T19:50:35+00:00
- **Updated:** 2025-03-28T21:31:59+00:00
- **Source:** https://model-context-protocol.com/servers/php-model-context-protocol-sdk

## Setup

## Setup

To install the SDK, run:

```bash
composer require php-llm/mcp-sdk
```

For Symfony integration, the SDK provides server integration points tailored to Symfony Console and HttpFoundation (Laravel compatible).

To create a Console Command for STDIO Server, define a class extending `Symfony\Component\Console\Command\Command` and use `PhpLlm\McpSdk\Server` and `PhpLlm\McpSdk\Server\Transport\Stdio\SymfonyConsoleTransport`.

To create a Controller for Server-Sent Events Server, define a controller using `PhpLlm\McpSdk\Server`, `PhpLlm\McpSdk\Server\Transport\Sse\Store\CachePoolStore`, and `PhpLlm\McpSdk\Server\Transport\Sse\StreamTransport`.

To expose tools, use the `#[AsTool]` attribute from `PhpLlm\LlmChain\ToolBox\Attribute\AsTool` in combination with the [Symfony Bundle](https://github.com/php-llm/llm-chain-bundle).

## Tools

## Available Tools

1.  Model Context Protocol SDK (Provides a SDK for Client and Server applications in PHP).
2.  Symfony Console Integration (Provides integration points for Symfony Console).
3.  HttpFoundation Integration (Provides integration points for HttpFoundation, Laravel compatible).
4.  STDIO Server (Provides a console command for STDIO server).
5.  Server-Sent Events Server (Provides a controller for Server-Sent Events server).
6.  Tool Exposing with `#[AsTool]` (Allows exposing tools using the `#[AsTool]` attribute from `PhpLlm\LlmChain\ToolBox\Attribute\AsTool`).
