WPGuard MCP

io.github.cgallic由 GitHub 账号 cgallic 发布v0.4.0更新于 Oct 24, 2026

WordPress edit previews, scoped correction checks, and change records for trusted operators.

发布方自己的服务:Connorgallic

概览

AI 生成的概览

一个本地 MCP 服务器,让助手检查、预览并应用 WordPress 内容与设置变更,附带纠错校验和变更记录。

可以做什么
检查站点主题、插件、内容类型与字段,并在编辑前列出页面或与参考页比对。预览并应用页面正文、区块、文章元数据和选项变更,含受保护文案校验、快照与写入后回读。采集桌面与移动端渲染证据,并在已注册的预发布站点上测试变更而不自动上线。按版本锁定更新插件或主题,带健康检查与失败自动还原,并返回缓存的漏洞扫描结果。列出、查看并回滚 WordPress 原生修订版本,记录、列出或停用针对具体目标的纠错校验。查看变更包、导入历史记录,并运行范围很窄的预授权策略。
适用场景
适合希望助手做可审查的 WordPress 编辑而非盲目写入的场景:预览整页替换、保留必须存在的链接或文案、先在生产前的预发布环境测试,或留存改了什么、为什么改的记录。
运行要求
以 Python 3.10 以上从源码本地安装(或使用 Docker 镜像)运行,监听本地 HTTP 端点。需要 WPGUARD_MCP_TOKEN 环境变量提供令牌,并在 Authorization 头中携带相同值。WordPress 站点通过 SSH 或配套插件连接,内容纠错校验需要配套插件;建议使用专用管理员的应用程序密码。
安装前请注意
该令牌授予管理员级工具权限,应视为机密。写入会改动线上内容、设置、文件、插件与主题;快照因工具而异,不保证任何操作可回滚,请保持定期备份。高级 PHP、SQL、CLI、代码片段与访问类工具不受纠错校验保护。权限不等于人工批准,配套插件具备管理能力。导入的历史与被查询的记录会发送给所连接的客户端,私有历史不要放入公开仓库或可发布产物。

安装

在 SourceWeft 中

  1. 打开 控制台中的 WPGuard MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

WPGuard

Put your AI assistant to work on WordPress. Preview the edit. Keep the corrections that matter.

WPGuard connects an MCP client to WordPress so it can inspect a site, update content and settings, and return a record of its changes. When you teach it a supported correction, future edits to that exact target are checked before they are applied.

It is the open-source server behind WP MCP Server. Run it on your own machine or server and connect your WordPress sites over SSH or the companion plugin.

Get started · Product website · Security · MIT license

Useful work, with something to review

Ask your assistant to:

  • Inspect the active theme, plugins, content types, and available fields before changing a page.
  • Find a target page and approved reference, compare their complete stored content, and preview a bounded full-page diff.
  • Replace a Gutenberg or classic page body while proving named copy survives and refusing to overwrite a later human edit.
  • Update one Gutenberg block structurally, then verify the native WordPress revision created by the write.
  • Test a page change on a registered staging site and capture desktop/mobile evidence before opening production approval.
  • Update one plugin or theme with version pinning, health checks, and automatic restoration after a failed update.
  • Preview a content replacement, setting update, or file edit before applying it.
  • Preserve an approved text fragment, field value, or link during later edits to the same target.
  • Retrieve earlier work for an exact client and show the originating evidence.
  • Review a change packet and the snapshots captured by supported mutation tools.

The tools provide the WordPress access and change records. Your MCP client supplies the assistant and its reasoning.

Teach it once. Check the next edit.

Suppose a restaurant's reservations page must keep the link labeled Reserve a table pointing to /reserve.

You record that requirement with a rejected example, an accepted example, and its source. WPGuard first proves the check distinguishes those examples. A later content edit that removes the link fails its preview check and is blocked when the assistant tries to apply it.

This synthetic example uses the wp_correction_record MCP tool after registering the site:

python
wp_correction_record(    site="restaurant-staging",    target="post:84:content",    human_correction="Keep the reservations link on this page.",    source_ref="review:reservation-link-example",    human_requested_basis="The site owner requested this link in the example review.",    kind="html_link",    expected={"href": "/reserve", "text": "Reserve a table"},    rejected_value="<p>Contact us to book.</p>",    accepted_value='<p><a href="/reserve">Reserve a table</a></p>',)

The requirement applies to this registered site and this post body. It does not become a rule for every page or another client. Retiring a correction preserves its history and the reason it was retired.

Supported checks cover exact text presence or absence, scalar equality, a value at a JSON Pointer, and an HTML anchor's destination and text. The link check examines HTML structure; it does not prove the destination works or the link is visible in a browser.

Start from source

Requires Python 3.10 or newer. These commands install this repository; they do not depend on a published package or container image.

bash
git clone https://github.com/cgallic/wpguard-mcp.gitcd wpguard-mcppython -m venv .venvsource .venv/bin/activatepython -m pip install ".[browser]"playwright install chromiumexport WPGUARD_TOKEN_ADMIN="$(python -c 'import secrets; print(secrets.token_hex(32))')"wpguard-mcp

The server listens at http://127.0.0.1:8642/mcp. Connect a client that supports MCP Streamable HTTP and an Authorization: Bearer <token> header, using the value of WPGUARD_TOKEN_ADMIN from the server's environment.

