🐉 The fast, PHP way to build MCP servers

by pronskiy

125 stars
312 downloads
Not rated
GitHub

About

It is a PHP library (pronskiy/mcp) for building Model Context Protocol (MCP) servers, enabling developers to create tools, expose resources, define prompts, and connect components using clean, intuitive PHP code.

Details

Author
pronskiy
GitHub stars
125
Downloads
312
Categories
Developer Tools

- Simple PHP library for building MCP servers
- Provides an intuitive API for defining tools
- Supports exposing resources and defining prompts
- Uses Composer for dependency management
- Inspired by the `logiscape/mcp-sdk

Install via Composer with composer require pronskiy/mcp. Then instantiate a \Pronskiy\Mcp\Server, add tools using the tool() method (e.g., add-numbers, multiply-numbers), and call run().

🐉 The fast, PHP way to build MCP servers

The Model Context Protocol (MCP) is a new, standardized way to provide context and tools to your LLMs, and pronskiy/mcp makes building MCP servers simple and intuitive.

Create tools, expose resources, define prompts, and connect components with clean PHP code.

Installation

With composer:

composer require pronskiy/mcp

Usage

require 'vendor/autoload.php';

$server = new \Pronskiy\Mcp\Server('simple-mcp-server');

$server
->tool(
'add-numbers',
'Adds two numbers together',
fn(float $num1, float $num2) => "The sum of {$num1} and {$num2} is " . ($num1 + $num2)
)
->tool(
'multiply-numbers',
'Multiplies two numbers',
fn(float $num1, float $num2) => "The product of {$num1} and {$num2} is " . ($num1 * $num2)
)
;

$server->run();

Credits

- https://github.com/logiscape/mcp-sdk-php

License

The MIT License (MIT). Please see License File for more information.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.