Changeset 14703
- Timestamp:
- 03/12/2026 08:04:30 PM (4 weeks ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities
- Files:
-
- 14 added
- 4 edited
-
class-autoloader.php (modified) (1 diff)
-
class-mcp-server.php (modified) (3 diffs)
-
class-registrar.php (modified) (3 diffs)
-
plugins (added)
-
plugins/plugin-directory (added)
-
plugins/plugin-directory/class-resource-base.php (added)
-
plugins/plugin-directory/prompts (added)
-
plugins/plugin-directory/prompts/class-address-review-feedback.php (added)
-
plugins/plugin-directory/prompts/class-prepare-plugin.php (added)
-
plugins/plugin-directory/prompts/class-run-plugin-check.php (added)
-
plugins/plugin-directory/resources (added)
-
plugins/plugin-directory/resources/class-plugin-check-guide.php (added)
-
plugins/plugin-directory/resources/class-plugin-faq.php (added)
-
plugins/plugin-directory/resources/class-plugin-guidelines.php (added)
-
plugins/plugin-directory/resources/class-plugin-headers.php (added)
-
plugins/plugin-directory/resources/class-readme-standard.php (added)
-
plugins/plugin-directory/resources/class-reserved-slugs.php (added)
-
wporg-abilities.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-autoloader.php
r14660 r14703 7 7 * @package WordPressdotorg\Abilities 8 8 */ 9 10 declare( strict_types = 1 ); 9 11 10 12 namespace WordPressdotorg\Abilities\Autoloader; -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-mcp-server.php
r14660 r14703 3 3 * MCP Server for WordPress.org. 4 4 * 5 * Creates a custom MCP server that exposes all WordPress.org abilities as tools.5 * Creates a custom MCP server that exposes WordPress.org abilities as tools, resources, and prompts. 6 6 * 7 7 * @package WordPressdotorg\Abilities 8 8 */ 9 10 declare( strict_types = 1 ); 9 11 10 12 namespace WordPressdotorg\Abilities; … … 37 39 */ 38 40 public static function register( McpAdapter $adapter ): void { 39 $ tools = self::get_wporg_ability_names();41 $components = self::get_wporg_components(); 40 42 41 if ( empty( $ tools) ) {43 if ( empty( $components['tools'] ) && empty( $components['resources'] ) && empty( $components['prompts'] ) ) { 42 44 return; 43 45 } … … 48 50 'wporg', 49 51 'WordPress.org MCP Server', 50 'MCP server for WordPress.org services.', 52 implode( 53 "\n\n", 54 array( 55 'WordPress.org MCP Server — provides tools, resources, and prompts for interacting with WordPress.org services.', 56 'Use prompts/list to discover available workflows for specific tasks. Browse wporg://* resources for reference documentation.', 57 'All write operations require authentication via application password. To set up authentication, visit: https://login.wordpress.org/?action=authorize_application&app_id=c4c73a54-96d7-47b9-9bdc-1a66b9b04505', 58 ) 59 ), 51 60 'v1.0.0', 52 61 array( HttpTransport::class ), 53 62 ErrorLogMcpErrorHandler::class, 54 63 NullMcpObservabilityHandler::class, 55 $tools 64 $components['tools'], 65 $components['resources'], 66 $components['prompts'] 56 67 ); 57 68 } 58 69 59 70 /** 60 * Get all registered WordPress.org abilit y names.71 * Get all registered WordPress.org abilities categorized by MCP component type. 61 72 * 62 * Discovers abilities by querying the WordPress ability registry63 * for any ability whose name starts with 'wporg/'.73 * Discovers abilities whose name starts with 'wporg/' and categorizes them 74 * based on their meta['mcp']['type'] value: 'resource', 'prompt', or 'tool' (default). 64 75 * 65 * @return string[] Array of ability names. 76 * @return array { 77 * Abilities grouped by MCP component type. 78 * 79 * @type string[] $tools Tool ability names. 80 * @type string[] $resources Resource ability names. 81 * @type string[] $prompts Prompt ability names. 82 * } 66 83 */ 67 private static function get_wporg_ability_names(): array { 68 $abilities = wp_get_abilities(); 69 $tools = array(); 84 private static function get_wporg_components(): array { 85 $abilities = wp_get_abilities(); 86 $components = array( 87 'tools' => array(), 88 'resources' => array(), 89 'prompts' => array(), 90 ); 70 91 71 92 foreach ( $abilities as $ability ) { 72 93 $name = $ability->get_name(); 73 94 74 if ( str_starts_with( $name, 'wporg/' ) ) { 75 $tools[] = $name; 95 if ( ! str_starts_with( $name, 'wporg/' ) ) { 96 continue; 97 } 98 99 $meta = $ability->get_meta(); 100 $type = $meta['mcp']['type'] ?? 'tool'; 101 102 switch ( $type ) { 103 case 'resource': 104 $components['resources'][] = $name; 105 break; 106 case 'prompt': 107 $components['prompts'][] = $name; 108 break; 109 case 'tool': 110 default: 111 $components['tools'][] = $name; 112 break; 76 113 } 77 114 } 78 115 79 return $ tools;116 return $components; 80 117 } 81 118 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-registrar.php
r14660 r14703 8 8 */ 9 9 10 declare( strict_types = 1 ); 11 10 12 namespace WordPressdotorg\Abilities; 13 14 use WordPressdotorg\Abilities\Plugins\Plugin_Directory; 11 15 12 16 defined( 'ABSPATH' ) || exit; … … 29 33 */ 30 34 public static function register_categories(): void { 35 wp_register_ability_category( 36 'wporg-plugins-plugin-directory', 37 array( 38 'label' => 'Plugin Directory', 39 'description' => 'Tools, resources, and prompts for the WordPress.org plugin directory.', 40 ) 41 ); 31 42 } 32 43 … … 35 46 */ 36 47 public static function register_abilities(): void { 48 // Resources. 49 Plugin_Directory\Resources\Plugin_Guidelines::register(); 50 Plugin_Directory\Resources\Readme_Standard::register(); 51 Plugin_Directory\Resources\Plugin_Headers::register(); 52 Plugin_Directory\Resources\Reserved_Slugs::register(); 53 Plugin_Directory\Resources\Plugin_Check_Guide::register(); 54 Plugin_Directory\Resources\Plugin_FAQ::register(); 55 56 // Prompts. 57 Plugin_Directory\Prompts\Prepare_Plugin::register(); 58 Plugin_Directory\Prompts\Run_Plugin_Check::register(); 59 Plugin_Directory\Prompts\Address_Review_Feedback::register(); 37 60 } 38 61 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/wporg-abilities.php
r14660 r14703 13 13 * @package WordPressdotorg\Abilities 14 14 */ 15 16 declare( strict_types = 1 ); 15 17 16 18 namespace WordPressdotorg\Abilities;
Note: See TracChangeset
for help on using the changeset viewer.