Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).

WordPress and Model Context Protocol(MCP) – Working Together

3 min read

As AI assistants like Claude become increasingly sophisticated, the ability to integrate them with our existing platforms and tools becomes more valuable. One exciting development in this space is the Model Context Protocol (MCP), which enables AI assistants to interact with various systems through standardized interfaces. Today, I’ll walk you through setting up and using a WordPress MCP server that allows Claude to interact directly with your WordPress site.

What is the Model Context Protocol?

The Model Context Protocol (MCP) is a standardized interface that allows AI models to interact with external systems. It provides a way for AI assistants to:

  1. Discover what capabilities are available
  2. Call specific functions or tools
  3. Receive structured responses

This eliminates the need for AI models to parse complex documentation or understand the intricacies of different APIs, making integration much more straightforward.

The WordPress MCP Server

The WordPress MCP server (server-wp-mcp) is an implementation of the Model Context Protocol specifically designed for WordPress sites. It allows AI assistants like Claude to interact with WordPress through the WordPress REST API, handling authentication, endpoint discovery, and request formatting.

Key Features

  • Multi-Site Support: Connect to multiple WordPress sites simultaneously
  • REST API Integration: Full access to WordPress REST API endpoints
  • Secure Authentication: Uses application passwords for secure API access
  • Dynamic Endpoint Discovery: Automatically maps available endpoints for each site
  • Flexible Operations: Support for GET, POST, PUT, DELETE, and PATCH methods

Setting Up the WordPress MCP Server

Let’s go through the process of setting up the WordPress MCP server:

1. Installation

First, install the package using npm:

npm install server-wp-mcp

2. WordPress Configuration

Before proceeding, you’ll need to create an application password in WordPress:

  1. Log in to your WordPress admin dashboard
  2. Go to Users → Profile
  3. Scroll to the “Application Passwords” section
  4. Enter a name for the application (e.g., “MCP Server”)
  5. Click “Add New Application Password”
  6. Copy the generated password

This allows the MCP server to authenticate with your WordPress site securely.

3. Create a Configuration File

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

{
"myblog": {
"URL": "https://yourblog.com",
"USER": "yourusername",
"PASS": "your-application-password"
}
}

You can include multiple sites in this configuration file, each with its own alias (like “myblog” in the example above).

4. Start the Server

Set the WP_SITES_PATH environment variable to point to your configuration file and start the server:

export WP_SITES_PATH=~/path/to/wp-sites.json
npm start

If everything is configured correctly, you should see:

WordPress MCP server started with 1 site(s) configured

Understanding the Available Tools

The WordPress MCP server provides two primary tools:

1. wp_discover_endpoints

This tool maps all available REST API endpoints on a WordPress site. It’s typically the first step in working with a new site, as it helps you understand what operations are possible.

Arguments:
- site: The site alias (as defined in your configuration)

2. wp_call_endpoint

This tool executes specific REST API requests to your WordPress sites.

Arguments:
- site: The site alias
- endpoint: The API endpoint path (e.g., "/wp/v2/posts")
- method: HTTP method (GET, POST, PUT, DELETE, or PATCH)
- params: Request parameters or body data
curl -X GET "https://collabnix.com/wp-json/" | jq |more
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  448k    0  448k    0     0   288k      0 --:--:--  0:00:01 --:--:--  289k
{
  "name": "Collabnix",
  "description": "Docker | Kubernetes | IoT",
  "url": "https://collabnix.com",
  "home": "https://collabnix.com",
  "gmt_offset": 5.5,
  "timezone_string": "Asia/Kolkata",
  "namespaces": [
    "oembed/1.0",
    "acme-fix-images/v1",
    "feedzy/v1",
    "jetpack-boost-ds",
    "optml/v1",
    "performance-lab/v1",
    "jetpack-boost/v1",
    "jetpack/v4",
    "my-jetpack/v1",
    "jetpack/v4/explat",
    "hub-connector/v1",
    "media-cleaner/v1",
    "wp-statistics/v2",
    "wpra/v1",
    "google-site-kit/v1",
    "elementor/v1/documents",
:

Working with Claude and WordPress MCP

Add the following JSON file to your Claude config.

    "server-wp-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli@latest",
        "run",
        "server-wp-mcp",
        "--config",
        "\"{\\\"wpSitesPath\\\":\\\".\\\"}\""
      ]
    }

Once your MCP server is running, Claude can interact with your WordPress site in natural language. Here are some examples of what you can ask Claude to do:

Retrieving Content

Can you show me the latest 5 posts from myblog?

Claude would use the wp_call_endpoint tool to fetch posts from /wp/v2/posts with appropriate parameters.

Creating Content

Could you create a new draft post on myblog titled "The Future of AI in 2025" with the following key points: [list points]

Claude would format the request and use the wp_call_endpoint tool with a POST method to create a new post.

Managing Comments

Show me all pending comments on myblog's latest post about AI

Claude would first need to find the relevant post and then fetch its comments, demonstrating the power of chaining API calls.

Discovering Site Capabilities

What plugins are currently active on myblog?

Claude would query the WordPress REST API to retrieve plugin information.

Benefits of This Integration

Using the MCP server to connect Claude with WordPress offers several advantages:

  1. Natural Language Interface: Interact with your WordPress site through conversation
  2. Automation: Claude can help automate repetitive WordPress management tasks
  3. Content Creation: Get AI assistance in drafting, editing, and publishing content
  4. Data Analysis: Ask Claude to analyze your WordPress data in meaningful ways
  5. Multi-site Management: Manage multiple WordPress sites through a single interface

Extending the WordPress MCP Server

The beauty of the WordPress MCP server is that it’s open source and can be extended with custom tools. For example, you could create specific tools for:

  • Simplified post publishing with predefined templates
  • Content analysis and SEO suggestions
  • Site health monitoring and reporting
  • Customized content retrieval with specific formatting

Creating a Custom Tool

To add a custom tool, you need to:

  1. Fork the server-wp-mcp repository
  2. Define your tool in the tools array with a name, description, and input schema
  3. Implement the tool’s handler function
  4. Test and deploy your modified server

Security Considerations

When using the WordPress MCP server, keep these security practices in mind:

  • Keep your configuration file secure and never commit it to version control
  • Use application passwords instead of your main WordPress password
  • Regularly rotate your application passwords
  • Only include necessary permissions in your application passwords
  • Use HTTPS for all WordPress sites

Conclusion

The integration of Claude AI with WordPress through the Model Context Protocol opens up exciting possibilities for content creation, site management, and automation. By setting up the WordPress MCP server, you create a bridge that allows Claude to interact with your WordPress site in a secure, standardized way.

As AI assistants continue to evolve, these types of integrations will become increasingly powerful, enabling more sophisticated and helpful interactions between humans, AI, and the platforms we use every day.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).
Collabnixx
Chatbot
Join our Discord Server
Index