server  by php-mcp

PHP MCP server for AI assistant integration

created 3 months ago
514 stars

Top 62.0% on sourcepulse

GitHubView on GitHub
Project Summary

This library provides a robust PHP implementation for the Model Context Protocol (MCP) server, enabling PHP applications to expose functionality to AI assistants. It targets developers building AI-integrated applications who need to connect PHP backends with AI models like Claude or ChatGPT.

How It Works

The server leverages PHP 8.1+ features, PSR standards, and an event-driven architecture powered by ReactPHP. It supports multiple transport protocols (stdio, http+sse, streamable http) and uses PHP 8 Attributes for zero-configuration registration of MCP elements like Tools, Resources, and Prompts. Automatic JSON schema generation from method signatures enhances validation and client interaction.

Quick Start & Requirements

  • Install: composer require php-mcp/server
  • Requirements: PHP >= 8.1, Composer. Extensions: json, mbstring, pcre.
  • Transport: HTTP transport requires an event-driven PHP environment (CLI recommended).
  • Docs: https://github.com/php-mcp/server

Highlighted Details

  • Attribute-based definition of MCP elements (Tools, Resources, Prompts).
  • Multiple transport options: stdio, http+sse, and streamable HTTP with resumability.
  • Automatic JSON schema generation for parameter validation.
  • Event-driven architecture using ReactPHP for high concurrency.
  • Comprehensive testing and PSR-11 container support for dependency injection.

Maintenance & Community

The project appears actively maintained, with a clear structure for contributions. Links to examples and testing commands are provided.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Permissive license allows for commercial use and integration with closed-source applications.

Limitations & Caveats

The HttpServerTransport is deprecated in favor of StreamableHttpServerTransport. While the README provides extensive examples, setting up complex HTTP transports or custom dependency injection might require a deeper understanding of ReactPHP and PSR-11 containers.

Health Check
Last commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
7
Star History
420 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.