MCP Adapter

This is part of the AI Building Blocks for WordPress initiative. The main projects are PHP AI Client SDKPHP AI Client SDK A platform-agnostic library providing unified access to LLMs and embedding models from any major AI provider. Developed collaboratively with the PHP community. The WordPress AI Client SDK is the WordPress-specific package that adds REST API endpoints, API key management, and integrations through `AI_Client::prompt()`., Abilities APIAbilities API A core WordPress API (introduced in 6.9) that creates a central registry of capabilities, making WordPress functions discoverable and accessible to AI agents, automation tools, and developers. Transforms WordPress from isolated functions into a unified system., MCP AdapterMCP Adapter Translates WordPress abilities into Model Context Protocol format, allowing AI assistants like Claude and ChatGPT to discover and invoke WordPress capabilities as tools, resources, and prompts., and the AI Experiments PluginAI Experiments Plugin WordPress's AI laboratory bringing all building blocks together. Serves as both a user tool and developer reference implementation. First release (v0.1.0) includes Title Generation experiment..

Introduction

Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to LLMs. In WordPress, the MCP Adapter (GitHub) implements this open standard, exposing Abilities to AI assistants, while also connecting to other MCP servers.

MCP’s applications are transformative for various users. Content creators can manage their WordPress sites conversationally, while developers can automate complex workflows across systems. Agencies can build sophisticated integrations, from content migrationMigration Moving the code, database and media files for a website site from one server to another. Most typically done when changing hosting companies. to performance optimization.

Consider a typical workflow: an AI assistant receives a request to publish a blog post. Through MCP, it can research topics using external tools, generate content, create images, optimize for SEO, and schedule publication. This entire process happens via natural conversation, respecting permissions and requiring approval when configured.

Two-Way Communication

WordPress can operate as both an MCP serverMCP Server Exposes tools, resources, and prompts according to Model Context Protocol specification. WordPress can run multiple MCP servers with different configurations. and client, exposing its functionality and connecting to other tools within the MCP ecosystem. This bidirectional functionality allows major AI applications and assistants to discover and directly execute actions on your WordPress site.

As an MCP server, WordPress makes its capabilities registered via the Abilities API available as MCP tools and resources. AI assistants can discover, understand, and execute actions like creating posts, managing media, and moderating comments, all through the standardized protocol.

As an MCP clientMCP Client AI agents, IDEs, or assistants that connect to MCP servers to access capabilities., WordPress can integrate with other MCP servers. Your site (though an embedded Agent, REST API, WP-CLI, PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. https://www.php.net/manual/en/preface.php. functions…) could leverage AI writing tools for content, specialized services for data analysis, or project management systems, becoming an active participant in a network of interconnected capabilities.

To start, we will focus on building the server side of the MCP Adapter.

Flexible Transport and Security

As an MCP server, WordPress supports the Streamable HTTPHTTP HTTP is an acronym for Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands. transport via the existing REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/. as well as the stdio transport via WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/. This ensures compatibility with the wider MCP ecosystem and enables compatibility with local development.

For security, the MCP adapter will leverage the built-in application password mechanism for authentication and the capabilities system for granular authorization. When acting as a MCP Client, we plan for WordPress to implement common user approval controls.

Building for Tomorrow

MCP is a rapidly evolving protocol. The WordPress MCP implementation is designed for adaptability, ensuring it can accommodate future changes and emerging standards. This is achieved through the underlying Abilities API, which represents WordPress functionality in a standard-agnostic way. The MCP adapter translates this functionality into MCP’s format, but other adapters could be developed for different protocols as they emerge.

This approach future-proofs WordPress for an AI-driven world. It allows for quick adaptation to new AI systems and protocols without requiring a restructuring of coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. functionality.

Getting Started

The MCP Adapter requires the Abilities API to expose WordPress functionality and works seamlessly with the PHP Client SDK and AI Experiments Plugin. Whether you’re connecting your site to AI assistants, building AI-powered applications, or contributing to development, join us in #core-ai on SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. or explore the MCP adapter code.

The future of WordPress is one where sites and AI assistants work together as partners. The MCP Adapter is making that future possible today.

#ai-building-blocks