WordPress MCP Server
这个MCP Server让你能够自动化与WordPress的交互。
此服务器允许AI助手与WordPress站点交互,自动化内容管理任务。
安装
git clone https://github.com/stefans71/wordpress-mcp-server.git
cd wordpress-server
npm install
npm run build
准备工作
-
WordPress配置:
- 确保REST API已启用
- 创建应用程序密码: WordPress管理面板 → 用户 → 个人资料 → 应用程序密码
-
MCP配置:
{ "mcpServers": { "wordpress": { "command": "node", "args": ["path/to/wordpress-server/build/index.js"] } } }
主要功能
创建文章
{
"tool": "create_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"title": "我的文章",
"content": "内容...",
"status": "draft" // 可选: draft, publish, private
}
获取文章列表
{
"tool": "get_posts",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"perPage": 5, // 可选
"page": 1 // 可选
}
更新文章
{
"tool": "update_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"postId": 123,
"title": "更新的标题", // 可选
"content": "新内容...", // 可选
"status": "publish" // 可选
}
响应格式
成功:
{
"success": true,
"data": { ... } // WordPress API响应
}
错误:
{
"success": false,
"error": "错误信息"
}
安全提示
- 始终使用HTTPS
- 使用应用程序密码而非主密码
- 定期更新应用程序密码
- 使用权限最小的用户账号