Repository navigation
PoC: consume abilities via the wordpress-abilities package - #430
nikmclaughlin wants to merge 3 commits into
Conversation
Register the canonical `wordpress/abilities` package via Registrar::register_all() at plugin load, filter-gated by a new mcp_adapter_register_wordpress_abilities filter (default true for the PoC). The call passes no public_only argument: the Registrar's gate probes only the high-level meta.public, while MCP visibility resolves at the adapter layer via McpAbilityExposure (meta.mcp.public first, falling back to meta.public) — the media/terms abilities opt in through the MCP-specific flag alone. Package abilities surface through the default server's layered-discovery meta-tools; DefaultServerFactory is unchanged and tools/list stays at exactly the three meta-tools. The dependency is pinned to the open package PR branch (wordpress/abilities: dev-add/mcp-public-meta#00d65cf) until the team decides on meta.mcp.public and Packagist publishing. Gates: composer install (pin verified), npm run lint:php, npm run lint:php:stan, npm run test:php — all green.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## trunk #430 +/- ##
============================================
- Coverage 93.12% 93.10% -0.03%
- Complexity 1382 1383 +1
============================================
Files 59 59
Lines 4016 4018 +2
============================================
+ Hits 3740 3741 +1
- Misses 276 277 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
wordpress-abilities package
|
Small test coverage gap in That weakens the registration, discovery and opt-in/out assertions using this constant. The separate checks of |
| "repositories": [ | ||
| { | ||
| "type": "vcs", | ||
| "url": "https://github.com/nikmclaughlin/wordpress-abilities.git" |
There was a problem hiding this comment.
Should we update to https://github.com/WordPress/abilities?
Summary
This PoC proves the pattern of using a central provider package for consuming WP Abilities to expose as tools via MCP, instead of authoring abilities directly in this plugin. It is⚠️ not intended to be merged ⚠️ , and instead serves as a basis for discussion and iteration on that pattern before the proposed package (currently under personal ownership: https://github.com/nikmclaughlin/wordpress-abilities ) can be migrated to proper
WordpPress/GH ownership.The proposed package's 18 canonical abilities are registered with the WP Abilities API via a new
Registrar::register_all()(filter-gated inMcpAdapter::instance()) and exposed through the default MCP server's layered discovery design, thereby making them accessible to MCP clients.Why?
As outlined in #402, the MCP Adapter needs a set of Abilities for interacting with core WP entities (posts, users, media, etc.) so it can expose those as tools that enable WordPress site management through agentic workflows.
Providing those abilities from a central provider package:
Once the consumption pattern has been validated, the provider package is intended for migration to the
WordPressGH org, at which point a separate PR can be cut to use those abilities in production. To clarify, that means that this PR deliberately does not close #426. That issue stays open through roadmap steps 3–4, and this PoC is a design-feedback draft, not a merge candidate.How?
wordpress-abilitiesdependency added tocomposer.json, pinned to an open PR that adds some missing meta flags so all 18 abilities are exposed via MCP (details below). The package includes its own optional autoloader, but MCP Adapter can continue using Jetpack Autoloader without issue.McpAdapter::instance(), immediately after thewp_abilities_api_initsubscription:McpAbilityExposure, preserving its default-secure, explicit-opt-in model.Not in scope
docs/guides/default-server.md, layered discovery is the intended design;tool-type abilities intentionally don't auto-discover intotools/list. The PoC's regression test pinstools/listat exactly the 3 meta-tools to ensure packaged abilities don't leak into context prematurely.Use of AI tools
Tool(s):
Goose(agent) for planning and implementation.Models (via Ollama cloud):
GLM 5.3for planning and orchestration,GLM 5.3 Flashfor implementation, validation, and testing.Testing Instructions
Automated checks (all green on this branch)
Run from the repo root:
The new coverage lives in
tests/phpunit/Integration/WordpressAbilitiesConsumptionTest.php(13 cases). It pins: all 18 package abilities register with provenance; thecontent/mediacategories declare without backfill;tools/liststays at exactly the 3 meta-tools; discovery →get-ability-info→execute-abilitywork through the meta-tools; exposure resolves 10 abilities viameta.publicand 8 viameta.mcp.publicthroughMcpAbilityExposure; themcp_adapter_register_wordpress_abilitiesopt-out filter yields zero package registrations with the adapter trio intact; and registration is idempotent (no duplicates, no_doing_it_wrongnotices).Manual end-to-end (validated live on both environments)
Stable WordPress (the adapter's test env):
npm run wp-env:start.tools/liston the default server — it should return exactly the three meta-tools (mcp-adapter-discover-abilities,mcp-adapter-get-ability-info,mcp-adapter-execute-ability) and nothing else.discover-abilities— all 18 package abilities appear, each with label + descriptionget-ability-infoforcore/content-create— it returns the ability's full input/output schema plus its meta.execute-abilitywithcore/content-createas an admin — the call returnssuccess: true, the post exists (wp post listto verify), and a follow-upexecute-abilitywithcore/content-queryreads it back.rest_forbidden); a subscriber can read through the meta-tools but is denied on write abilities.Trunk WordPress (7.2-beta3):
core/content-query,core/settings-get,core/users-query) self-skips since core provides them, so each lists only once with core provenance while all 12wp/*experimental abilities still register from the package copy, and reads/writes behave identically to stable.Changelog entries
Added in CHANGELOG.md:
Open questions for the team
WordPress/canonical repo: If we want a standalone package, can we move that under WP organizational ownership?instance()vs.init(): I wasn't sure which method was the correct spot for registering bundled abilities but opted forinstance()to keep it closer to the plugin's own ability registration. Need confirmation of where that should land in the plugin lifecycle.meta.mcp.publicvs.meta.public:the pinned PR adds the MCP-specificmeta.mcp.publicflag to themedia&termsabilities so they are exposed on the MCP surface in testing. Other abilities already included the higher-levelmeta.publicflag, but the source PRs formediaandtermsdid not. We need to decide if those abilities should also be exposed by default, which level of flag is appropriate if so, and then merge those changes to the abilities package for distribution.