A verified WordPress hook database for AI coding assistants.
wp-devdocs-mcp
Give your AI coding assistant a verified WordPress hook database instead of letting it guess.
wp-devdocs-mcp is a local MCP server that indexes every action, filter, block registration, and JS API call from WordPress, WooCommerce, Gutenberg, or any plugin you work with. It gives AI tools like Claude Code a verified database to search and validate against instead of relying on training data.
Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Why This Exists
AI coding assistants are changing how we build WordPress plugins. Tools like Claude Code, Cursor, and Windsurf can scaffold entire plugins in minutes — but they all share the same blind spot: hook names come from training data, not from the actual source code.
Most of the time this works fine. Models like Claude Sonnet nail common hooks almost every time. But "most of the time" isn't good enough when you're shipping production code, and not every model is Claude Sonnet. Across the landscape of LLMs doing code generation today:
- Some models invent hooks that don't exist —
woocommerce_email_after_order_detailssounds right but isn't real - Some use deprecated namespaces —
wp.editor.InspectorControlsinstead ofwp.blockEditor.InspectorControls - Most miss newer hooks — suggesting
pre_get_postsfor WooCommerce order queries when HPOS useswoocommerce_order_list_table_prepare_items_query_args - Parameters get mixed up — wrong argument count or order in callback signatures
- No model knows your custom plugins — private or proprietary hooks are invisible to every model's training data
The core issue is simple: we can't rely 100% on any model to produce correct WordPress hook names from memory alone. Even the best models benefit from verification, and the rest genuinely need it. You only find out about hallucinated hooks when the code doesn't work — and in an agentic workflow where the AI writes, tests, and iterates autonomously, one bad hook name can send it down a rabbit hole of debugging something that was never going to work.
The Solution
Feed the LLM real data. Instead of hoping the model remembers the right hook name, give it a verified database to query.
wp-devdocs-mcp parses the actual source code of any WordPress plugin and builds a searchable index of every hook with its exact name, type, parameters, file location, and surrounding code context. Your AI assistant queries this index before writing code — so every hook name in the generated code is verified against the real source.
This fits naturally into agentic coding workflows. When Claude Code (or any MCP-compatible assistant) needs to use a WordPress hook, it:
- Searches the indexed database for relevant hooks
- Validates the exact hook name exists before writing it into code
- Reads the context — parameters, docblock, surrounding code — to use it correctly
No hallucination. No guessing. No debugging phantom hooks.
What gets indexed:
| Type | Examples |
|---|---|
| PHP actions | do_action(), do_action_ref_array() |
| PHP filters | apply_filters(), apply_filters_ref_array() |
| JS hooks | addAction(), addFilter(), applyFilters(), doAction() |
| Block registrations | registerBlockType(), registerBlockVariation() |
| JS API usages | wp.blocks.*, wp.blockEditor.*, wp.data.*, etc. |
| Markdown documentation | Handbooks parsed into searchable pages (since v1.1.0) |
What the AI gets for each hook:
- Exact name (with dynamic name detection for hooks like
woocommerce_thankyou_{$payment_method}) - Type (action / filter / js_action / js_filter)
- Parameters and count
- File path and line number
- Enclosing function and class
- Docblock
- Code window (8 lines before, 4 after)
- Source plugin name
Quick Start
Install
npm install -g wp-devdocs-mcp
Or run directly with npx (no install needed):
npx wp-devdocs-mcp
Index Sources
# Add all preset sources at once (since v1.1.0)
wp-hooks quick-add-all
# Or add individual presets (since v1.1.0)
wp-hooks quick-add wp-core
wp-hooks quick-add woocommerce
wp-hooks quick-add gutenberg-source
wp-hooks quick-add plugin-handbook
Or add sources manually:
# WooCommerce (uses trunk branch)
wp-hooks source:add \
--name woocommerce \
--type github-public \
--repo https://github.com/woocommerce/woocommerce \
--subfolder plugins/woocommerce \
--branch trunk
That's it. 3,500+ hooks indexed in under a minute.
Connect to Your AI Assistant
Add the MCP server to your configuration. Create or edit .mcp.json in your project root (or ~/.claude/.mcp.json globally):
{
"mcpServers": {
"wp-devdocs": {
"command": "npx",
"args": ["
Tools (2)
search_hooksSearch the indexed database for WordPress hooks, filters, and JS API calls.get_hook_detailsRetrieve detailed context for a specific hook including parameters and source code.Configuration
{"mcpServers": {"wp-devdocs": {"command": "npx", "args": ["wp-devdocs-mcp"]}}}