Add MCP (Model Context Protocol) experiment#152
Add MCP (Model Context Protocol) experiment#152Jameswlepage wants to merge 5 commits intoWordPress:developfrom
Conversation
Adds MCP server integration for WordPress: - Expose WordPress capabilities to AI assistants - REST API for MCP tool discovery - Admin UI for server configuration and testing
- Remove constructor property promotion (PHP 7.4 compatibility) - Use early exit pattern for cleaner code flow - Fix use statement alphabetical ordering - Remove unused imports - Replace short ternaries with full ternaries - Add phpcs:ignore for intentional timeout setting
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #152 +/- ##
==============================================
- Coverage 50.80% 38.28% -12.53%
- Complexity 375 513 +138
==============================================
Files 27 31 +4
Lines 1978 2641 +663
==============================================
+ Hits 1005 1011 +6
- Misses 973 1630 +657
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive MCP (Model Context Protocol) experiment that enables AI assistants like Claude Desktop, Cursor, and VS Code to interact with WordPress capabilities via the Model Context Protocol. The implementation includes a full-stack solution with PHP backend management, React-based admin UI, REST API endpoints, and extensive configuration options.
Key Changes:
- Full MCP server management system with multi-server support and configurable routes
- React-based admin dashboard with DataViews for managing exposed abilities and server configuration
- REST API controller for server CRUD operations, tool management, and connection testing
- Auto-generated client configuration templates for popular MCP clients
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
webpack.config.js |
Adds entry point for admin/mcp-server bundle |
src/admin/mcp-server/types.ts |
TypeScript type definitions for MCP UI state |
src/admin/mcp-server/index.tsx |
Main React app component with state management |
src/admin/mcp-server/components/*.tsx |
React components for UI features (tools table, config generator, status cards) |
src/admin/mcp-server/style.scss |
Component styles and layout definitions |
src/admin/hooks/usePersistedView.ts |
Hook for persisting DataViews state |
src/admin/components/icons/*.tsx |
Provider icon components (AI, Anthropic, Google, etc.) |
src/admin/components/provider-icons.tsx |
Icon lookup utility |
src/admin/_dataviews.scss |
DataViews styling overrides |
src/admin/_common.scss |
Common admin page styles |
includes/Experiments/MCP/Manager.php |
Core PHP manager for MCP configuration and server lifecycle |
includes/Experiments/MCP/REST/MCP_Controller.php |
REST API endpoints for MCP operations |
includes/Experiments/MCP/Admin_Page.php |
Admin page registration and asset enqueuing |
includes/Experiments/MCP/MCP.php |
Experiment entry point and registration |
includes/Experiment_Loader.php |
Registers MCP experiment in loader |
docs/experiments/mcp.md |
Comprehensive documentation for the MCP experiment |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@Jameswlepage can you add tests here like was done in https://github.com/WordPress/ai/pull/147/changes#diff-0cf348eda48cae411ad9d44a2e5b449603a971f2313b0a849893ff4cf8280c46? |
|
|
I think this functionality belongs in the MCP Adapter plugin itself rather than the AI Experiments plugin. Since it is MCP-specific behavior, keeping it within the adapter would maintain clearer separation of concerns and ensure the adapter remains the canonical place for MCP-related logic. |
|
Multi-server support with auto-exposing abilities as tools is exactly the right architecture. Good to see this taking shape. I registered 100+ tools as WordPress Abilities in Respira (page builder editing over MCP) and ran into a few things that may be relevant here: Schema serialization gotcha. When Annotation hints matter for tool selection. With 100+ tools exposed, AI clients use Multisite context switching. On multisite, abilities registered on the main site need a way to execute against a different blog. I wrap every The client config generation is something I'd benefit from directly - I built my own config endpoint and the format alignment would be useful. Happy to share my registration and adapter integration code if any of it is useful reference for this PR. |
Summary
Adds MCP server integration for WordPress, enabling AI assistants like Claude Desktop, Cursor, and VS Code to interact with WordPress capabilities via the Model Context Protocol.
Addresses #37
Features
Related
See also #63 (Abilities Explorer) - the MCP admin UI and Abilities Explorer share similar concepts around displaying and managing WordPress abilities. Future work could explore sharing components or patterns between them.
Changes
includes/Experiments/MCP/- PHP backend (Manager, Admin_Page, REST controller)src/admin/mcp-server/- React admin UI with DataViewsdocs/experiments/mcp.md- DocumentationTest plan