The WordPress MCP Server allows AI assistants to interact with WordPress sites through the REST API, providing functionality to manage posts, users, comments, categories, tags, and custom endpoints programmatically.
git clone [repository-url]
cd wordpress-mcp-server
npm install
npm run build
Before using the server, set up your WordPress site:
Add the server to your MCP settings file:
{
"mcpServers": {
"wordpress": {
"command": "node",
"args": ["path/to/wordpress-mcp-server/build/index.js"]
}
}
}
{
"tool": "create_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"title": "My First Post",
"content": "Hello, world!",
"status": "draft"
}
{
"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": "Updated Title",
"content": "Updated content",
"status": "publish"
}
{
"tool": "delete_post",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"postId": 123
}
{
"tool": "get_users",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"perPage": 10,
"page": 1
}
{
"tool": "get_user",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"userId": 1
}
{
"tool": "get_user_by_login",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"userLogin": "johndoe"
}
{
"tool": "get_comments",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"perPage": 10,
"page": 1,
"postIdForComment": 123
}
{
"tool": "create_comment",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"postIdForComment": 123,
"commentContent": "This is a great post!"
}
{
"tool": "get_categories",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"perPage": 10,
"page": 1
}
{
"tool": "create_category",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"categoryName": "New Category",
"customData": {
"description": "This is a new category"
}
}
For advanced use cases, you can make custom requests to any WordPress REST API endpoint:
{
"tool": "custom_request",
"siteUrl": "https://example.com",
"username": "admin",
"password": "xxxx xxxx xxxx xxxx",
"customEndpoint": "wp/v2/media",
"customMethod": "GET",
"customParams": {
"per_page": 5
}
}
All tools return responses in a consistent format:
{
"success": true,
"data": {
// WordPress API response data
},
"meta": {
// Optional metadata (pagination info, etc.)
}
}
{
"success": false,
"error": "Error message here"
}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "wordpress" '{"command":"node","args":["path/to/wordpress-mcp-server/build/index.js"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"wordpress": {
"command": "node",
"args": [
"path/to/wordpress-mcp-server/build/index.js"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"wordpress": {
"command": "node",
"args": [
"path/to/wordpress-mcp-server/build/index.js"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect