Skip to main content
Glama

wp-mcp

wp-mcp

MCP 服务器,可将 Claude Code 变成一位完整的 WordPress 操作员——内容、媒体、插件、主题,以及直接编辑主题文件——适用于任何站点,包括没有 SSH/WP-CLI 的共享主机。

工作原理

由两部分组成:

  • bridge/wp-mcp-connector.zip——一个为每个站点上传一次的小型 WordPress 插件。它提供基于令牌的连接、文件端点(限定在 wp-content 范围内)、插件/主题安装器,以及一个独立的 rescue.php,即使损坏的 PHP 编辑已导致站点宕机,也能恢复备份。

  • server.mjs——在 Claude Code 中注册的 MCP 服务器。它与该插件以及 WordPress 的核心 REST API 通信。

连接生命周期(完整的安全模型)

  1. 在站点上上传 wp-mcp-connector.zip(插件 → 安装插件 → 上传插件)并启用它。

  2. 在 wp-admin → 设置 → WP MCP生成令牌(选择有效期:1 小时 / 8 小时 / 24 小时 / 7 天)。 令牌仅显示一次。新令牌会替换之前的任何令牌。

  3. 告诉 Claude:connect to https://example.com with token wpmcp_xxx, call it "clientx"

  4. 开始工作:编辑主题文件、安装插件、撰写文章,随你操作。

  5. disconnect from clientx——令牌会在站点上被吊销,并在本地被遗忘。

  6. 下次会话:生成一个新令牌,重新连接。

任何地方都不会留有常驻凭据。sites.json(已加入 .gitignore,chmod 600)只保存当前已连接的站点。

Related MCP server: AutoWP MCP Server

设置(仅需一次,在这台 Mac 上执行)

cd ~/mcp/wp-mcp && npm install
claude mcp add --scope user wordpress -- node ~/mcp/wp-mcp/server.mjs

工具

工具

作用

wp_connect / wp_disconnect / wp_sites

连接生命周期

wp_content_list/get/create/update/delete

文章、页面、任意自定义文章类型

wp_media_upload

本地文件 → 媒体库

wp_plugins

列出 / 安装(wp.org 的 slug 或 zip URL)/ 启用 / 停用 / 更新 / 删除

wp_themes

列出 / 安装 / 启用 / 删除

wp_file_list/read/write/delete

直接操作 wp-content 下的文件(主题、插件、上传内容)

wp_file_restore

从自动生成的 .wpmcp-bak 备份撤销一次文件写入——若站点已严重损坏,则回退到 rescue.php

wp_cache_purge

更改后清除已知的页面缓存(Jetpack Boost、WP Super Cache / W3TC、LiteSpeed)

wp_api

原始 REST 逃生通道(/wp/v2/settings/wc/v3/orders、菜单、用户…)

安全说明

  • 每次对现有文件执行 wp_file_write 时,都会先保存 <file>.wpmcp-bak。如果对 functions.php 的编辑导致站点白屏,wp_file_restore 仍然有效:rescue.php 在完全不加载 WordPress 的情况下运行。

  • 文件访问仅限于 wp-content。要允许访问整个 WP 根目录(例如编辑 wp-config.php),请在 wp-config.php 中添加 define('WPMCP_ALLOW_FULL', true);

  • 仅使用 HTTPS 站点——令牌会在请求头中传输。

  • 某些共享主机会剥离 Authorization 请求头;服务器还会发送 X-WPMCP-Token,该请求头在所有测试过的环境中均不会丢失。

  • 在多站点(multisite)环境中,插件/主题安装需要超级管理员的令牌。

  • 传递给 wp_content_create/wp_content_update 的 HTML 默认会包裹在原始 HTML(raw HTML)块中,这样 WordPress 的 autop 过滤器就无法重新格式化结构化标记(传入 autop_safe: false 可选择退出)。

  • 所有请求都会发送类似浏览器的 User-Agent——某些共享主机的 WAF 会以不透明的 403 拒绝非浏览器代理。

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Security-first WordPress MCP server. 129 tools for Claude, ChatGPT, Gemini. Free on wp.org.

  • Live SEO workflow tools for Claude Code, Codex, and AI agents.

  • Publish to self-hosted WordPress from AI agents: markdown, images, SEO, and Notion sync.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/srimalonline/wp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server