WordPress MCP server

Enables direct interaction with WordPress sites for creating, retrieving, and updating posts through the WordPress REST API
Back to servers
Setup instructions
Provider
Leonelberio
Release date
Apr 04, 2025
Language
TypeScript
Stats
1 star

The WordPress MCP Server enables interaction with WordPress sites through the WordPress REST API. It provides an interface for creating, retrieving, and updating posts using the JSON-RPC 2.0 protocol, making it easy to integrate WordPress content management into your applications.

Installation

To set up the WordPress MCP Server on your system:

  1. Clone the repository to your local machine
  2. Install the required dependencies:
    npm install
    
  3. Build the project:
    npm run build
    

Configuration

Add the server to your MCP settings file with appropriate environment variables:

{
  "mcpServers": {
    "wordpress": {
      "command": "node",
      "args": ["path/to/build/index.js"],
      "env": {
        "WORDPRESS_SITE_URL": "https://your-wordpress-site.com",
        "WORDPRESS_USERNAME": "your-username",
        "WORDPRESS_PASSWORD": "your-app-password"
      }
    }
  }
}

Required Environment Variables

  • WORDPRESS_SITE_URL: Your WordPress site URL
  • WORDPRESS_USERNAME: WordPress username
  • WORDPRESS_PASSWORD: WordPress application password

Note: You can also provide these credentials directly in request parameters instead of environment variables.

Available Methods

create_post

Creates a new WordPress post.

Parameters:

  • siteUrl: (optional if set in env) WordPress site URL
  • username: (optional if set in env) WordPress username
  • password: (optional if set in env) WordPress application password
  • title: Post title
  • content: Post content
  • status: (optional) 'draft' | 'publish' | 'private' (default: 'draft')

get_posts

Retrieves WordPress posts.

Parameters:

  • siteUrl: (optional if set in env) WordPress site URL
  • username: (optional if set in env) WordPress username
  • password: (optional if set in env) WordPress application password
  • perPage: (optional) Number of posts per page (default: 10)
  • page: (optional) Page number (default: 1)

update_post

Updates an existing WordPress post.

Parameters:

  • siteUrl: (optional if set in env) WordPress site URL
  • username: (optional if set in env) WordPress username
  • password: (optional if set in env) WordPress application password
  • postId: ID of the post to update
  • title: (optional) New post title
  • content: (optional) New post content
  • status: (optional) 'draft' | 'publish' | 'private'

Security Recommendations

For security purposes, use WordPress application passwords instead of your main account password. Generate an application password through your WordPress dashboard:

  1. Go to Users → Security → Application Passwords
  2. Generate a new password specifically for this integration

Example Usage

Using Environment Variables

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "create_post",
  "params": {
    "title": "My New Post",
    "content": "Hello World!",
    "status": "draft"
  }
}

Without Environment Variables

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "create_post",
  "params": {
    "siteUrl": "https://your-wordpress-site.com",
    "username": "your-username",
    "password": "your-app-password",
    "title": "My New Post",
    "content": "Hello World!",
    "status": "draft"
  }
}

System Requirements

  • Node.js 20.0.0 or higher
  • WordPress site with REST API enabled
  • WordPress application password for authentication

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "wordpress" '{"command":"node","args":["path/to/build/index.js"],"env":{"WORDPRESS_SITE_URL":"https://your-wordpress-site.com","WORDPRESS_USERNAME":"your-username","WORDPRESS_PASSWORD":"your-app-password"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

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.

Adding an MCP server to Cursor globally

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/build/index.js"
            ],
            "env": {
                "WORDPRESS_SITE_URL": "https://your-wordpress-site.com",
                "WORDPRESS_USERNAME": "your-username",
                "WORDPRESS_PASSWORD": "your-app-password"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "wordpress": {
            "command": "node",
            "args": [
                "path/to/build/index.js"
            ],
            "env": {
                "WORDPRESS_SITE_URL": "https://your-wordpress-site.com",
                "WORDPRESS_USERNAME": "your-username",
                "WORDPRESS_PASSWORD": "your-app-password"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later