WordPress MCP

repository·trunk·Indexed 21 days ago

https://github.com/automattic/wordpress-mcp

A WordPress plugin that implements the Model Context Protocol (MCP) to expose site functionality to AI models. It provides standardized interfaces for tools, resources, and prompts, enabling AI assistants to interact with posts, users, site settings, and WooCommerce data. Supports both STDIO and Streamable transport protocols and includes a SchemaValidator for tool validation against official MCP and WordPress-specific schemas.

Tokens
22.9K
Snippets
54
Records
83
Agent score
74%

What's inside wordpress-mcp

  1. Overview of WordPress MCP capabilities

    trunk

    The WordPress Model Context Protocol (MCP) plugin allows external AI systems to interact with a WordPress site through three primary abstractions:

    • Tools: Executable actions the AI can request (e.g., create_post, get_user_details).
    • Resources: Data the AI can retrieve from the site (e.g., list_published_posts, get_site_options).
    • Prompts: Structured interaction templates designed for common AI tasks related to the site.

    The plugin acts as the server-side MCP endpoint within your WordPress installation.

  2. Understand MCP tool validation levels

    trunk

    The WordPress MCP plugin provides three distinct validation levels to suit different development stages:

    1. Strict (--level=strict): The most rigorous check for MCP specification compliance. It ignores any WordPress-specific metadata (like type, rest_alias, etc.). Use this when preparing tools for use in non-WordPress MCP implementations.
    2. Extended (--level=extended): The default level. It validates both the core MCP fields (name, description, title, inputSchema, outputSchema, annotations) and WordPress-specific extensions. Use this for standard WordPress MCP tool development.
    3. Permissive (--level=permissive): Uses the same rules as extended but treats all validation issues as warnings. It will not return a non-zero exit code, making it ideal for development, debugging, or migration scenarios where you want to see issues without breaking processes.
  3. Choose a Validation Level for MCP Tools

    trunk

    The plugin provides three distinct validation levels depending on your use case:

    • Strict MCP (validate_mcp_strict): Validates tools only against the official mcp-2025-06-18.json schema. It ignores all WordPress-specific fields. Use this when preparing tools for use in other MCP implementations that do not support WordPress extensions.
    • WordPress Extended (validate_wordpress_extended) [Default]: Validates against both the official MCP schema and the WordPress extensions schema. This allows for WordPress-specific fields and custom fields. This is the standard mode for WordPress MCP tool validation.
    • Permissive (validate_permissive): Functions like the Extended level but reports validation errors as warnings instead of hard failures. This is recommended for development, debugging, or during migrations.
  4. Understand WordPress MCP transport protocols

    trunk

    WordPress MCP provides two ways for clients to communicate with your WordPress site:

    1. Streamable Transport (Recommended for modern clients):

      • Endpoint: /wp-json/wp/v2/wpmcp/streamable
      • Protocol: Direct HTTP-based JSON-RPC 2.0.
      • Authentication: Requires JWT Tokens.
      • Proxy: No proxy required; connects directly to the WordPress site.
      • Best for: Low latency and direct integration with modern AI clients.
    2. STDIO Transport (Legacy/Compatibility):

      • Endpoint: /wp-json/wp/v2/wpmcp
      • Protocol: WordPress-style REST API.
      • Authentication: Supports both JWT Tokens and Application Passwords.
      • Proxy: Requires the mcp-wordpress-remote proxy to bridge the connection.
  5. Understand MCP Tool Validation Schemas

    trunk

    The WordPress MCP plugin uses JSON Schema definitions to validate MCP tools. There are two primary schema files used in the validation process:

    1. mcp-2025-06-18.json: The official Model Context Protocol specification schema used to ensure core MCP compliance.
    2. wordpress-mcp-extensions.json: A custom schema containing WordPress-specific extensions, such as type and rest_alias fields.

    Developers can use these schemas to ensure that tools being registered or used within the plugin adhere to both the standard MCP specification and the specific requirements of the WordPress MCP implementation.

  6. How WordPress MCP transport protocols work

    trunk

    The plugin implements two distinct transport layers to support different client capabilities:

    1. STDIO (Legacy/Proxy Compatibility):

      • Endpoint: /wp/v2/wpmcp
      • Format: WordPress-style
      • Authentication: Supports both JWT and Application Passwords.
      • Use Case: Best used with the mcp-wordpress-remote proxy for full feature support (like WooCommerce) and legacy compatibility.
    2. Streamable (Modern AI Clients):

      • Endpoint: /wp/v2/wpmcp/streamable
      • Format: JSON-RPC 2.0
      • Authentication: JWT only.
      • Use Case: Designed for modern HTTP-based MCP clients (like the VS Code MCP extension) that require direct JSON-RPC 2.0 communication.
  7. Configure authentication for WordPress MCP

    trunk

    Depending on your transport protocol and client, use one of the following authentication methods:

    • Usage: Required for Streamable transport. Highly recommended for all other methods due to better security.
    • Generation: Generate tokens via Settings > MCP > Authentication Tokens in the WordPress admin.
    • Lifecycle: Tokens expire in 1-24 hours (configurable).

    Application Passwords

    • Usage: Only works with STDIO transport via the mcp-wordpress-remote proxy.
    • Generation: Generate via Users > Profile > Application Passwords in the WordPress admin.
  8. How tool types and permissions work

    trunk

    MCP tools are categorized into four types, each with specific requirements for activation and usage:

    1. read: Used for retrieving data. These are always allowed if MCP is enabled.
    2. create: Used for creating new content. Requires the enable_create_tools setting to be active.
    3. update: Used for modifying existing content. Requires the enable_update_tools setting to be active.
    4. delete: Used for removing content. Requires the enable_delete_tools setting to be active.
  9. Security considerations for WordPress MCP

    trunk

    When using the WordPress MCP plugin, keep the following security principles in mind:

    • Permissions: By default, all MCP operations require administrator privileges within WordPress. The plugin relies on standard WordPress user capabilities for access control.
    • Trust: Only connect trusted MCP clients to your WordPress site to prevent unauthorized access.
  10. How WordPress MCP works

    trunk

    The WordPress MCP plugin implements the Model Context Protocol (MCP) to allow AI systems to interact with WordPress sites via a standardized interface. It uses a modular architecture consisting of:

    • Tools: Actions the AI can request the site to perform (e.g., creating posts).
    • Resources: Data the AI can request from the site (e.g., site settings).
    • Prompts: Pre-defined templates for common AI tasks.
    • REST API Endpoints: The plugin exposes a JSON-RPC style interface at /wp/v2/wpmcp for MCP clients to communicate with the site.
  11. Install the WordPress MCP plugin

    trunk

    You can install the plugin using either a quick manual installation or via Composer for development environments.

    Quick Install

    1. Download wordpress-mcp.zip from the releases page.
    2. Upload it to your /wp-content/plugins/wordpress-mcp directory.
    3. Activate the plugin through the WordPress admin 'Plugins' menu.
    4. Configure it by navigating to Settings > WordPress MCP.

    Composer Install (Development)

    Use this method if you are developing locally and need to manage dependencies and build assets:

    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