Skip to main content
Glama

WordPress MCP Server

全面的 WordPress MCP 服务器

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

特征

岗位管理

  • 创建、检索、更新和删除 WordPress 帖子
  • 通过各种参数过滤帖子
  • 帖子列表的分页支持

用户管理

  • 通过 ID 或登录检索用户信息
  • 更新用户详细信息
  • 删除用户

评论管理

  • 创建、检索、更新和删除评论
  • 按帖子过滤评论
  • 评论列表支持分页

分类管理

  • 管理类别和标签
  • 创建、检索、更新和删除分类法
  • 按 slug 查找类别和标签

网站信息

  • 检索常规 WordPress 网站信息

自定义请求

  • 支持自定义 REST API 端点
  • 自定义 HTTP 方法(GET、POST、PUT、DELETE)
  • 自定义数据和参数

先决条件

  • 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 请求。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

使 AI 助手能够通过 REST API 与 WordPress 网站进行交互,从而允许通过安全身份验证以编程方式管理帖子、用户、评论、类别和标签。

  1. 特征
    1. 岗位管理
    2. 用户管理
    3. 评论管理
    4. 分类管理
    5. 网站信息
    6. 自定义请求
  2. 先决条件
    1. 安装
      1. WordPress 配置
        1. MCP 配置
          1. 可用工具
            1. 岗位管理
            2. 用户管理
            3. 评论管理
            4. 类别和标签管理
            5. 自定义请求
          2. 响应格式
            1. 成功响应
            2. 错误响应
          3. 安全注意事项
            1. 发展
              1. 执照
                1. 贡献

                  Related MCP Servers

                  • -
                    security
                    A
                    license
                    -
                    quality
                    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.
                    Last updated -
                    18
                    31
                    MIT License
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A server enabling seamless interaction between AI models and WordPress sites with secure, standardized communication using the WordPress REST API for comprehensive site management.
                    Last updated -
                    9
                    9
                    TypeScript
                    • Apple
                  • A
                    security
                    A
                    license
                    A
                    quality
                    This server integrates AI assistants with ClickUp workspaces, enabling task, team, list, and board management through a secure OAuth2 authentication process.
                    Last updated -
                    5
                    56
                    7
                    TypeScript
                    MIT License
                    • Apple
                  • -
                    security
                    A
                    license
                    -
                    quality
                    This server implementation allows AI assistants to interact with Asana's API, enabling users to manage tasks, projects, workspaces, and comments through natural language requests.
                    Last updated -
                    342
                    TypeScript
                    MIT License

                  View all related MCP servers

                  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/prathammanocha/wordpress-mcp-server'

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