PHP MCP Server logo

PHP MCP Server

by he426100

This is a PHP-based MCP (Model Control Protocol) server framework that supports defining MCP services elegantly through annotations. It provides a complete MCP server implementation with features like annotation-based service definitions and support for different processor and transport types.

View on GitHub

Last updated: N/A

What is PHP MCP Server?

A PHP-based MCP (Model Control Protocol) server framework that allows defining MCP services using annotations.

How to use PHP MCP Server?

Install the project using Composer, define services using Tool, Prompt, and Resource annotations, and run the server using the provided console command. Customize server behavior by extending the AbstractMcpServerCommand.

Key features of PHP MCP Server

  • Annotation-based MCP service definition

  • Supports Tool, Prompt, and Resource processors

  • Supports Stdio and Sse transport methods

  • Supports Swow and Swoole environments

  • Complete logging system

  • Docker support

Use cases of PHP MCP Server

  • Building custom MCP servers for various applications

  • Creating tools for interacting with models

  • Defining prompt templates for generating responses

  • Exposing resources through a standardized protocol

  • Integrating with different transport mechanisms like Stdio and SSE

FAQ from PHP MCP Server

What is MCP?

MCP stands for Model Control Protocol, a protocol for interacting with models and services.

What are Tool, Prompt, and Resource processors?

These are different types of handlers defined using annotations for different purposes: Tool for executing functions, Prompt for generating responses, and Resource for exposing data.

What are Stdio and Sse transport methods?

These are different ways of communicating with the server: Stdio uses standard input/output, while Sse uses Server-Sent Events.

What are Swow and Swoole?

These are asynchronous event-driven PHP extensions that provide high performance for network applications.

How do I configure the server log file?

You can modify the log file path by extending the AbstractMcpServerCommand and overriding the $logFilePath property.