PW

pluginslab/wp-blockmarkup-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

40 stars 5 forks 质量 73 趋势 16MIT

wp-blockmarkup-mcp 是一个本地 MCP 服务器,能够提取、验证并索引 WordPress 核心、WooCommerce 或你使用的任何基于模块的插件中的每一个 Gutenberg 块。

概览

WP-BlockMarkUp-MCP 是一个本地 MCP 服务器,能够提取、验证并索引 WordPress 核心、WooCommerce 或你使用的任何基于模块的插件中的每一个 Gutenberg 区块。它为 Claude Code 等 AI 工具提供了一个经过验证的区块模式、属性和验证标记示例数据库可供查询——而不是依赖训练数据,这些数据会幻觉区块结构、虚构属性并生成触发编辑器中“尝试区块恢复”的标记。 121个核心古腾堡块索引——100%的静态块标记示例均通过结构和保存函数验证。 AI助手越来越多地被用于程序化生成WordPress内容——通过REST API构建页面,跨平台迁移内容,填充无头前端。但每个AI模型都有相同的盲点:。

概述(AI 翻译)

给你的AI助手一个经过验证的块标记数据库,而不是让它猜古腾堡HTML。

WP-BlockMarkUp-MCP 是一个本地 MCP 服务器,能够提取、验证并索引 WordPress 核心、WooCommerce 或你使用的任何基于模块的插件中的每一个 Gutenberg 区块。它为 Claude Code 等 AI 工具提供了一个经过验证的区块模式、属性和验证标记示例数据库可供查询——而不是依赖训练数据,这些数据会幻觉区块结构、虚构属性并生成触发编辑器中“尝试区块恢复”的标记。

当前验证结果: 121个核心古腾堡块被索引——100%的静态块标记示例均通过结构验证和保存函数验证。

为什么会有这样的存在

AI助手越来越多地被用于程序生成WordPress内容——通过REST API构建页面,跨平台迁移内容,填充无头前端。但每个AI模型都有同一个盲点:块标记来自训练数据,而非实际块源代码。

这意味着:

  • 模型发明不存在的属性 — fontSize作为数字,当它预期字符串塞拉克,如"large"

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

wp-blockmarkup-mcp

Give your AI assistant a verified block markup database instead of letting it guess Gutenberg HTML.

wp-blockmarkup-mcp is a local MCP server that extracts, validates, and indexes every Gutenberg block from WordPress core, WooCommerce, or any block-based plugin you work with. It gives AI tools like Claude Code a verified database of block schemas, attributes, and validated markup examples to query — instead of relying on training data that hallucinates block structures, invents attributes, and produces markup that triggers “Attempt Block Recovery” in the editor.

Current validation results: 121 core Gutenberg blocks indexed — 100% of static block markup examples pass both structural and save-function validation.

Why This Exists

AI assistants are increasingly used to generate WordPress content programmatically — building pages via the REST API, migrating content between platforms, populating headless frontends. But every AI model shares the same blind spot: block markup comes from training data, not from the actual block source code.

This means:

  • Models invent attributes that don’t exist — fontSize as a number when it expects a string slug like "large"
  • Class naming patterns are wrong — has-background-color-vivid-red instead of has-vivid-red-background-color
  • Block nesting rules are ignored — putting blocks inside containers that don’t support InnerBlocks
  • Dynamic blocks get static markup — generating HTML for blocks that only accept comment delimiters with attributes
  • Third-party blocks are invisible — WooCommerce blocks, Kadence blocks, ACF blocks are all unknown to training data
  • Subtle mismatches break silently — the markup looks right but the editor flags it as invalid, requiring manual recovery

You only discover these problems when content lands in the editor and every block shows a yellow warning bar. In an agentic workflow where the AI generates and pushes content autonomously, bad markup means broken pages.

The Solution

Feed the AI real block data. Instead of hoping the model remembers the right markup format, give it a verified database to query and validate against.

wp-blockmarkup-mcp parses the actual source code of any block-based plugin, extracts every block’s schema, and validates generated markup through a two-tier pipeline — first using the official WordPress block parser for structural correctness, then verifying HTML output patterns against the block’s save() function AST. Your AI assistant queries this database before generating content, and can validate its output before pushing it.

This fits naturally into content generation workflows. When Claude Code (or any MCP-compatible assistant) needs to generate Gutenberg block markup, it:

在 GitHub 查看完整 README

安装

npx wp-blockmarkup-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "wp-blockmarkup": { "command": "npx", "args": ["wp-blockmarkup-mcp"] } } }