- Explore MCP Servers
- mcp-php-application
Mcp Php Application
What is Mcp Php Application
The MCP PHP Application is a stub application designed to work with the MCP PHP Server framework, serving as a starting point for implementing the Model Context Protocol (MCP) in projects.
Use cases
Use cases include building web applications that require dynamic data manipulation, creating custom tools for specific operations, and integrating with other systems that support the Model Context Protocol.
How to use
To use the MCP PHP Application, clone the repository, navigate to the project directory, and install the dependencies using Composer. You can then create tools by adding new classes in the tools/ directory.
Key features
Key features include compatibility with the MCP PHP Server framework, the ability to create custom tools with defined parameters, and a structured approach to implementing the Model Context Protocol.
Where to use
The MCP PHP Application can be used in web development projects that require a structured approach to managing model contexts, particularly in applications that utilize the Model Context Protocol.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Php Application
The MCP PHP Application is a stub application designed to work with the MCP PHP Server framework, serving as a starting point for implementing the Model Context Protocol (MCP) in projects.
Use cases
Use cases include building web applications that require dynamic data manipulation, creating custom tools for specific operations, and integrating with other systems that support the Model Context Protocol.
How to use
To use the MCP PHP Application, clone the repository, navigate to the project directory, and install the dependencies using Composer. You can then create tools by adding new classes in the tools/ directory.
Key features
Key features include compatibility with the MCP PHP Server framework, the ability to create custom tools with defined parameters, and a structured approach to implementing the Model Context Protocol.
Where to use
The MCP PHP Application can be used in web development projects that require a structured approach to managing model contexts, particularly in applications that utilize the Model Context Protocol.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP PHP Application
The MCP PHP Application is a stub application designed to work with the MCP PHP Server framework. It serves as a starting point for users implementing the Model Context Protocol (MCP) in their projects.
Prerequisites
Before using this application, ensure that you have the following installed:
- PHP: Running
php --versionshould report 8.1 or greater. - Composer: The dependency manager for PHP. You can find it here.
Installation
To set up the application, follow these steps:
-
Clone this repository:
git clone https://github.com/james2037/mcp-php-application.git -
Navigate to the project directory:
cd mcp-php-application -
Install the dependencies using Composer:
composer install
Creating a Tool
To create a tool for the application, follow these steps:
-
Create a new class in the
tools/directory. For example:<?php namespace App\Tools; use MCP\Server\Tool\Tool; use MCP\Server\Tool\Attribute\Tool as ToolAttribute; use MCP\Server\Tool\Attribute\Parameter as ParameterAttribute; #[ToolAttribute('calculator', 'A calculator tool')] class CalculatorTool extends Tool { protected function doExecute( #[ParameterAttribute('operation', type: 'string', description: 'Operation to perform (add/subtract)')] #[ParameterAttribute('a', type: 'number', description: 'First number')] #[ParameterAttribute('b', type: 'number', description: 'Second number')] array $arguments ): array { $result = match ($arguments['operation']) { 'add' => $arguments['a'] + $arguments['b'], 'subtract' => $arguments['a'] - $arguments['b'], default => throw new \InvalidArgumentException('Invalid operation') }; return $this->text((string)$result); } } -
The
#[ToolAttribute]annotation defines the name and description of the tool. -
Parameters for the tool are defined using the
#[ParameterAttribute]annotation. -
Implement the
doExecutemethod to define the tool’s functionality.
Running the Server
To start the MCP PHP server, run the following command:
php path/to/mcp_server.php
the mcp_server.php file is located in the root of this repository.
The server will start and listen for requests based on the Model Context Protocol.
Features
Currently, you can write tools. The server supports the STDIO transport only. New capabilities and transports coming soon.
Contributing
Contributions to the MCP PHP Application are welcome! Feel free to submit issues or pull requests to improve functionality, documentation, or examples.
License
This project is licensed under the MIT License.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










