WordPress AI Integration MCP server

Integrates WordPress with AI systems to enable automated content creation, site management, and data analysis for WordPress-based websites.
Back to servers
Setup instructions
Provider
stefans71
Release date
Dec 30, 2024
Language
TypeScript
Package
Stats
162 downloads
71 stars

This MCP server enables interaction with WordPress sites through the WordPress REST API, allowing you to create, retrieve, and update posts using JSON-RPC 2.0 protocol. It works on Windows, macOS, and Linux systems, providing a convenient way to manage WordPress content programmatically.

Installation

To install the WordPress MCP server:

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the project:
    npm run build
    

Configuration

Add the server to your MCP settings file with environment variables for WordPress credentials:

{
  "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"
      }
    }
  }
}

Environment Variables

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

Security Tip: For security, use WordPress application passwords instead of your main account password. Generate an application password in your WordPress dashboard under Users → Security → Application Passwords.

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'

Usage Examples

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