Reference
AiCommand
class
The AiCommand
class registers CLI command for WP-CLI. It is a WP-CLI command handler designed to integrate AI capabilities within WordPress. It connects AI-driven services with WP-CLI using the MCP (Multi-Client Processor) architecture, allowing AI models to:
- Access resources (e.g., WordPress posts, users, products).
- Call AI-powered tools (e.g., image generation, event lookup).
- Execute AI-generated functions dynamically.
Methods
Name | Return Type | Description |
---|---|---|
AiCommand::__invoke() | void | Executes AI-driven WP-CLI commands. |
AiCommand::register_tools( $server ) | void | Registers AI-powered tools in MCP. |
AiCommand::register_resources( $server ) | void | Registers data resources (e.g., users, products). |
Client
class
The Client
class is a core component of the MCP for WordPress implementation and is a small wrapper around the MCP PHP SDK.
It allows connecting to different MCP servers via local commands, PHP, or HTTP.
Methods
Name | Return Type | Description |
---|---|---|
Client::__construct() | Constructor | |
Client::connect() | ClientSession | Connects to the server and returns a session instance. |