Skip to main content
Glama
WordPress MCP Server

WordPress MCP Server

全面的 WordPress MCP 服务器

一个功能全面的模型上下文协议 (MCP) 服务器,使 AI 助手能够通过 WordPress REST API 与 WordPress 网站进行交互。该服务器提供以编程方式管理 WordPress 各个方面的工具,包括帖子、用户、评论、类别、标签和自定义端点。

特征

岗位管理

  • 创建、检索、更新和删除 WordPress 帖子

  • 通过各种参数过滤帖子

  • 帖子列表的分页支持

用户管理

  • 通过 ID 或登录检索用户信息

  • 更新用户详细信息

  • 删除用户

评论管理

  • 创建、检索、更新和删除评论

  • 按帖子过滤评论

  • 评论列表支持分页

分类管理

  • 管理类别和标签

  • 创建、检索、更新和删除分类法

  • 按 slug 查找类别和标签

网站信息

  • 检索常规 WordPress 网站信息

自定义请求

  • 支持自定义 REST API 端点

  • 自定义 HTTP 方法(GET、POST、PUT、DELETE)

  • 自定义数据和参数

Related MCP server: WordPress MCP Server

先决条件

  • Node.js v18 或更高版本

  • 启用 REST API 的 WordPress 网站

  • 用于身份验证的 WordPress 应用程序密码

安装

  1. 克隆此存储库:

git clone [repository-url]
cd wordpress-mcp-server
  1. 安装依赖项:

npm install
  1. 构建服务器:

npm run build

WordPress 配置

在使用服务器之前,您需要设置您的 WordPress 网站:

  1. 确保您的 WordPress 网站已启用 REST API(WordPress 4.7+ 中默认启用)

  2. 创建应用程序密码:

    • 登录到您的 WordPress 管理面板

    • 前往用户 → 个人资料

    • 向下滚动到“应用程序密码”

    • 输入应用程序的名称(例如“MCP Server”)

    • 点击“添加新的申请密码”

    • 复制生成的密码(您将无法再看到它)

MCP 配置

将服务器添加到您的 MCP 设置文件(通常位于~/AppData/Roaming/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json ):

{
  "mcpServers": {
    "wordpress": {
      "command": "node",
      "args": ["path/to/wordpress-mcp-server/build/index.js"]
    }
  }
}

可用工具

岗位管理

1. 创建帖子

创建一个新的 WordPress 帖子。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • title (必填):帖子标题

  • content (必填):帖子内容

  • status (可选):帖子状态(“草稿”,“发布”或“私人”,默认为“草稿”)

例子:

{
  "tool": "create_post",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "title": "My First Post",
  "content": "Hello, world!",
  "status": "draft"
}

2. 获取帖子

检索具有分页功能的 WordPress 帖子。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • perPage (可选):每页的帖子数(默认值:10)

  • page (可选):页码(默认值:1)

  • customParams (可选):附加查询参数

例子:

{
  "tool": "get_posts",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "perPage": 5,
  "page": 1
}

3. 更新帖子

更新现有的 WordPress 帖子。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • postId (必填):要更新的帖子的 ID

  • title (可选):新帖子标题

  • content (可选):新帖子内容

  • status (可选):新帖子状态(“草稿”,“发布”或“私人”)

例子:

{
  "tool": "update_post",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "postId": 123,
  "title": "Updated Title",
  "content": "Updated content",
  "status": "publish"
}

4. 删除帖子

删除 WordPress 帖子。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • postId (必填):要删除的帖子的 ID

例子:

{
  "tool": "delete_post",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "postId": 123
}

用户管理

1. 获取用户

检索 WordPress 用户。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • perPage (可选):每页的用户数(默认值:10)

  • page (可选):页码(默认值:1)

2. 获取用户

通过 ID 检索特定的 WordPress 用户。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • userId (必填):要检索的用户 ID

3. 通过登录获取用户

通过登录名检索 WordPress 用户。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • userLogin (必填):要检索的用户登录名

评论管理

1. 获取评论

检索 WordPress 评论。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • perPage (可选):每页评论数(默认值:10)

  • page (可选):页码(默认值:1)

  • postIdForComment (可选):按帖子 ID 过滤评论

2. 创建评论

在帖子上创建新评论。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • postIdForComment (必填):要评论的帖子的 ID

  • commentContent (必填):评论内容

  • customData (可选):附加评论数据

类别和标签管理

1. 获取类别

检索 WordPress 类别。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • perPage (可选):每页类别数(默认值:10)

  • page (可选):页码(默认值:1)

2. 创建类别

创建一个新的 WordPress 类别。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • categoryName (必填):要创建的类别的名称

  • customData (可选):附加类别数据(描述、父级等)

自定义请求

1. 自定义请求

向任何 WordPress REST API 端点发出自定义请求。

参数:

  • siteUrl (必填):您的 WordPress 网站 URL

  • username (必填):WordPress 用户名

  • password (必填):WordPress 应用程序密码

  • customEndpoint (必需):API 端点路径

  • customMethod (可选):HTTP 方法('GET'、'POST'、'PUT'、'DELETE',默认值:'GET')

  • customData (可选):POST/PUT 请求的数据

  • customParams (可选):GET 请求的 URL 参数

例子:

{
  "tool": "custom_request",
  "siteUrl": "https://example.com",
  "username": "admin",
  "password": "xxxx xxxx xxxx xxxx",
  "customEndpoint": "wp/v2/media",
  "customMethod": "GET",
  "customParams": {
    "per_page": 5
  }
}

响应格式

所有工具都以以下格式返回响应:

成功响应

