Skip to content

posimyth/wordpress-plugin-ability-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 WordPress Plugin Ability Generator

Generate WP 7.0 Abilities API abilities for any WordPress plugin — safely.

Turn a plugin's actions into typed, permissioned abilities that AI agents can discover and call over MCP — without exposing the dangerous stuff. Evidence-grounded, security-first, with an independent Builder→Verifier loop that catches hallucinations before they ship.

License: AGPL v3 WordPress Claude Code PRs Welcome


Why this exists

WordPress 7.0 ships the Abilities API (wp_register_ability) — a standard way for plugins to describe what they can do so AI agents can discover and run those actions as MCP tools. Most plugins don't ship abilities yet.

You could hand-write them, or point an AI at the plugin and say "make abilities." The problem: a naive generator is dangerous because it's frictionless. Wrapping every handler in an ability can hand an agent the power to install plugins, save arbitrary executable code, download a full-site backup, or rewrite .htaccess — all callable without friction.

This tool exists to do it the safe way. It's for:

  • Plugin authors who want to ship first-class abilities for their plugin.
  • Users who want abilities for a plugin they rely on whose author hasn't provided them.
  • Anyone building AI/MCP workflows on top of WordPress who needs a real, auditable action surface.

What makes it safe

  • Evidence-grounded — every generated ability maps to real code (file:line). Nothing is invented from what a plugin "probably" does.
  • Independent Builder→Verifier loop — a second, isolated pass re-derives each ability from source and deletes anything it can't verify. (This is what catches hallucinations.)
  • Conservative by default — abilities are mcp.public = false until a human approves; destructive-when-unsure; deny-over-allow.
  • Security-first — hard-rejects install/code-save/secret/backup/SSRF/meta-dispatcher handlers; hardens broken or missing permission checks instead of copying them.
  • Non-destructive — emits a separate companion plugin; never edits the target plugin's core, so it survives updates.
  • Human review gate — you approve writes and public exposure before anything ships.

How it works (in one picture)

Preflight → Inventory → Classify → [REVIEW GATE] → Builder → Security pass → Verifier → Emit → Sign-off
   grounding (no invention)   you approve      generate      independent   companion plugin
                                                             re-check       + manifest + tests

It produces a companion plugin plus a full paper trail:

abilities-out/<plugin-slug>/
  abilities.php        # WP 7.0 abilities (wp_register_ability), guarded to no-op on older WP
  abilities.js         # client-side @wordpress/abilities mirror of the safe reads
  manifest.md          # every emitted ability + every rejected handler, with file:line evidence
  SECURITY-NOTES.md    # high-risk rejections, permission-hardening record, open decisions
  tests/               # permission matrix, schema, cost/annotation, MCP round-trip

Requirements

  • Claude Code (this is a Claude Code Skill).
  • A WordPress plugin's source code to point it at.
  • To run the generated abilities: WordPress 7.0+ (or the wordpress/abilities-api package).
  • To expose them to AI agents over MCP: the WordPress MCP Adapter, or the SproutOS MCP WordPress plugin (see below).

Install

git clone https://github.com/<your-org>/wordpress-plugin-ability-generator.git
# Make it available to Claude Code as a skill:
ln -s "$(pwd)/wordpress-plugin-ability-generator" ~/.claude/skills/wp-ability-generator
# Restart Claude Code so the skill is picked up.

