loading…
Search for a command to run...
loading…
An MCP server that indexes WordPress hooks, filters, block registrations, and JS API calls to provide AI assistants with a verified source-code database. It ena
An MCP server that indexes WordPress hooks, filters, block registrations, and JS API calls to provide AI assistants with a verified source-code database. It enables models to search, validate, and retrieve code context for WordPress and its plugins to eliminate hook-name hallucinations.
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.
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:
woocommerce_email_after_order_details sounds right but isn't realwp.editor.InspectorControls instead of wp.blockEditor.InspectorControlspre_get_posts for WooCommerce order queries when HPOS uses woocommerce_order_list_table_prepare_items_query_argsThe 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.
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:
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:
woocommerce_thankyou_{$payment_method})npm install -g wp-devdocs-mcp
Or run directly with npx (no install needed):
npx wp-devdocs-mcp
# 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.
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": ["wp-devdocs-mcp"]
}
}
}
Now when you ask Claude Code to write WordPress plugin code, it will automatically search and validate hook names against your indexed sources before generating code.
The server auto-updates stale sources (>24h) in the background on each start. Disable with WP_MCP_AUTO_UPDATE=false. (since v1.1.0)
Pre-configured sources you can add with a single command:
| Preset | What It Indexes |
|---|---|
wp-core |
WordPress core hooks (wordpress-develop, trunk) |
gutenberg-source |
Gutenberg plugin source code |
gutenberg-docs |
Gutenberg/block editor documentation |
woocommerce |
WooCommerce plugin hooks (plugins/woocommerce) |
plugin-handbook |
Plugin developer handbook |
rest-api-handbook |
REST API documentation |
wp-cli-handbook |
WP-CLI reference |
admin-handbook |
Advanced administration handbook |
npx wp-hooks source:add \
--name wordpress \
--type github-public \
--repo https://github.com/WordPress/wordpress-develop \
--branch trunk
Expected output:
Source "wordpress" added successfully.
Indexing "wordpress"...
Fetching source: wordpress (github-public)...
Indexing source: wordpress from ~/.wp-devdocs-mcp/cache/WordPress--wordpress-develop
Found 2025 files to check in wordpress
Indexing complete:
Files processed: 2025
Files skipped: 0
Hooks inserted: 3459
Hooks updated: 0
Hooks unchanged: 0
Blocks indexed: 0
APIs indexed: 140
npx wp-hooks source:add \
--name gutenberg \
--type github-public \
--repo https://github.com/WordPress/gutenberg \
--branch trunk
npx wp-hooks source:add \
--name woocommerce \
--type github-public \
--repo https://github.com/woocommerce/woocommerce \
--subfolder plugins/woocommerce \
--branch trunk
# Example: Advanced Custom Fields
npx wp-hooks source:add \
--name acf \
--type github-public \
--repo https://github.com/AdvancedCustomFields/acf
# Example: WPGraphQL
npx wp-hooks source:add \
--name wpgraphql \
--type github-public \
--repo https://github.com/wp-graphql/wp-graphql
For private GitHub repos, store your token in an environment variable (never in the config):
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
npx wp-hooks source:add \
--name my-private-plugin \
--type github-private \
--repo https://github.com/yourorg/your-plugin \
--token-env GITHUB_TOKEN
Point directly at a folder on your machine — great for plugins you're actively developing:
npx wp-hooks source:add \
--name my-local-plugin \
--type local-folder \
--path /path/to/wp-content/plugins/my-plugin
Index markdown handbooks and documentation alongside source code:
npx wp-hooks source:add \
--name my-docs \
--type github-public \
--repo https://github.com/org/docs-repo \
--content-type docs
| Option | Description |
|---|---|
--name |
Unique name for this source (required) |
--type |
github-public, github-private, or local-folder (required) |
--repo |
GitHub repository URL |
--subfolder |
Only index a subfolder within the repo |
--branch |
Git branch (default: main — use trunk for WordPress/WooCommerce repos) |
--token-env |
Environment variable name holding a GitHub token (private repos) |
--path |
Local folder path |
--content-type |
source (default) or docs (since v1.1.0) |
--no-index |
Register the source without indexing it yet |
Source code (--content-type source, default):
do_action(), apply_filters(), *_ref_array() variantsaddAction(), addFilter(), applyFilters(), doAction()registerBlockType(), registerBlockVariation()wp.blocks.*, wp.blockEditor.*, wp.data.*, etc.Documentation (--content-type docs) (since v1.1.0):
Each hook record includes: exact name, type, parameters, file path, line number, enclosing function/class, docblock, surrounding code context, and dynamic name detection.
Seven tools are exposed to your AI assistant (four original + three added in v1.1.0):
search_hooksFull-text search with BM25 ranking across all indexed hooks. Supports filters for type, source, dynamic hooks, and removed hooks.
validate_hookExact-match check — returns VALID with file locations, NOT_FOUND with similar suggestions, or REMOVED for deprecated hooks. This is how the AI confirms a hook name before using it in code.
get_hook_contextReturns the full code window around a hook: the line itself, 8 lines before, 4 lines after, the docblock, enclosing function, and class. Gives the AI enough context to use the hook correctly.
search_block_apisSearches block registrations (registerBlockType, etc.) and JavaScript API usages (wp.blockEditor.*, wp.data.*, etc.). Only matches on structured fields (block name, API call, namespace) — not surrounding code — to prevent false positives.
search_docs (since v1.1.0)Full-text search across indexed WordPress documentation. Supports filters for document type (guide, tutorial, reference, API, howto, FAQ), category, and source.
get_doc (since v1.1.0)Retrieve the full content of a specific documentation page by its ID. Returns the page title, content, metadata, code examples, and related links.
list_docs (since v1.1.0)Browse available documentation with optional filters for type, category, and source. Useful for discovering what documentation is indexed.
Source management:
wp-hooks source:add Add a source and index it
wp-hooks source:list List all sources with indexed status
wp-hooks source:remove Remove a source and all its data
Presets (since v1.1.0):
wp-hooks quick-add <name> Add a preset source
wp-hooks quick-add-all Add all preset sources
Indexing:
wp-hooks index Re-index all sources (or --source <name>, --force)
wp-hooks update Fetch and re-index stale sources (--source, --force) (since v1.1.0)
Search:
wp-hooks search <query> Search hooks (--type, --source, --include-removed)
wp-hooks search-blocks <q> Search block registrations and JS APIs
wp-hooks search-docs <q> Search documentation (--type, --category, --source) (since v1.1.0)
wp-hooks validate <name> Check if a hook name exists (exit code 0/1)
Maintenance:
wp-hooks stats Hook/block/API/doc counts per source
wp-hooks rebuild-index Rebuild FTS indexes if out of sync
# Search for checkout-related hooks
npx wp-hooks search "woocommerce_checkout"
# Search only filters
npx wp-hooks search "woocommerce_product" --type filter
# Validate a specific hook name
npx wp-hooks validate "woocommerce_before_order_itemmeta"
# Search for Gutenberg block APIs
npx wp-hooks search-blocks "InspectorControls"
# Search documentation (since v1.1.0)
npx wp-hooks search-docs "custom post type"
# Add all presets at once (since v1.1.0)
npx wp-hooks quick-add-all
# Re-index a specific source after updates
npx wp-hooks index --source woocommerce
# Update stale sources (since v1.1.0)
npx wp-hooks update
# Force full re-index (ignore file modification cache)
npx wp-hooks index --force
# See what you have indexed
npx wp-hooks stats
removedAll data lives in ~/.wp-devdocs-mcp/:
~/.wp-devdocs-mcp/
hooks.db # SQLite database (FTS5, WAL mode)
cache/ # Cloned repositories
search_docs, get_doc, list_docs for querying indexed documentationquick-add and quick-add-all CLI commandsWP_MCP_AUTO_UPDATE=false)update CLI command — manual fetch and re-index of stale sourcessearch-docs CLI command — search documentation from the terminal--content-type option — distinguish between source code and documentation sourcessource:list — shows content type and last-indexed timesearch_hooks, validate_hook, get_hook_context, search_block_apis)MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"wp-devdocs-mcp": {
"command": "npx",
"args": []
}
}
}