Skip to content

Add MCP (Model Context Protocol) experiment#152

Draft
Jameswlepage wants to merge 5 commits intoWordPress:developfrom
Jameswlepage:feature/mcp
Draft

Add MCP (Model Context Protocol) experiment#152
Jameswlepage wants to merge 5 commits intoWordPress:developfrom
Jameswlepage:feature/mcp

Conversation

@Jameswlepage
Copy link
Contributor

@Jameswlepage Jameswlepage commented Dec 19, 2025

CleanShot 2025-12-19 at 11 45 11@2x

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

  • MCP Server Management: Configure multiple MCP servers with customizable routes and transport options
  • Tool Discovery: Automatically expose WordPress abilities as MCP tools
  • Admin Dashboard: Full React-based admin UI for server configuration and monitoring
  • Client Configuration: Auto-generate config snippets for Claude Desktop, Cursor, Windsurf, VS Code, and JetBrains IDEs
  • Connection Testing: Built-in endpoint testing to verify server connectivity

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 DataViews
  • docs/experiments/mcp.md - Documentation

Test plan

  • Enable the MCP experiment in AI settings
  • Navigate to the MCP admin page
  • Verify server status shows as "Running"
  • Enable/disable specific tools via the tools table
  • Copy a client configuration and test in Claude Desktop or Cursor
  • Use the "Test connection" feature to verify endpoint
Open WordPress Playground Preview

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
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 0.90498% with 657 lines in your changes missing coverage. Please review.
✅ Project coverage is 38.28%. Comparing base (1351969) to head (0bb4efe).
⚠️ Report is 3 commits behind head on develop.

Files with missing lines Patch % Lines
includes/Experiments/MCP/Manager.php 0.00% 463 Missing ⚠️
includes/Experiments/MCP/REST/MCP_Controller.php 0.00% 126 Missing ⚠️
includes/Experiments/MCP/Admin_Page.php 0.00% 54 Missing ⚠️
includes/Experiments/MCP/MCP.php 26.31% 14 Missing ⚠️
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     
Flag Coverage Δ
unit 38.28% <0.90%> (-12.53%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jeffpaul
Copy link
Member

@jeffpaul
Copy link
Member

  • Reminder for us to add a screenshot gif and entry in the readme.txt for this feature before merging/releasing.

@JasonTheAdams JasonTheAdams removed their request for review December 21, 2025 05:59
@jeffpaul jeffpaul moved this from Needs review to In discussion / Needs decision in WordPress AI Planning & Roadmap Jan 7, 2026
@jeffpaul jeffpaul modified the milestones: 0.2.0, 0.3.0 Jan 7, 2026
@jeffpaul jeffpaul modified the milestones: 0.3.0, 0.4.0, Future Release Feb 3, 2026
@jeffpaul jeffpaul linked an issue Feb 9, 2026 that may be closed by this pull request
5 tasks
@raftaar1191
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP usage across features and request routing

5 participants