AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing logiscape/mcp-sdk-php in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewModel Context Protocol SDK for PHP English | 中文 This package provides a PHP implementation of the Model Context Protocol. The primary goal of this project is to provide both a MCP server and a MCP client using pure PHP, making it easy to use in PHP/Apache/cPanel hosting environments with typical server configurations. Overview This PHP SDK implements the full MCP specification, making it easy to: • Build MCP clients that can connect to any MCP server • Create MCP servers that expose resources, prompts and tools • Use standard transports like stdio and HTTP • Handle all MCP protocol messages and lifecycle events This SDK began as a PHP port of the official Python SDK for the Model Context Protocol. It has since been expanded to fully support MCP using native PHP functions, helping to maximize compatibility with most standard web hosting environments. This SDK is primarily targeted at developers working on frontier AI integration solutions. Some functionality may be incomplete and implementations should undergo thorough testing and security review by experienced developers prior to production use. Installation You can install the package via composer: Requirements • PHP 8.1 or higher • ext-curl • ext-json • ext-pcntl (optional, recommended for CLI environments) • monolog/monolog (optional, used by example clients/servers for logging) Basic Usage Creating an MCP Server For detailed documentation and examples of MCP servers, see the Server Development Guide. Here's a complete example of an MCP server that provides a simple tool: Save this as Creating an MCP Client Here's how to create a client that connects to the example server and calls the addition tool: Save this as and run it: Advanced Examples The "examples" directory includes additional clients and servers for both the STDIO and HTTP transports. All examples are designed to run in the same directory where you installed the SDK. Some examples use monolog for logging, which can be installed via composer: MCP Web Client The "webclient" directory includes a web-based application for testing MCP servers. It was designed to demonstrate a MCP client capable of running in a typical web hosting environment. Setting Up The Web Client To setup the web client, upload the contents of "webclient" to a web directory, such as public_html on a cPanel server. Ensure that the MCP SDK for PHP is installed in that same directory by running the Composer command found in the Installation section of this README. Using The Web Client Once the web client has been uploaded to a web directory, navigate to index.php to open the interface. To connect to the included MCP test server, enter in the Command field and in the Arguments field and click . The interface allows you to test Prompts, Tools, and Resources. There is also a Debug Panel allowing you to view the JSON-RPC messages being sent between the Client and Server. Web Client Notes And Limitations This MCP Web Client is intended for developers to test MCP servers, and it is not recommended to be made publicly accessible as a web interface without additional testing for security, error handling, and resource management. OAuth Authorization The HTTP server transport includes optional OAuth 2.1 support. For more details see the OAuth Authentication Example. Documentation For detailed information about the Model Context Protocol, visit the official documentation. Latest Updates The SDK is currently aiming to support the 2025-11-25 revision of the MCP Spec. Implemented • Structured tool output • New metadata such as icons • Experimental support for tasks Partial Implementation or In Development • Elicitation Credits This PHP SDK was developed by: • Josh Abbott • Claude 3.5 Sonnet • Claude Opus 4.5 Additional debugging and refactoring done by Josh Abbott using OpenAI ChatGPT o1 pro mode and OpenAI Codex. Special acknowledgement to Roman Pronskiy for simplifying the server building process with his convenience wrapper project: https://github.com/pronskiy/mcp • — adapted from • — adapted from License The MIT License (MIT). Please see License File for more information.