{
  "success": true,
  "data": {
    // WordPress API response data
  },
  "meta": {
    // Optional metadata (pagination info, etc.)
  }
}

错误响应

{
  "success": false,
  "error": "Error message here"
}

安全注意事项

  • 始终为你的 WordPress 网站使用 HTTPS URL

  • 使用应用程序密码代替主 WordPress 密码

  • 确保应用程序密码安全,不要与他人共享

  • 考虑使用 WordPress 角色和功能来限制访问

  • 定期轮换应用程序密码

发展

为发展做出贡献:

  1. 分叉存储库

  2. 创建功能分支

  3. 进行更改

  4. 运行测试(可用时)

  5. 提交拉取请求

对于具有自动重新编译的开发模式:

npm run dev

执照

该项目已获得 ISC 许可。

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

Available Tools

29 tools
create-categoryC

Create a new WordPress category

Inputs: name (required), password (required), siteUrl (required), username (required), +4 more.

create-commentC

Create a new comment on a WordPress post

Inputs: content (required), password (required), postId (required), siteUrl (required), +3 more.

create-postC

Create a new WordPress post

Inputs: content (required), password (required), siteUrl (required), title (required), +17 more.

create-userC

Create a new WordPress user

Inputs: email (required), newPassword (required), newUsername (required), password (required), +11 more.

delete-categoryC

Delete a WordPress category

Inputs: categoryId (required), password (required), siteUrl (required), username (required), +1 more.

delete-postC

Delete a WordPress post

Inputs: password (required), postId (required), siteUrl (required), username (required), +1 more.

delete-userC

Delete a WordPress user

Inputs: password (required), reassignId (required), siteUrl (required), userId (required), +1 more.

get-categoryC

Get a specific category by ID

Inputs: categoryId (required), password (required), siteUrl (required), username (required), +1 more.

get-clicksC

View a site's outbound clicks

Inputs: password (required), siteId (required), siteUrl (required), username (required), +2 more.

get-commentsC

Get a list of comments from a WordPress site

Inputs: password (required), siteUrl (required), username (required), page, +2 more.

get-country-viewsC

View a site's views by country

Inputs: password (required), siteId (required), siteUrl (required), username (required), +2 more.

get-postC

Get a specific post by ID

Inputs: password (required), postId (required), siteUrl (required), username (required), +2 more.

get-post-statsC

View a specific post's views

Inputs: password (required), postId (required), siteId (required), siteUrl (required), +1 more.

get-referrersC

View a site's referrers

Inputs: password (required), siteId (required), siteUrl (required), username (required), +2 more.

get-search-termsB

View search terms used to find the site

Inputs: password (required), siteId (required), siteUrl (required), username (required), +2 more.

get-site-statsC

Get comprehensive stats for a WordPress site

Inputs: password (required), siteId (required), siteUrl (required), username (required), +1 more.

get-stats-highlightsC

Get highlight metrics for a WordPress site from the last seven days

Inputs: password (required), siteId (required), siteUrl (required), username (required).

get-stats-summaryC

View a site's summarized views, visitors, likes and comments

Inputs: password (required), siteId (required), siteUrl (required), username (required).

get-streak-statsC

Get stats for Calendar Heatmap showing publishing activity

Inputs: password (required), siteId (required), siteUrl (required), username (required).

get-top-postsC

View a site's top posts and pages by views

Inputs: password (required), siteId (required), siteUrl (required), username (required), +2 more.

get-userC

Get a specific user by ID

Inputs: password (required), siteUrl (required), userId (required), username (required), +1 more.

get-usersC

Get a list of users from a WordPress site with advanced filtering options

Inputs: password (required), siteUrl (required), username (required), capabilities, +13 more.

list-categoriesC

Get a list of categories with filtering options

Inputs: password (required), siteUrl (required), username (required), context, +11 more.

list-postsC

Get a list of posts with comprehensive filtering options

Inputs: password (required), siteUrl (required), username (required), after, +23 more.

remove-referrer-spamC

Unreport a referrer as spam

Inputs: domain (required), password (required), siteId (required), siteUrl (required), +1 more.

report-referrer-spamC

Report a referrer as spam

Inputs: domain (required), password (required), siteId (required), siteUrl (required), +1 more.

update-categoryC

Update an existing WordPress category

Inputs: categoryId (required), password (required), siteUrl (required), username (required), +5 more.

update-postC

Update an existing WordPress post

Inputs: password (required), postId (required), siteUrl (required), username (required), +18 more.

update-userC

Update an existing WordPress user

Inputs: password (required), siteUrl (required), userId (required), username (required), +12 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 29 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific resources and actions. For example, create/delete/get/update operations are separated by resource type (category, post, user), and analytics tools (get-clicks, get-country-views, etc.) each focus on different metrics without overlap.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with hyphens (e.g., create-post, get-category, update-user). The naming is uniform across all 29 tools, making them predictable and easy to understand.

    Tool Count3/5

    With 29 tools, the count feels heavy for a WordPress server, as it combines content management (posts, categories, users) with extensive analytics. While each tool is useful, the set might be overwhelming for agents, suggesting it could be split into separate servers for content vs. stats.

    Completeness5/5

    The tool surface provides complete CRUD/lifecycle coverage for core resources (posts, categories, users) and includes comprehensive analytics for site stats, referrers, and spam management. There are no obvious gaps for the WordPress domain.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with WordPress sites through the WordPress REST API. Supports multiple WordPress sites with secure authentication, enabling content management, post operations, and site configuration through natural language.
      118
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with WordPress sites through the REST API. Supports multiple WordPress sites with secure authentication, enabling content management, post operations, and site configuration through natural language.
      MIT