Then register your site and call wp_site_context. Registration stores connection details; it does not import or modify your site's content.

The setup guide includes Windows, Docker builds, both WordPress connections, and a first edit with a reviewable preview.

What is included

WorkTools and behavior
Understand the sitewp_site_context, wp_recon, wp_schema_recon, and wp_design_context expose inventory and configuration. Plugin recognition does not imply a complete native integration.
Finish one pagewp_page_list, wp_page_get, and wp_page_compare resolve the target and reference. wp_page_replace_content previews a complete replacement, checks protected copy and corrections, requires the reviewed etag and exact packet, captures a snapshot, then reads the stored result back. wp_page_render_verify captures desktop and mobile screenshots with hashes and DOM checks without changing WordPress.
Test before productionwp_page_stage_and_test previews both registered peers, applies only to the separately approved staging site, captures rendered evidence, and returns a fresh production preview. It never promotes automatically.
Edit content and settingswp_mutate_post_content, wp_mutate_post_meta, and wp_mutate_option preview by default, check applicable corrections, and capture previous values before approved writes.
Work with files and blocksFile tools expose reads and edit previews. wp_mutate_block selects and patches one parsed Gutenberg block under the same digest, ETag, correction, snapshot, and packet controls. Post creation defaults to draft.
Update componentswp_vulnerability_scan returns cached clean, vulnerable, or unknown findings. SSH sites can preview and apply exact plugin/theme updates with post-update health checks and automatic prior-version restoration on failure.
Recover contentList and inspect native WordPress revisions, or preview and approve wp_revert_to_revision. WPGuard verifies the resulting revision by its complete content hash.
Run unattended workAdmins can create narrow preapproval policies bound to a site, source, exact verbs, target pattern, and maximum risk. A matching run receives one exact packet; unmatched work remains blocked.
Remember correctionsRecord, list, and retire exact-target checks. Failed or unevaluable applicable checks block the three mutation tools above.
Consult previous workImport packet CSVs or correction-episode JSONL and retrieve their source records without turning imported prose into executable instructions.
Review changesChange packets record proposals, approvals, and outcomes. wpguard audit displays the local ledger; supported snapshots can be used with rollback tools.

The server also exposes advanced PHP, SQL, CLI, snippet, and access tools. Their permissions and side effects differ. They are not covered by the correction checks above.

Bring your own history

Importing history preserves the original records, hashes, and provenance in the instance's state directory. Repeating an identical import is idempotent; changed records retain their earlier versions.

Packet exports use three CSV schemas:

text
packets:    id,client_slug,site,status,risk,created_at,summarystatus:     client_canonical,total_packets,verified,open,blocked,rolled_backcategories: category,packets,distinct_clients,top_clients
bash
python -m wpguard_mcp.history import \  --packets packets.csv --status status.csv --categories categories.csv \  --human-requested-basis "The operator confirmed these categories describe human-requested changes."

For richer session histories:

bash
python -m wpguard_mcp.history import-episodes \  --episodes episodes.jsonl --lessons lessons.md --coverage coverage.md

Each JSONL record needs nonempty episode_id, client, and site strings; additional evidence fields are preserved. wp_history_episodes(client_slug=...) matches the original client value exactly. Packet queries match the packet export's client_slug exactly. No alias mapping is inferred between the two exports.

Imported status and acceptance labels remain historical reports. Recording an active correction is a separate operation that requires examples which fail and pass its check. Caller-supplied acceptance references are recorded as attestations, not independently authenticated approvals.

Imports stay on the instance until queried or otherwise shared by its operator. Queries send the selected records to the connected MCP client. Keep private histories out of public repositories and publishable artifacts.

Know the boundaries

  • Correction coverage is explicit: option, post-meta, post-content, full-page, block, and native-revision content writes evaluate applicable target rules. Raw PHP, SQL, file edits, new posts, component updates, and changes made outside WPGuard use different safeguards.
  • Rendered verification is bounded. wp_page_render_verify checks the resolved live page at desktop and mobile sizes for HTTP failures, horizontal overflow, broken rendered images, and optional expected text. It stores hashed screenshots and a JSON receipt under state/render-evidence/. It does not judge visual quality or exercise interactions and links.
  • Permissions are not human approval. A mutate-scoped caller can approve packets. An admin-scoped caller can record or retire corrections. Use your surrounding workflow to decide who may do each.
  • Snapshots are tool-specific. There is no guarantee that every exposed operation is reversible. Maintain your site's regular backups.
  • The companion plugin has administrative capabilities. Prefer a WordPress Application Password owned by a dedicated administrator. The legacy shared key remains available for existing installations. Server-side token tiers do not protect callers who contact the plugin directly.
  • Local ledgers assume a single writer. They are not a shared multi-writer database. A successful replay or test does not establish live production deployment.

The updated companion plugin is required for content correction checks. It returns the source content during preview and checks its digest before applying a content replacement. Older plugin responses cannot satisfy that capability check.

Development

bash
python -m pip install -e ".[dev]"ruff check .mypypytest -q

CI runs lint, type checks, and tests on Python 3.10–3.12. PHP CLI is needed to run the companion-handler tests; without it those tests skip. All public test examples are synthetic.

WPGuard is MIT-licensed. See LICENSE.

来源:README.md,提交 06b2248

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Connorgallic 集成