__( 'MCP Access', 'ai' ), 'description' => __( 'Control which abilities are exposed to AI agents over the Model Context Protocol. Enabling this experiment installs and activates the MCP Adapter plugin if it is not already active; ability exposure choices apply only while the experiment is enabled.', 'ai' ), 'category' => Experiment_Category::ADMIN, 'capability' => 'none', 'usage' => array( 'trigger' => 'none', 'runs' => __( 'When an authorized MCP client lists or runs an exposed ability', 'ai' ), 'sends' => __( 'Nothing itself, but MCP clients can run exposed abilities that call your AI provider, such as Title Generation', 'ai' ), 'details' => __( 'Exposes this plugin\'s enabled abilities over MCP by default, and installs and activates the MCP Adapter plugin from WordPress.org', 'ai' ), ), ); } /** * {@inheritDoc} */ public function register(): void { add_filter( 'wp_register_ability_args', array( Exposure_Overrides::class, 'filter_ability_args' ), 100, 2 ); add_action( 'rest_api_init', array( $this, 'register_rest_routes' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) ); $admin_page = new Admin_Page(); $admin_page->init(); $installer = new Plugin_Installer(); $installer->init(); } /** * Registers the settings REST routes. * * @since 1.5.0 */ public function register_rest_routes(): void { ( new Settings_Controller() )->register_routes(); } /** * Enqueues the MCP Access screen assets. * * @since 1.5.0 * * @param string $hook_suffix The current admin page hook suffix. */ public function enqueue_assets( string $hook_suffix ): void { if ( 'tools_page_' . Admin_Page::PAGE_SLUG !== $hook_suffix ) { return; } Asset_Loader::enqueue_dataviews_style(); Asset_Loader::enqueue_script( 'mcp_adapter', 'experiments/mcp-adapter' ); Asset_Loader::enqueue_style( 'mcp_adapter', 'experiments/mcp-adapter' ); } }