A WordPress plugin that demonstrates the WordPress Abilities API with various example abilities. This plugin provides a practical reference implementation and testing interface for developers working with the Abilities API.
The WP Abilities API Demo plugin showcases how to register and use abilities through the WordPress Abilities API. It includes several working examples and an admin interface for testing abilities directly from the WordPress dashboard.
- Site Information Retrieval - Get details about your WordPress installation
- Plugin Listing - Retrieve a list of all installed plugins
- Debug Log Management - Read and clear WordPress debug logs
- Post Creation - Create new blog posts programmatically
- Security Checking - Run security checks using the Plugin Check plugin
- Admin Testing Interface - User-friendly interface to test all registered abilities
- WordPress (latest version recommended)
- PHP 8.3.6 or higher
- Composer (for plugin dependencies)
- Plugin Check plugin (for plugin checking ability)
-
Download or clone this repository to your WordPress plugins directory:
cd wp-content/plugins/ git clone https://github.com/jonathanbossenger/wp-abilities-api-demo.git -
Install dependencies using Composer:
cd wp-abilities-api-demo composer install -
Activate the plugin through the WordPress admin interface or via WP-CLI:
wp plugin activate wp-abilities-api-demo
Once activated, access the demo interface from your WordPress admin:
- Navigate to Tools → Abilities API Demo
- Select an ability from the interface
- Provide any required input parameters
- Execute the ability and view the results
The abilities demonstrated in this plugin can be converted into MCP (Model Context Protocol) tools for use with MCP-enabled AI applications and agents. This allows you to integrate WordPress functionality directly into AI assistants like Claude, Copilot, and other MCP-compatible tools.
To learn how to convert WordPress abilities into MCP tools, check out the WP MCP Server Demo repository. This companion project demonstrates:
- How to create an MCP server that exposes WordPress abilities as tools
- Converting ability schemas into MCP tool definitions
- Integrating WordPress capabilities with AI assistants
- Example implementations for common WordPress operations
This integration enables AI agents to interact with your WordPress site programmatically, opening up possibilities for AI-assisted content management, site administration, and custom workflows.
Certain abilities in this plugin are automatically exposed as MCP tools when the WP MCP Server Demo plugin is activated. These abilities are marked for automatic exposure through MCP metadata configuration in their registration.
How It Works
Abilities are enabled for automatic MCP exposure by including specific metadata in their registration:
'meta' => array(
'show_in_rest' => true,
'mcp' => array(
'public' => true,
'type' => 'tool'
),
)When an ability includes 'mcp' => array( 'public' => true ) in its meta configuration, the WP MCP Server Demo plugin automatically registers it as an available tool that MCP-enabled AI applications can discover and use.
Auto-Exposed Abilities
The following abilities are configured for automatic MCP exposure:
- Site Info (
site/site-info) - Retrieve comprehensive WordPress site information - Get Plugins (
plugins/get-plugins) - List all installed plugins with details - Read Debug Log (
debug/read-log) - View contents of the WordPress debug log - Clear Debug Log (
debug/clear-log) - Clear the WordPress debug log file
These abilities can be immediately used by AI agents when both this plugin and the WP MCP Server Demo plugin are activated, without requiring any additional configuration.
Returns comprehensive information about your WordPress site including:
- Site name and URL
- Active theme
- Active plugins
- PHP version
- WordPress version
Retrieves a list of all installed plugins with their status and details.
- Read Log: View the contents of the WordPress debug log
- Clear Log: Clear the debug log file
Create a new blog post with specified title, content, and status (draft or publish).
Input Parameters:
title(required): The post titlecontent(required): Post content in block editor markupstatus(optional): Eitherdraftorpublish(defaults todraft)
Run security checks on your WordPress installation using the Plugin Check plugin.
We welcome contributions! Here are some ways you can help improve this plugin:
- Create a new file in the
includes/directory (e.g.,ability-your-feature.php) - Register your ability using the Abilities API:
add_action( 'wp_abilities_api_init', function() { wp_register_ability( 'category/ability-name', array( 'label' => __( 'Your Ability Name', 'wp-abilities-api-demo' ), 'description' => __( 'Description of what it does', 'wp-abilities-api-demo' ), 'category' => 'abilities-api-demo', 'input_schema' => array( /* ... */ ), 'output_schema' => array( /* ... */ ), 'execute_callback' => 'your_callback_function', 'permission_callback' => function() { return current_user_can( 'manage_options' ); }, 'meta' => array( 'show_in_rest' => true ) )); });
- Include your new file in
wp-abilities-api-demo.php - Submit a pull request with your addition
- Improve Documentation: Help make the docs clearer or add examples
- Report Bugs: Open an issue if you find any problems
- Enhance the Admin Interface: Improve the testing UI
- Add Tests: Help us build a test suite
- Code Quality: Improve code standards compliance
This project follows WordPress Coding Standards. To check your code:
composer install
vendor/bin/phpcs --standard=WordPress --extensions=php wp-abilities-api-demo.php includes/ admin/Auto-fix violations where possible:
vendor/bin/phpcbf --standard=WordPress --extensions=php wp-abilities-api-demo.php includes/ admin/Enable debug logging by defining the constant in wp-config.php:
define( 'WP_ABILITIES_API_DEMO_DEBUG', true );wp-abilities-api-demo/
├── admin/ # Admin interface
│ └── abilities-demo-page.php
├── assets/
│ ├── css/
│ │ └── admin.css # Admin page styles
│ └── js/
│ └── admin.js # JavaScript for testing abilities
├── includes/ # Ability implementations
│ ├── category-abilities-api-demo.php
│ ├── ability-site-info.php
│ ├── ability-get-plugins.php
│ ├── ability-debug-log.php
│ ├── ability-create-post.php
│ └── ability-check-security.php
└── wp-abilities-api-demo.php # Main plugin file
GPL-2.0-or-later
Jonathan Bossenger - [email protected]
Built with the WordPress Abilities API.