Invocation — AI Page & Section Builder for WordPress
A self-hosted, open-source WordPress 7.0 plugin that generates on-theme Gutenberg layouts with AI — grounded in your own blocks, patterns, theme, media, and links — and exposes every capability as MCP tools for agents like Claude Code.
Overview
Invocation is a self-hosted, open-source WordPress plugin that builds on-theme Gutenberg page content with AI — grounded in the site's own blocks, block patterns, theme.json design tokens, media library, and internal links.
I originally prototyped this as a metered SaaS (a separate Node API, credits, Stripe, a dashboard). Then WordPress 7.0 shipped its AI building blocks — a Connectors system for API keys, a provider-agnostic PHP AI Client, and an Abilities API — which made most of my custom infrastructure redundant overnight. So I rebuilt it from scratch as a pure-PHP plugin that rides core, and focused on the one thing core doesn't do: the block-and-theme intelligence to turn a prompt into a valid, on-brand layout.

The result is a plugin with no external service, no database, and no runtime dependencies beyond WordPress itself. You bring your own AI key (entered once under Settings → Connectors); nothing leaves your server until you ask it to generate.
The Problem
I work on a lot of block-theme and custom-block WordPress sites, and the tedious part is never writing the copy — it's placing content correctly into the right blocks and sections.
Generic "AI for WordPress" tools don't really solve this. They tend to:
- Invent block types the site doesn't have
- Hallucinate image URLs and internal links
- Ignore the theme's actual colors, fonts, and patterns
- Output a generic blob you still have to re-style by hand
What I wanted was an assistant that only ever uses what actually exists on the site, and produces markup that drops straight into the editor looking like it belongs.
What it does
Invocation exposes a focused set of capabilities ("skills"), each one a registered WordPress Ability:
- Generate a section, a full page, or fill an existing block pattern with real content
- Refine any selected block in place from the editor toolbar
- Read context — theme tokens, registered blocks, patterns, media, and internal links
- A Site Brief — an editable summary of the site's purpose, audience, and voice that grounds every generation
- Persist — create and update pages/posts (draft-first, capability-checked)
Because each is an Ability, the exact same capability is available in three ways at once: in PHP, over the REST API, and — through the MCP Adapter — as an MCP tool.
Built entirely on WordPress 7.0 core
A deliberate design goal: Invocation ships none of its own AI/provider code. It composes first-party core features.
- Connectors API holds the provider + key (bring your own).
- PHP AI Client (
wp_ai_client_prompt()) does the actual prompting and structured output. - Abilities API registers every capability with its own permission and schema.
- Native
parse_blocks()/serialize_blocks()validate and normalise the output.
The MCP Adapter is optional — Invocation activates and works standalone, and only registers an MCP server if the adapter is present.
How generation works
The interesting engineering is in the grounding pipeline. A small context-provider layer assembles everything the model needs, the model returns structured JSON, and the result is validated and repaired before it ever reaches the editor.
Two details I'm happy with:
- Context is relevance-ranked, not dumped. Instead of listing all ~110 core blocks, it surfaces the site's custom blocks and a curated set, and ranks patterns by relevance to the prompt — better output and far fewer tokens.
- Links are repaired, not trusted. Even when the model "tidies" a URL into a pretty slug, a post-pass maps it back to a real page — so it works even on sites without pretty permalinks.
Fill-from-pattern
The feature that best fits my real workflow: pick one of the theme's block patterns (a designed section) and have AI write content into it. The pattern's structure, blocks, and spacing presets are preserved exactly; only the placeholder copy is replaced. It turns "AI page builder" into something that produces sections that actually match the site's design system.
MCP & Claude Code — generate and persist
Because the abilities are exposed over MCP, any agent can drive Invocation. I shipped a companion Claude Code plugin, so I can build pages from my terminal end-to-end:
In practice I can say "build a features page for this site" and it produces a complete, on-theme page using real theme tokens, a real media image, and real internal links — then saves it as a draft for review. The whole loop runs against my own site, with my own key.
My Role
This is a solo, end-to-end project. I:
- Made the call to abandon the SaaS prototype and rebuild on WordPress 7.0 core
- Designed and implemented the plugin: the abilities, the context-provider system, the generation/refine/fill pipelines, and the page-write operations
- Built the React editor experience (sidebar, block-toolbar refine action, settings/Site Brief app) with
@wordpress/scripts - Implemented the MCP server via the official adapter and authored the Claude Code companion plugin
- Set up a Dockerised WordPress 7.0 dev environment and verified everything against real core APIs
- Handled the open-source and release work: security review, WordPress.org Plugin Check compliance, branding, and the wp.org submission
Tech Stack
- PHP 8.1, WordPress 7.0 (Abilities API, AI Client, Connectors)
- React +
@wordpress/scripts(editor sidebar, toolbar, admin app) - Model Context Protocol via the WordPress MCP Adapter
- Native Gutenberg block parsing/serialisation
- Docker (local WP dev), WP-CLI, Plugin Check
- GPL-2.0 — open source
What's next
The longer-term idea is a marketplace of "skills" — shareable, named recipes (a system prompt plus preferred patterns and blocks) that reliably produce a specific kind of section, with revenue share for creators. The free plugin stays the engine; the marketplace sells curation. There's also room for an optional hosted/credits layer for people who don't want to bring their own key.
Closing Thoughts
Invocation is the project where the platform shifted under me mid-build — and that turned out to be the best thing that could happen. By leaning fully into WordPress 7.0's new AI primitives instead of competing with them, the plugin got dramatically smaller, fully self-hostable, and "agent-ready" almost for free.
It sits right at the intersection I enjoy most: real product engineering, a brand-new platform capability, AI integration, and developer experience — shipped as something genuinely useful and open source.
Read more
Metamorphosis — Social Metadata Preview Chrome Extension
A Chrome extension that renders live previews of OpenGraph, Twitter, LinkedIn, and Discord social cards directly from any page — especially useful in local development.
Treeland Nursery — Custom E-commerce Platform
A fully custom e-commerce platform built with MedusaJS and Next.js, including a bespoke admin, advanced search, region-based pricing, and a growing CMS & POS roadmap.
UCP Hub — Universal Commerce Protocol Integration Platform
A multi-tenant SaaS platform implementing the Universal Commerce Protocol, with a modular core, connector system, and AI-powered testing platform.