Making WordPress.org

Changeset 14703


Ignore:
Timestamp:
03/12/2026 08:04:30 PM (4 weeks ago)
Author:
obenland
Message:

WordPress.org Abilities: Add plugin directory resources and prompts.

Register 6 MCP resources and 3 MCP prompts for the plugin directory
submission workflow. Resources pull content from developer.wordpress.org
(guidelines, FAQ, headers, readme standard) and the plugin-directory
plugin (reserved/trademarked slugs, Plugin Check guide). Prompts provide
guided workflows for preparing a plugin, running Plugin Check, and
addressing review feedback.

The MCP server now categorizes abilities by type (tool, resource, prompt)
and includes updated server instructions with authentication guidance.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities
Files:
14 added
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-autoloader.php

    r14660 r14703  
    77 * @package WordPressdotorg\Abilities
    88 */
     9
     10declare( strict_types = 1 );
    911
    1012namespace WordPressdotorg\Abilities\Autoloader;
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-mcp-server.php

    r14660 r14703  
    33 * MCP Server for WordPress.org.
    44 *
    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.
    66 *
    77 * @package WordPressdotorg\Abilities
    88 */
     9
     10declare( strict_types = 1 );
    911
    1012namespace WordPressdotorg\Abilities;
     
    3739     */
    3840    public static function register( McpAdapter $adapter ): void {
    39         $tools = self::get_wporg_ability_names();
     41        $components = self::get_wporg_components();
    4042
    41         if ( empty( $tools ) ) {
     43        if ( empty( $components['tools'] ) && empty( $components['resources'] ) && empty( $components['prompts'] ) ) {
    4244            return;
    4345        }
     
    4850            'wporg',
    4951            '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            ),
    5160            'v1.0.0',
    5261            array( HttpTransport::class ),
    5362            ErrorLogMcpErrorHandler::class,
    5463            NullMcpObservabilityHandler::class,
    55             $tools
     64            $components['tools'],
     65            $components['resources'],
     66            $components['prompts']
    5667        );
    5768    }
    5869
    5970    /**
    60      * Get all registered WordPress.org ability names.
     71     * Get all registered WordPress.org abilities categorized by MCP component type.
    6172     *
    62      * Discovers abilities by querying the WordPress ability registry
    63      * 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).
    6475     *
    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     * }
    6683     */
    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        );
    7091
    7192        foreach ( $abilities as $ability ) {
    7293            $name = $ability->get_name();
    7394
    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;
    76113            }
    77114        }
    78115
    79         return $tools;
     116        return $components;
    80117    }
    81118}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/class-registrar.php

    r14660 r14703  
    88 */
    99
     10declare( strict_types = 1 );
     11
    1012namespace WordPressdotorg\Abilities;
     13
     14use WordPressdotorg\Abilities\Plugins\Plugin_Directory;
    1115
    1216defined( 'ABSPATH' ) || exit;
     
    2933     */
    3034    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        );
    3142    }
    3243
     
    3546     */
    3647    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();
    3760    }
    3861}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-abilities/wporg-abilities.php

    r14660 r14703  
    1313 * @package WordPressdotorg\Abilities
    1414 */
     15
     16declare( strict_types = 1 );
    1517
    1618namespace WordPressdotorg\Abilities;
Note: See TracChangeset for help on using the changeset viewer.