WordPress MCP server

Integrates with WordPress REST API to enable secure content management, user administration, and site configuration tasks.
Back to servers
Provider
mzimmer
Release date
Dec 25, 2024
Language
TypeScript
Package
Stats
494 downloads
67 stars

The WordPress MCP Server allows AI assistants like Claude to interact with WordPress sites through the WordPress REST API. It supports managing multiple WordPress sites, providing access to content management, post operations, and site configuration through natural language commands.

Installation Options

Installing via Smithery

For an automated installation with Claude Desktop:

npx -y @smithery/cli install server-wp-mcp --client claude

Manual Installation

Install the package directly with npm:

npm install server-wp-mcp

Configuration

Getting an Application Password

  1. Log in to your WordPress admin dashboard
  2. Navigate to Users → Profile
  3. Scroll down to the "Application Passwords" section
  4. Enter a descriptive name (e.g., "MCP Server")
  5. Click "Add New Application Password"
  6. Copy the generated password immediately (you won't see it again)

Note: Application Passwords require WordPress 5.6+ and HTTPS.

Setting Up the Configuration File

Create a JSON configuration file (e.g., wp-sites.json) with your WordPress site details:

{
    "myblog": {
        "URL": "https://myblog.com",
        "USER": "yourusername",
        "PASS": "abcd 1234 efgh 5678"
    },
    "testsite": {
        "URL": "https://test.example.com",
        "USER": "anotherusername",
        "PASS": "wxyz 9876 lmno 5432"
    }
}

Each site entry requires:

  • URL: Full WordPress site URL (including http:// or https://)
  • USER: WordPress username
  • PASS: Application password (spaces will be automatically removed)

The key you use (e.g., "myblog", "testsite") becomes the site alias for all interactions.

Configuring Claude Desktop

Add the server to your claude_desktop_config.json:

{
    "mcpServers": {
        "wordpress": {
            "command": "node",
            "args": ["path/to/server/dist/index.js"],
            "env": {
                "WP_SITES_PATH": "/absolute/path/to/wp-sites.json"
            }
        }
    }
}

Important: The WP_SITES_PATH environment variable must use an absolute path to your configuration file.

Available Tools

wp_discover_endpoints

This tool maps all available REST API endpoints on a WordPress site.

Arguments:

{
    "site": {
        "type": "string",
        "description": "Site alias (as defined in configuration)",
        "required": true
    }
}

wp_call_endpoint

Execute REST API requests to WordPress sites.

Arguments:

{
    "site": {
        "type": "string",
        "description": "Site alias",
        "required": true
    },
    "endpoint": {
        "type": "string",
        "description": "API endpoint path",
        "required": true
    },
    "method": {
        "type": "string",
        "enum": ["GET", "POST", "PUT", "DELETE", "PATCH"],
        "description": "HTTP method",
        "default": "GET"
    },
    "params": {
        "type": "object",
        "description": "Request parameters or body data",
        "required": false
    }
}

Usage Examples

Once configured, you can ask Claude to perform various WordPress operations:

Content Management

List and query posts:

  • "Show me all posts from myblog published in the last month"
  • "Find all posts on testsite tagged with 'technology' and 'AI'"
  • "Show me draft posts from myblog that need review"

Create and edit content:

  • "Create a new draft post on testsite titled 'The Future of AI' with these key points: [points]"
  • "Update the featured image on myblog's latest post about machine learning"
  • "Add a new category called 'Tech News' to myblog"

Comment Management

  • "Show me all pending comments on myblog's latest post"
  • "Find comments from testsite that might be spam"
  • "List the most engaged commenters on myblog"

Plugin Management

  • "What plugins are currently active on myblog?"
  • "Check if any plugins on testsite need updates"
  • "Tell me about the security plugins installed on myblog"

User and Site Administration

  • "Show me all users with editor role on testsite"
  • "Create a new author account on myblog"
  • "What theme is currently active on myblog?"
  • "Check the permalink structure on testsite"

Maintenance and Diagnostics

  • "Check if there are any broken links on myblog"
  • "Show me the PHP version and other system info for testsite"
  • "List any pending database updates on myblog"

Security Best Practices

  • Keep your configuration file secure and never commit it to version control
  • Use HTTPS for all WordPress sites
  • Store the config file outside public directories
  • Regularly rotate application passwords
  • Follow the principle of least privilege for user permissions

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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