feat: Add comprehensive demo plugin for MCP adapter (exploration)#33
Draft
Jameswlepage wants to merge 6 commits intotrunkfrom
Draft
feat: Add comprehensive demo plugin for MCP adapter (exploration)#33Jameswlepage wants to merge 6 commits intotrunkfrom
Jameswlepage wants to merge 6 commits intotrunkfrom
Conversation
- Add McpClient class for connecting to external MCP servers
- Extend McpAdapter to manage both servers and clients
- Auto-register remote MCP capabilities as WordPress abilities
- Support multiple authentication methods (Bearer, API Key, Basic)
- Maintain architectural consistency with existing server patterns
- Add comprehensive usage examples and documentation
Remote MCP tools, resources, and prompts become accessible as:
- mcp_{client_id}/tool-name
- mcp_{client_id}/resource/resource-name
- mcp_{client_id}/prompt/prompt-name
This enables WordPress to both serve and consume MCP capabilities,
creating a powerful bidirectional integration with the MCP ecosystem.
- Add functional MCP client that connects to WordPress Domains MCP server - Fix ability naming to comply with WordPress Abilities API requirements (lowercase, dashes only) - Register remote MCP tools as WordPress abilities with proper labels and schemas - Add admin interface showing connected clients and registered abilities - Create public WordPress abilities (get-site-info, get-posts, search-content, get-menu) - Handle MCP session management for different server types - Clean up verbose debug logging for production readiness - Remove prompt-to-ability conversion (prompts handled by MCP infrastructure)
Core MCP Adapter (minimal additions to trunk): - Add McpClient.php for connecting to external MCP servers - Add client support methods to McpAdapter.php - Add comprehensive test coverage for client functionality - Remove demo-specific functionality from core plugin Demo Plugin (new separate plugin): - Extract admin interface to demo/includes/Admin/ - Move examples to demo/examples/ - Create standalone demo plugin with proper dependency handling - Showcase MCP adapter usage without bloating core package wp-env Configuration: - Update to load both core adapter and demo plugin - Proper plugin load order with dependency management This creates a clean separation where the core adapter provides infrastructure while the demo showcases comprehensive usage patterns.
- Fix undefined constant WP_MCP_DEMO_DIR in demo autoloader - Remove invalid 'context' property from ability registration (not supported by Abilities API) - Clean up demo examples to be focused and practical - Resolve HTTP 500 errors in wp-env admin interface
- Add dashboard widget documentation to demo README - Update docs README with MCP client integration section - Enhance MCP client guide with implementation details and limitations - Include new dashboard widget files and assets in demo structure
Contributor
|
Thanks for exploring this, @Jameswlepage . For the questions on where things should live: Demo plugin — I think the AI Experiments plugin is the right home for this. It already serves as the place for showcasing AI integrations, so a demo that uses the MCP adapter fits naturally there. MCP Client — There's already https://github.com/Automattic/php-mcp-client, which we could either include directly in the MCP adapter or move under the WordPress GitHub org as a standalone package. I won't close this PR just yet as I want to keep it for reference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #32 - This PR will only show demo-specific changes after the core MCP client PR is merged.
This is an exploratory branch to demonstrate what a comprehensive demo plugin could look like. I'm uncertain about the best home for this demo code:
It's a pretty large draft PR because it includes both the core edition of client support and the demo plugin to allow for testing and review.
Summary
Demo Features
Questions for Review
This branch serves as a complete reference implementation while we decide on the best approach for demo/example code. The demo provides significant value for developers learning MCP integration patterns (and adds consumer functionality, which may be helpful for a MCP Canonical Plugin), but may create maintenance overhead if included in the core repository.