Download the PHP package wordpress/php-mcp-schema without Composer
On this page you can find all versions of the php package wordpress/php-mcp-schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wordpress/php-mcp-schema
More information about wordpress/php-mcp-schema
Files in wordpress/php-mcp-schema
Package php-mcp-schema
Short Description Exact-revision PHP schema runtime for the Model Context Protocol (MCP)
License GPL-2.0-or-later
Homepage https://github.com/WordPress/php-mcp-schema
Informations about the package php-mcp-schema
PHP MCP Schema
A PHP representation of the Model Context Protocol (MCP) schema types.
This package provides Data Transfer Objects (DTOs), Enums, and Unions that mirror the official MCP TypeScript schema. It is not an SDK, client, or server implementation; just the type definitions for building your own MCP-compatible applications in PHP.
Installation
Requires PHP 7.4 or higher.
Usage
Creating a Tool Definition
Serialization (toArray)
Convert a DTO to a plain array for JSON encoding:
Deserialization (fromArray)
Decode incoming JSON into a fully typed DTO:
Factory / Union Types
Use a factory to resolve polymorphic content blocks without knowing the concrete type up front:
JSON-RPC Messages
Construct a generic JSON-RPC request for any MCP method:
Available Types
Server Types (WP\McpSchema\Server\)
- Tools -
Tool,CallToolRequest,CallToolResult,ListToolsRequest,ListToolsResult - Resources -
Resource,ResourceTemplate,ReadResourceRequest,ReadResourceResult - Prompts -
Prompt,PromptMessage,GetPromptRequest,GetPromptResult - Logging -
LoggingMessageNotification,SetLevelRequest
Client Types (WP\McpSchema\Client\)
- Sampling -
CreateMessageRequest,CreateMessageResult,SamplingMessage - Elicitation -
ElicitRequest,ElicitResult - Roots -
ListRootsRequest,ListRootsResult,Root
Common Types (WP\McpSchema\Common\)
- Protocol -
InitializeRequest,InitializeResult,PingRequest - Content -
TextContent,ImageContent,AudioContent - JSON-RPC -
JSONRPCRequest,JSONRPCNotification,JSONRPCResultResponse,JSONRPCErrorResponse
Generator
The PHP code in src/ is auto-generated from the official MCP TypeScript schema. The generator is located in the generator/ directory and is not included in the Composer package.
See generator/README.md for setup and usage instructions.
License
GPL-2.0-or-later - see LICENSE.md for details.