Steps to use

  1. Point the skill at a plugin. In Claude Code:

    /wp-ability-generator --plugin ./wp-content/plugins/my-plugin --mode user
    

    Use --mode author if it's your own plugin, --mode user for one you don't own (default; emits a companion plugin).

  2. Let it inventory + classify. It reads the source, lists every action the plugin actually exposes (REST routes, AJAX handlers, settings, etc.), and sorts them into candidates vs rejected — each with file:line evidence.

  3. Review the manifest (the gate). It stops and shows you manifest.md: which abilities it proposes, which handlers it's refusing to expose and why. Nothing is generated until you approve. Drop anything you don't want; rescue anything it was too cautious about.

  4. It generates + independently verifies. The Builder writes the abilities; a separate Verifier re-checks each one against the source and deletes anything unverifiable. You get abilities.php, abilities.js, manifest.md, SECURITY-NOTES.md, and tests.

  5. Do your manual review (see the checklist below). This step is not optional.

  6. Install the companion plugin on your site (drop the output folder into wp-content/plugins/ and activate). The abilities register on WordPress 7.0+.

  7. Expose them to AI agents over MCP. Install the SproutOS MCP WordPress plugin (or WordPress's MCP Adapter). It connects your WordPress site to AI agents over the Model Context Protocol, so your approved abilities become callable MCP tools. Flip an ability's mcp.public to true only after you've reviewed it.

💡 Fastest path to a working AI-controllable WordPress site: generate abilities with this tool → install the SproutOS MCP WordPress plugin → your agent can now discover and run those abilities as MCP tools. See SproutOS below.

✅ What you must manually check

The generator is conservative and verified, but you own the final call. Before flipping any ability to mcp.public or trusting it in production, confirm:

  • Permissions. Each ability's permission_callback matches what the action really requires. Reads that expose private/bulk data and all writes should stay gated. If the tool hardened a weak check, confirm the new capability is right for your roles.
  • The rejected list. Skim manifest.md's rejected + high-risk sections. Agree with the exclusions — and make sure nothing dangerous slipped into the emitted list.
  • No secrets in output. No ability returns API keys, tokens, credentials, raw code, or a dump of options/users. Check output_schema and the execute callbacks.
  • mcp.public flags. Only genuinely safe, non-sensitive reads should ever be public. Everything else stays false until you decide otherwise. In doubt, leave it false.
  • Cost abilities. Anything marked meta.cost = 'external' makes billable/outbound calls (e.g. AI providers). Keep it public:false and rate-limited; agents should not loop it.
  • Schema accuracy. Where the manifest notes schema_confidence: low (input inferred from a callback), sanity-check the input/output shapes against real requests.
  • Run the tests. Execute the generated tests/ on a staging site (permission matrix, schema, injection/fuzz). Never validate on production.
  • Destructive actions. Confirm delete/reset/restore-type abilities carry the destructive annotation so agents prompt for confirmation — or that you excluded them entirely.

When unsure, prefer not exposing an ability. You can always add more later.


⚡ SproutOS — make your abilities usable by AI

Generating abilities is half the story — an agent still needs a way to reach them. That's what SproutOS does.

The SproutOS MCP WordPress plugin turns your WordPress site into an MCP server: it exposes your registered abilities (and more) to AI agents over the Model Context Protocol, so tools like Claude can discover and safely run them. Pair it with this generator and you get an end-to-end path:

your plugin → generated abilities → SproutOS MCP → your AI agent.

👉 Learn more / get SproutOS: SPROUTOS_URL


Project structure

SKILL.md                     # the skill: 8-phase pipeline, modes, Builder→Verifier loop
DESIGN.md                    # methodology & design rationale
reference/
  rule-registry.md           # 24 validated checks (P1–P24) — extensible
  denylist.md                # include/exclude taxonomy + archetype safety gates
  naming-and-descriptions.md # naming, agent-facing descriptions, annotation map
  security-checklist.md      # per-ability security pass
  test-matrix.md             # what generated tests must cover
scripts/inventory.sh         # grep first-pass capability census
templates/                   # companion-plugin, ability, abilities.js, manifest, security-notes
examples/                    # illustrative output

Contributing

New plugins surface new edge cases — that's expected, and the rule registry is designed to grow. See CONTRIBUTING.md for how to add a rule (P25+) or improve a template.

Acknowledgements

Built on WordPress's Abilities API and MCP Adapter. Sponsored by SproutOS — the MCP layer for WordPress.

License

GNU AGPL-3.0-or-later © POSIMYTH Innovation

The AGPL's network-use clause means anyone who runs a modified version of this tool as a network service must make their modified source available to its users.

About

Generate WP 7.0 Abilities API abilities for any WordPress plugin — evidence-grounded, security-first, with an independent Builder to Verifier anti-hallucination loop. A Claude Code skill.

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors