这是一个全面的模型上下文协议(MCP)服务器,使AI助手能够通过WordPress REST API与WordPress站点进行交互。该服务器提供了管理WordPress所有方面的工具,包括文章、用户、评论、分类、标签和自定义端点。
<a href="https://glama.ai/mcp/servers/@prathammanocha/wordpress-mcp-server"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=412732315,3367631977&fm=3081&app=3081&f=PNG?w=760&h=400" alt="WordPress Server MCP服务器" /> </a>git clone [repository-url]
cd wordpress-mcp-server
npm install
npm run build
在使用服务器之前,您需要设置您的WordPress站点:
将服务器添加到您的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"]
}
}
}
创建一个新的WordPress文章。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码title(必需):文章标题content(必需):文章内容status(可选):文章状态('draft','publish'或'private',默认为'draft')示例:
{
"tool": "create_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"title": "我的第一篇文章",
"content": "你好,世界!",
"status": "draft"
}
带有分页的支持检索WordPress文章。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):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
}
更新现有的WordPress文章。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码postId(必需):要更新的文章IDtitle(可选):新的文章标题content(可选):新的文章内容status(可选):新的文章状态('draft','publish'或'private')示例:
{
"tool": "update_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"postId": 123,
"title": "更新后的标题",
"content": "更新后的内容",
"status": "publish"
}
删除WordPress文章。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码postId(必需):要删除的文章ID示例:
{
"tool": "delete_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"postId": 123
}
检索WordPress用户。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码perPage(可选):每页的用户数量(默认:10)page(可选):页码(默认:1)根据ID检索特定的WordPress用户。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码userId(必需):要检索的用户的ID根据登录名检索WordPress用户。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码userLogin(必需):要检索的用户的登录名检索WordPress评论。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码perPage(可选):每页的评论数量(默认:1
10)page(可选):页码(默认:1)postIdForComment(可选):根据文章ID过滤评论在文章上创建新的评论。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码postIdForComment(必需):要评论的文章IDcommentContent(必需):评论内容customData(可选):附加的评论数据检索WordPress分类。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码perPage(可选):每页的分类数量(默认:10)page(可选):页码(默认:1)创建一个新的WordPress分类。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):WordPress用户名password(必需):WordPress应用程序密码categoryName(必需):要创建的分类名称customData(可选):附加的分类数据(描述、父级等)向任何WordPress REST API端点发出自定义请求。
参数:
siteUrl(必需):您的WordPress站点URLusername(必需):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响应数据
},
"meta": {
// 可选元数据(分页信息等)
}
}
{
"success": false,
"error": "错误消息在这里"
}
为了贡献于开发:
对于自动重新编译的开发模式:
npm run dev
本项目采用ISC许可证。
欢迎贡献!请随时提交拉取请求。