P

WordPress MCP Server

Created Apr 29, 2025 by Automattic

Language:

PHP

Stars:

733

Forks:

105

README

This repository will be deprecated as the mcp-adapter AI Building Block for WordPress continues releasing stable versions.

The shift aligns with two important developments:

  • The Abilities API is moving into WordPress Core as of version 6.9.
  • mcp-adapter is now stable and will become the canonical plugin and Composer package for MCP integration in WordPress.

We encourage all users to migrate to mcp-adapter. Future work, including new features and fixes, will happen there. This repository will remain available in archived form for historical reference.

WordPress MCP

Latest Release

A comprehensive WordPress plugin that implements the Model Context Protocol (MCP) to expose WordPress functionality through standardized interfaces. This plugin enables AI models and applications to interact with WordPress sites securely using multiple transport protocols and enterprise-grade authentication.

Features

  • Dual Transport Protocols: STDIO and HTTP-based (Streamable) transports
  • JWT Authentication: Secure token-based authentication with management UI
  • Admin Interface: React-based token management and settings dashboard
  • AI-Friendly APIs: JSON-RPC 2.0 compliant endpoints for AI integration
  • Extensible Architecture: Custom tools, resources, and prompts support
  • WordPress Feature API: Adapter for standardized WordPress functionality
  • Experimental REST API CRUD Tools: Generic tools for any WordPress REST API endpoint
  • Comprehensive Testing: 200+ test cases covering all protocols and authentication
  • High Performance: Optimized routing and caching mechanisms
  • Enterprise Security: Multi-layer authentication and audit logging

Architecture

The plugin implements a dual transport architecture:

WordPress MCP Plugin
├── Transport Layer
│   ├── McpStdioTransport (/wp/v2/wpmcp)
│   └── McpStreamableTransport (/wp/v2/wpmcp/streamable)
├── Authentication
│   └── JWT Authentication System
├── Method Handlers
│   ├── Tools, Resources, Prompts
│   └── System & Initialization
└── Admin Interface
    └── React-based Token Management

Transport Protocols

Protocol Endpoint Format Authentication Use Case
STDIO /wp/v2/wpmcp WordPress-style JWT + App Passwords Legacy compatibility
Streamable /wp/v2/wpmcp/streamable JSON-RPC 2.0 JWT only Modern AI clients

Installation

Quick Install

  1. Download wordpress-mcp.zip from releases
  2. Upload to /wp-content/plugins/wordpress-mcp directory
  3. Activate through WordPress admin 'Plugins' menu
  4. Navigate to Settings > WordPress MCP to configure

Composer Install (Development)

cd wp-content/plugins/
git clone https://github.com/Automattic/wordpress-mcp.git
cd wordpress-mcp
composer install --no-dev
npm install && npm run build

Authentication Setup

JWT Token Generation

  1. Go to Settings > WordPress MCP > Authentication Tokens
  2. Select token duration (1-24 hours)
  3. Click "Generate New Token"
  4. Copy the token for use in your MCP client

MCP Client Configuration

Claude Desktop Configuration using mcp-wordpress-remote proxy

Add to your Claude Desktop claude_desktop_config.json:

{
    "mcpServers": {
        "wordpress-mcp": {
            "command": "npx",
            "args": [ "-y", "@automattic/mcp-wordpress-remote@latest" ],
            "env": {
                "WP_API_URL": "https://your-site.com/",
                "JWT_TOKEN": "your-jwt-token-here",
                "LOG_FILE": "optional-path-to-log-file"
            }
        }
    }
}

Using Application Passwords (Alternative)

{
    "mcpServers": {
        "wordpress-mcp": {
            "command": "npx",
            "args": [ "-y", "@automattic/mcp-wordpress-remote@latest" ],
            "env": {
                "WP_API_URL": "https://your-site.com/",
                "WP_API_USERNAME": "your-username",
                "WP_API_PASSWORD": "your-application-password",
                "LOG_FILE": "optional-path-to-log-file"
            }
        }
    }
}

VS Code MCP Extension (Direct Streamable Transport)

Add to your VS Code MCP settings:

{
    "servers": {
        "wordpress-mcp": {
            "type": "http",
            "url": "https://your-site.com/wp-json/wp/v2/wpmcp/streamable",
            "headers": {
                "Authorization": "Bearer your-jwt-token-here"
            }
        }
    }
}

MCP Inspector (Development/Testing)

# Using JWT Token with proxy
npx @modelcontextprotocol/inspector \
  -e WP_API_URL=https://your-site.com/ \
  -e JWT_TOKEN=your-jwt-token-here \
  npx @automattic/mcp-wordpress-remote@latest

