PHP code example of pollora / mcp-connector

1. Go to this page and download the library: Download pollora/mcp-connector library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pollora / mcp-connector example snippets


define( 'WP_MCP_AUTOLOAD', false );

add_filter('mcp_connector_ability_groups', function (array $groups): array {
    $groups[] = new MyPluginAbilityGroup();

    return $groups;
});

use Pollora\Abilities\Domain\Model\Behaviour;
use Pollora\Abilities\Domain\Model\Input;
use Pollora\Abilities\Domain\Schema\SchemaBuilder;

AbilityDefinition::writing(
    slug: 'archive-post',
    label: __('Archive a post', 'my-plugin'),
    description: 'Moves a post out of the published set without deleting it.',
    category: AbilityCategory::Content,
    inputSchema: (new SchemaBuilder)
        ->integer('id', 'ID of the post to archive.',