-
Notifications
You must be signed in to change notification settings - Fork 827
Add MCP (Model Context Protocol) package #45108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 1 file.
Full summary · PHP report · JS report Coverage check overridden by
I don't care about code coverage for this PR
|
projects/packages/mcp/src/AbilitiesRegistry/Traits/UserContextTrait.php
Outdated
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Outdated
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Outdated
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/Post/PostGetExecutor.php
Outdated
Show resolved
Hide resolved
projects/packages/mcp/src/AbilitiesRegistry/Executors/User/UserAchievementsExecutor.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about Jetpack's but generally speaking looks good to me.
I left a minor comment regarding the README.md and a thought: we will need to review these and make sure new abilities are included in here (like the one I am trying to add in 192057-ghe-Automattic/wpcom/files).
I can do the migration myself once we have this deployed and my PR is approved.
### Available Abilities | ||
|
||
The package includes these ability categories: | ||
|
||
- **User Abilities**: Profile, sites, achievements, connections, notifications, security, subscriptions | ||
- **Post Abilities**: Search, retrieval, and management | ||
- **Analytics Abilities**: Site statistics and metrics | ||
- **Example Abilities**: Templates for creating new abilities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a big fan of this information being included in READMEs which will quickly get outdated.
Saying that because I already added a "Comment" related a "SiteCommentsSearch" ability in a separate "Comment Abilities" category [192057-ghe-Automattic/wpcom/files].
- Port complete AbilitiesRegistry from wpcom-mcp to Jetpack - Update site settings endpoint to use Jetpack MCP package - Add comprehensive tests for AbilityRegistry functionality - Fix PHP 7.3 compatibility issues (remove typed properties) - Update namespaces from WpcomMcp to Jetpack - Fix text domain from wpcom-mcp to jetpack-mcp
- Add missing doc comments and parameter tags to AbilityRegistry methods - Add @throws tag to AbilityTrait method - Add missing doc comments to ExecutorFactory methods - Fix parameter comment formatting in ExecutorInterface - Fix ExampleUserSitesResourceAbility file naming and add file doc comment - Remove trailing whitespace in ExecutorFactory - Update namespaces from WpcomMcp to Jetpack
- Add missing parameter doc comment in AbilityRegistry get_resource_uri method - Fix trailing whitespace in ExecutorFactory - Add missing doc comments to UserSitesExecutor methods All tests still passing (17 tests, 95 assertions)
- Replace PHP 8.0+ union types (WP_Error|array) with PHPDoc annotations - Remove union type syntax from method signatures - Maintain type safety through PHPDoc comments - All tests still passing (17 tests, 95 assertions) This ensures compatibility with PHP 7.3+ while maintaining code quality.
- Add phpcs:ignore comments for unused parameters and variables - Fix isset() usage warnings by separating multiple argument checks - All methods maintain interface compatibility while suppressing warnings - All 42 files now pass linting with 0 errors and 0 warnings This ensures clean code standards while maintaining functionality.
- Remove unused Phan suppressions for standard WordPress functions - Add Phan suppressions for WordPress.com specific functions: * is_suspended(), should_check_confidentiality(), has_blog_sticker() * user_achieved(), user_achieved_feat(), get_achievement_extras() * notes_get(), wpcom_subs_get_wpcom_subscribers_of_blog() * get_user_attribute() - Add Phan suppressions for WordPress.com specific classes: * Notification_Settings::__construct(), get_user_attributes_for_notifications() * Notification_Settings::get_settings(), get_mobile_push_tokens_of_user() - Fix type safety issues: * Remove redundant object type check in format_notification() * Fix WP_Error foreach issue in UserConnectionsExecutor * Remove redundant array_values() call - Fix syntax errors and indentation issues - All files now pass PHPCS with 0 errors and 0 warnings
- Add Phan suppression for PhanTypeSuspiciousNonTraversableForeach - Suppress warning about WP_Error in foreach loop where we already check is_wp_error() - This is a false positive since we return early if is WP_Error - All Phan issues now completely resolved
- All Phan static analysis issues have been resolved - No suppressions needed in baseline - MCP package now passes all static analysis checks - This is the best possible outcome for code quality
- Initialize AbilitiesRegistry when package loads - Hook into abilities_api_init to register abilities dynamically - Only load for Automatticians on WordPress.com - Load abilities from configuration without hardcoded names - Package will now be active and register abilities when loaded
- Call init() directly in the action hook - Simplifies the initialization flow
- Add Phan suppression for is_automattician() function - Add Phan suppression for new object creation side effects - Fix PHPCS formatting for class closing brace
- Use anonymous function instead of class reference in add_action - Ensures class is autoloaded before init() is called - Fixes PHPCS formatting issues
- Add automattic/jetpack-mcp:@dev to composer.json - Regenerate autoloader to include MCP package - Package is now available for loading in Jetpack
8245a57
to
99c3b7c
Compare
Fixes https://linear.app/a8c/issue/AIINT-164/mcp-abilitieis-on-atomic
Proposed changes:
New Package:
packages/mcp
- Model Context Protocol implementation for JetpackWordPress/abilities-api
dependency - needed to register abilities - can be removed when available on core.Core Components:
AbilitiesRegistry
- Central registry for managing available abilitiesExecutors
- Handlers for specific functionality (User, Post, Analytics)Abilities
- Individual capability definitions and configurationsHelpers
- Utility classes for common operationsKey Features:
Purpose:
Enables AI models to interact with WordPress sites through a standardized protocol, providing secure and structured access to site data and functionality.
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: