GitHub Stars
117
User Rating
Not Rated
Favorites
0
Views
7
Forks
4
Issues
2
Installation
Difficulty
BeginnerEstimated Time
5-10 minutes
Requirements
PHP: 7.4以上
Composer: 最新版
Installation
Installation
Prerequisites
PHP: 7.4 or higher
Composer: Latest version
Installation Steps
1. Install using Composer
bash
composer require pronskiy/mcp
Troubleshooting
Common Issues
Issue: Composer is not installed Solution: Please install Composer. You can find the installation steps on the official website.Configuration
Configuration
Basic Configuration
The basic configuration of the MCP server is done within the PHP code. Here is an example of defining tools:php
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();
Examples
Examples
Basic Usage
Here is a basic usage example for the MCP server:php
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();
Use Cases
Create a tool to add numbers and run it on the MCP server.
Develop a tool to multiply numbers and integrate it with other applications.
Build an API that provides multiple calculation tools using the MCP server.
Define custom prompts using PHP to instruct the LLM.
Additional Resources
Author Information
353
Followers
88
Repositories
16
Gists
0
Total Contributions