# Using Application Password with proxy
npx @modelcontextprotocol/inspector \
  -e WP_API_URL=https://your-site.com/ \
  -e WP_API_USERNAME=your-username \
  -e WP_API_PASSWORD=your-application-password \
  npx @automattic/mcp-wordpress-remote@latest

Local Development Configuration

{
    "mcpServers": {
        "wordpress-local": {
            "command": "node",
            "args": [ "/path/to/mcp-wordpress-remote/dist/proxy.js" ],
            "env": {
                "WP_API_URL": "http://localhost:8080/",
                "JWT_TOKEN": "your-local-jwt-token",
                "LOG_FILE": "optional-path-to-log-file"
            }
        }
    }
}

Usage

With MCP Clients

This plugin works seamlessly with MCP-compatible clients in two ways:

Via Proxy:

  • mcp-wordpress-remote - Official MCP client with enhanced features
  • Claude Desktop with proxy configuration for full WordPress and WooCommerce support
  • Any MCP client using the STDIO transport protocol

Direct Streamable Transport:

  • VS Code MCP Extension connecting directly to /wp/v2/wpmcp/streamable
  • Custom HTTP-based MCP implementations using JSON-RPC 2.0
  • Any client supporting HTTP transport with JWT authentication

The streamable transport provides a direct JSON-RPC 2.0 compliant endpoint, while the proxy offers additional features like WooCommerce integration, enhanced logging, and compatibility with legacy authentication methods.

Available MCP Methods

Method Description Transport Support
initialize Initialize MCP session Both
tools/list List available tools Both
tools/call Execute a tool Both
resources/list List available resources Both
resources/read Read resource content Both
prompts/list List available prompts Both
prompts/get Get prompt template Both

Experimental REST API CRUD Tools

EXPERIMENTAL FEATURE: This functionality is experimental and may change or be removed in future versions.

When enabled via Settings > WordPress MCP > Enable REST API CRUD Tools, the plugin provides three powerful generic tools that can interact with any WordPress REST API endpoint:

Available Tools

Tool Name Description Type
list_api_functions Discover all available WordPress REST API endpoints Read
get_function_details Get detailed metadata for specific endpoint/method Read
run_api_function Execute any REST API function with CRUD operations Action

Usage Workflow

  1. Discovery: Use list_api_functions to see all available endpoints
  2. Inspection: Use get_function_details to understand required parameters
  3. Execution: Use run_api_function to perform CRUD operations

Security & Permissions

  • User Capabilities: All operations respect current user permissions
  • Settings Control: Individual CRUD operations can be disabled in settings:
    • Enable Create Tools (POST operations)
    • Enable Update Tools (PATCH/PUT operations)
    • Enable Delete Tools (DELETE operations)
  • Automatic Filtering: Excludes sensitive endpoints (JWT auth, oembed, autosaves, revisions)

Benefits

  • Universal Access: Works with any WordPress REST API endpoint, including custom post types and third-party plugins
  • AI-Friendly: Provides discovery and introspection capabilities for AI agents
  • Standards Compliant: Uses standard HTTP methods (GET, POST, PATCH, DELETE)
  • Permission Safe: Inherits WordPress user capabilities and respects endpoint permissions

Development

Project Structure

wp-content/plugins/wordpress-mcp/
├── includes/                   # PHP classes
│   ├── Core/                  # Transport and core logic
│   ├── Auth/                  # JWT authentication
│   ├── Tools/                 # MCP tools
│   ├── Resources/             # MCP resources
│   ├── Prompts/               # MCP prompts
│   └── Admin/                 # Settings interface
├── src/                       # React components
│   └── settings/              # Admin UI components
├── tests/                     # Test suite
│   └── phpunit/              # PHPUnit tests
└── docs/                      # Documentation

Adding Custom Tools

You can extend the MCP functionality by adding custom tools through your own plugins or themes. Create a new tool class in your plugin or theme:

Last updated: Jan 20, 2026

More MCP servers built with PHP

Bagisto

Free and open source laravel eCommerce platform

By bagisto 25.1K
Matomo

Empowering People Ethically 🚀 — Matomo is hiring! Join us → https://matomo.org/jobs Matomo is the leading open-source alternative to Google Analytics, giving you complete control and built-in privacy. Easily collect, visualise, and analyse data from websites & apps. Star us on GitHub ⭐️ – Pull Requests welcome!

By matomo-org 21.2K
Grav CMS

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony

By getgrav 15.4K