
wp-devdocs-mcp 是一个本地 MCP 服务器,索引来自 WordPress、WooCommerce、Gutenberg 或你使用的任何插件的每一个动作、过滤器、块注册和 JS API 调用。
概览
WP-DevDocs-MCP 是一个本地 MCP 服务器,索引来自 WordPress、WooCommerce、Gutenberg 或你使用的任何插件的每一个动作、过滤器、块注册和 JS API 调用。它为像 Claude Code 这样的 AI 工具提供了一个经过验证的数据库,用于搜索和验证,而非依赖训练数据。 支持Claude代码、光标、Windsurf及任何兼容MCP的客户端。 人工智能编码助手正在改变我们构建WordPress插件的方式。像Claude Code、Cursor和Windsurf这样的工具可以在几分钟内搭建整个插件——但它们都存在一个盲点:。 大多数时候,这种方法运作良好。像Claude Sonnet这样的模型几乎每次都能抓住常见的钩子。但“大多数时候”在发布生产代码时并不够好,而且并非每个模型都是Claude Sonnet。在当今进行代码生成的大型语言模型领域: - — woocommerce_email_after_order_details听起来对但其实不是真的 - — wp.editor.InspectorControls 代替 wp.blockEditor。
概述(AI 翻译)
给你的AI编码助手一个经过验证的WordPress钩子数据库,而不是让它猜测。
WP-DevDocs-MCP 是一个本地 MCP 服务器,索引来自 WordPress、WooCommerce、Gutenberg 或你使用的任何插件的每一个动作、过滤器、块注册和 JS API 调用。它为像 Claude Code 这样的 AI 工具提供了一个经过验证的数据库,用于搜索和验证,而非依赖训练数据。
支持Claude代码、光标、Windsurf及任何兼容MCP的客户端。
为什么会有这样的存在
AI编码助手正在改变我们构建WordPress插件的方式。像Claude Code、Cursor和Windsurf这样的工具可以在几分钟内搭建整个插件——但它们都有一个盲点:钩子名称来自训练数据,而非源代码本身。
大多数时候,这种方法运作良好。像Claude Sonnet这样的模型几乎每次都能抓住常见的钩子。但“大多数时候”在发布生产代码时并不够好,而且并非每个模型都是Claude Sonnet。在当今进行代码生成的大型语言模型领域:
- 有些模特发明了不存在的钩子 —
woocommerce_email_after_order_details听起来对但其实不真实 - 有些使用已废弃的命名空间 — 'wp.
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
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
安装
npx wp-devdocs-mcp配置
{
"mcpServers": {
"wp-devdocs": {
"command": "npx",
"args": ["wp-devdocs-mcp"]
}
}
}