Download the PHP package mcp/mcp-sdk-php without Composer
On this page you can find all versions of the php package mcp/mcp-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mcp/mcp-sdk-php
More information about mcp/mcp-sdk-php
Files in mcp/mcp-sdk-php
Package mcp-sdk-php
Short Description Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs.
License MIT
Homepage https://github.com/dependencies-packagist/mcp-sdk-php
Informations about the package mcp-sdk-php
Model Context Protocol (MCP) SDK for PHP
This package provides a PHP implementation of the Model Context Protocol, allowing applications to provide context for LLMs in a standardized way. It separates the concerns of providing context from the actual LLM interaction.
Installation
You can install the package via Composer:
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 SSE
- Handle all MCP protocol messages and lifecycle events
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.
Basic Usage
Creating an MCP Server
Here's a complete example of creating an MCP server that provides prompts:
Save this as example_server.php
Creating an MCP Client
Here's how to create a client that connects to the example server:
Save this as example_client.php
and run it:
Advanced Logging For Debugging
Using Logging
You can enable detailed logging on the client side, the server side, or both.
Creating an MCP Server With Logging
Here's the previous example MCP server with detailed logging enabled:
Save this as debug_example_server.php
Creating an MCP Client With Logging
Here's how to create a client with detailed logging enabled:
Save this as debug_example_client.php
and run it:
License
The MIT License (MIT). Please see License File for more information.
All versions of mcp-sdk-php with dependencies
ext-curl Version *
psr/log Version ^3.0
cboden/ratchet Version ^0.4
monolog/monolog Version ^3.0