=== Enable Abilities for MCP === Contributors: fabiomontenegro1987 Donate link: https://paypal.me/fabiomontenegroz Tags: mcp, ai, rest-api, content-management, woocommerce Requires at least: 6.9 Tested up to: 7.0 Requires PHP: 8.0 Stable tag: 2.0.16 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Manage which WordPress Abilities are exposed to MCP servers. Supports WooCommerce, The Events Calendar, and any custom post type. == Description == **Enable Abilities for MCP** gives you full control over which WordPress Abilities are available to AI assistants through the MCP (Model Context Protocol) Adapter. WordPress 6.9 introduced the Abilities API, allowing external tools to discover and execute actions on your site. This plugin extends that functionality by registering a comprehensive set of content management abilities and providing a simple admin interface to toggle each one on or off. = Features = * **58 abilities** organized in 13 categories: Core, Read, Write, SEO (Rank Math), SEO (SEOPress), SEO (Yoast), Utility, Multilanguage, Custom Post Types, WooCommerce, The Events Calendar, Code Snippets, and JetEngine Options Pages * **WooCommerce integration** — dedicated abilities to manage products, orders, and customers using the native WooCommerce API (HPOS-compatible, formally declared) * **The Events Calendar integration** — list, get, create, and update events with venue, organizer, and date filters * **Admin dashboard** with toggle switches for each ability * **Per-ability control** — expose only what you need * **Secure by design** — proper capability checks, input sanitization, and per-post permission validation * **WPCS compliant** — fully passes WordPress Coding Standards (phpcs) * **MCP-ready** — all abilities include `show_in_rest` and `mcp.public` metadata = Available Abilities = **Read (safe, query-only):** * Get posts with filters (status, category, tag, search) * Get single post details (content, SEO meta, featured image) * Get categories, tags, pages, comments, media, and users **Write (create & modify):** * Create, update, and delete posts * Create categories and tags * Create pages * Moderate comments * Reply to comments as the authenticated user * Upload images from external URLs to the media library (with optional auto-assign as featured image) **SEO — Rank Math:** * Get full Rank Math metadata for any post/page (title, description, keywords, robots, Open Graph, SEO score) * Update Rank Math metadata: SEO title, description, focus keyword, canonical URL, robots, Open Graph, primary category, pillar content **SEO — SEOPress:** * Get full SEOPress metadata for any post/page (title, description, focus keyword, robots, canonical, Open Graph, Twitter Card) * Update SEOPress metadata: SEO title, description, focus keyword, canonical URL, robots directives, Open Graph, Twitter Card **SEO — Yoast SEO:** * Get full Yoast SEO metadata for any post/page (title, description, focus keyphrase, canonical, robots, Open Graph, Twitter Card) * Update Yoast SEO metadata: SEO title, description, focus keyphrase, canonical URL, robots (noindex, nofollow, advanced), Open Graph, Twitter Card * Get Yoast sitemap index — fetch and parse the sitemap index, returning all registered sitemap URLs with last modification date **Custom Post Types:** * List all registered custom post types with configuration and taxonomies * Get items from any CPT with filtering, search, and taxonomy queries * Get full details of a CPT item including all meta fields (WooCommerce, ACF, JetEngine, etc.) * Create, update, and delete CPT items with taxonomy and meta field support * Get CPT taxonomies with their terms * Assign taxonomy terms to CPT items **WooCommerce:** * List products with price, SKU, stock status, categories, and type * Get full product detail including gallery, attributes, and variations * Update product price, sale price, stock quantity, and status * List orders with customer, total, status, and date (HPOS-compatible) * Get full order detail: line items, billing/shipping, totals, and notes * Update order status with optional note * List customers with email, name, total spent, and order count **The Events Calendar:** * List events with start/end date, venue, organizer, and date range filter * Get full event detail with resolved venue address and organizer contact * Create new events with title, description, dates, venue, and organizer * Update existing events **Utility:** * Search and replace text in post content * Site statistics overview (includes custom post type counts) * Update any post meta field by exact key (with protected internal key blocklist) = Requirements = * WordPress 6.9 or later (Abilities API) * MCP Adapter plugin installed and configured * PHP 8.0 or later == Installation == 1. In your WordPress dashboard, go to **Plugins > Add New** and search for **Enable Abilities for MCP**. 2. Click **Install Now**, then **Activate**. 3. Go to **Settings > WP Abilities** to manage which abilities are active. 4. Install and configure the [MCP Adapter](https://github.com/WordPress/mcp-adapter/releases) plugin to connect with AI assistants. == Frequently Asked Questions == = Do I need anything else for this plugin to work? = Yes. This plugin requires WordPress 6.9+ (which includes the Abilities API) and the MCP Adapter plugin to connect abilities with AI assistants like Claude. = Are all abilities enabled by default? = Yes. On first activation, all abilities are enabled. You can disable any of them from **Settings > WP Abilities**. = Is it safe to enable write abilities? = Write abilities respect WordPress capabilities. For example, creating a post requires the `publish_posts` capability, and editing checks per-post permissions. The MCP user must have the appropriate WordPress role. = Does it work on Multisite? = Yes. The plugin can be network-activated. Each site in the network has its own ability configuration. = Does it work with WooCommerce? = Yes. The Custom Post Types section automatically detects WooCommerce products, orders, coupons, and any other registered post type. You can list, create, update, and delete items with full access to WooCommerce meta fields like `_price`, `_sku`, `_stock_status`, `_regular_price`, and more. = Can I add custom abilities? = This plugin registers abilities using the standard `wp_register_ability()` API. You can register additional abilities in your own plugin using the `wp_abilities_api_init` hook. == Screenshots == 1. Admin settings page showing all abilities organized by category with toggle switches. == Changelog == = 2.0.16 = * Fix: `ewpa_authenticate_api_key()` now uses a static re-entry guard (`$resolving`) to prevent infinite recursion when `user_can()` inside `ewpa_validate_api_key()` triggers `map_meta_cap`. Plugins like Yoast SEO hook `map_meta_cap` and call `wp_get_current_user()` from within it, re-entering the `determine_current_user` filter and causing unbounded recursion (PHP fatal / HTTP 500). Reproduced with Yoast SEO + WPML String Translation active. = 2.0.15 = * Enhancement: `ewpa/je-update-options-page-field` now supports repeater fields — pass an array of row objects where each key matches a sub-field name. `ewpa/je-get-options-page` now returns `repeater_fields` (name, title, type) for repeater fields so the AI can inspect the expected row structure before writing. = 2.0.14 = * New: JetEngine Options Pages section (3 abilities) — `ewpa/je-list-options-pages` lists all registered options pages with their field schema; `ewpa/je-get-options-page` returns field values for a given slug; `ewpa/je-update-options-page-field` writes a single field value with blocklist protection (html, tab, accordion, endpoint types are blocked). Both list and get abilities are enabled by default; update is off by default. Requires JetEngine with the Options Pages module enabled. * Fix: `ewpa_register_ability_with_log()` wrapper closure now uses `$input = null` (optional parameter) so abilities without an `input_schema` are not broken by PHP 8.4's `ArgumentCountError` when `WP_Ability::invoke_callback()` calls them with zero arguments. * Updated: Total abilities: 58 in 13 categories = 2.0.13 = * Fix: `ewpa/update-post`, `ewpa/create-post`, `ewpa/create-page`, `ewpa/create-cpt-item`, `ewpa/update-cpt-item`, `ewpa/search-replace`, and `ewpa/tec-update-event` now use `wp_slash()` instead of `wp_kses_post()` on post content before passing to `wp_insert_post()` / `wp_update_post()`. This prevents double-unslashing that corrupted JSON Unicode escapes (e.g. `<` → `u003c`) in Gutenberg block attributes such as Yoast FAQ questions. KSES is now applied by WordPress via the `content_save_pre` filter, which correctly respects `unfiltered_html` capability — allowing admins to save `