WP Manifestindependent plugin directory
manifest / ai / claude2blog

Claude Publisher Ability

A complete MCP (Model Context Protocol) integration for WordPress that enables AI assistants like Claude to publish blog posts directly through conversation.

by Lax Mariappan · github.com/laxmariappan/claude2blog · website

4stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/laxmariappan/claude2blog/archive/refs/heads/main.zip

A complete MCP (Model Context Protocol) integration for WordPress that enables AI assistants like Claude to publish blog posts directly through conversation.

GitHub Repository: github.com/laxmariappan/claude2blog

Overview

This plugin allows Claude Code and Claude Desktop to publish and update WordPress posts using the MCP protocol, eliminating the need to copy-paste content between applications.

Read the full story: How I Added AI-Powered Content Creation to My WordPress Blog with MCP

Features

  • ✅ Publish new posts with title, content, categories, tags, and more
  • ✅ Update existing posts
  • ✅ List recent posts
  • ✅ Works with Claude Code (VS Code) and Claude Desktop
  • ✅ Supports draft, publish, pending, and private post statuses
  • ✅ Full category and tag support
  • ✅ Custom excerpts
  • ✅ Author assignment

Requirements

  • WordPress 6.9 or newer (Abilities API)
  • PHP 7.4 or higher
  • MCP Adapter plugin installed and active
  • Node.js (for the MCP bridge)
  • Claude Code or Claude Desktop

Installation

1. Install the WordPress Plugin

Copy the claude-publisher-ability.php file to your WordPress plugins directory:

wp-content/plugins/claude-publisher-ability/claude-publisher-ability.php

Activate the plugin:

  • Go to WordPress Admin → Plugins
  • Find "Claude Publisher Ability"
  • Click "Activate"

2. Install the MCP Adapter Plugin

Install via WordPress Admin or WP-CLI:

wp plugin install mcp-adapter --activate

3. Set Up the MCP Bridge

For Claude Code (VS Code):

  1. Copy mcp-stdio-bridge.js and mcp-bridge-wrapper.sh to a directory on your system
  2. Update mcp-bridge-wrapper.sh with your credentials:
export WP_API_URL="https://yoursite.com"
export WP_API_USERNAME="your-username"
export WP_API_PASSWORD="your-application-password"
  1. Add the MCP server:
claude mcp add --transport stdio wordpress -- /path/to/mcp-bridge-wrapper.sh

For Claude Desktop:

Create or update ~/Library/Application Support/Claude/claude_desktop_config.json (Mac) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "wordpress": {
      "command": "node",
      "args": ["/path/to/mcp-stdio-bridge.js"],
      "env": {
        "WP_API_URL": "https://yoursite.com",
        "WP_API_USERNAME": "your-username",
        "WP_API_PASSWORD": "your-application-password"
      }
    }
  }
}

4. Create a WordPress Application Password

  1. Go to WordPress Admin → Users → Profile
  2. Scroll down to "Application Passwords"
  3. Enter a name (e.g., "Claude MCP")
  4. Click "Add New Application Password"
  5. Copy the generated password (it will have spaces)
  6. Use this password in your MCP configuration

Usage

Once configured, you can simply chat with Claude in VS Code or Claude Desktop:

"Write a blog post about React hooks and publish it as a draft to my WordPress site"

Claude will:

  1. Generate the blog post content
  2. Call the claude_publish_post ability via MCP
  3. Create the post on your WordPress site
  4. Provide you with the post URL and edit link

Available Abilities

claude_publish_post

Publishes a new blog post.

Parameters:

  • title (required): Post title
  • content (required): Post content (HTML allowed)
  • status (optional): draft, publish, pending, or private (default: draft)
  • categories (optional): Array of category IDs
  • tags (optional): Array of tag IDs
  • excerpt (optional): Post excerpt
  • author_id (optional): Author user ID

claude_update_post

Updates an existing blog post.

Parameters:

  • post_id (required): ID of post to update
  • All other parameters same as claude_publish_post (all optional)

claude_list_posts

Lists recent posts.

Parameters:

  • limit (optional): Number of posts to return (max 50, default 10)
  • status (optional): Filter by status (publish, draft, etc.)

Architecture

┌─────────────────┐
│  Claude Code    │
│  Claude Desktop │
└────────┬────────┘
         │
         │ STDIO (JSON-RPC 2.0, MCP 2025-06-18)
         │
┌────────▼────────┐
│  MCP Bridge     │  ← Session ID persistence
│  (Node.js)      │  ← Protocol translation
└────────┬────────┘
         │
         │ HTTP + Auth + Mcp-Session-Id header
         │ (MCP 2024-11-05)
         │
┌────────▼────────────────────┐
│  WordPress MCP Endpoint     │
│  /wp-json/mcp/...           │  ← Session validation
└────────┬────────────────────┘
         │
         │ Abilities API
         │
┌────────▼────────────────────┐
│  Claude Publisher Plugin    │
│  wp_register_ability()      │
└────────┬────────────────────┘
         │
         │ WordPress Core
         │
┌────────▼────────────────────┐
│  wp_insert_post()           │
│  wp_update_post()           │
└─────────────────────────────┘

Session Management

The WordPress MCP Adapter requires session management (WordPress-specific, not standard MCP):

  1. Client sends initialize request without session ID
  2. WordPress creates session and returns Mcp-Session-Id header
  3. Bridge captures and stores the session ID
  4. All subsequent requests include the same Mcp-Session-Id header
  5. Sessions expire after 24 hours of inactivity
  6. Maximum 32 sessions per user (configurable)

Note: This session requirement is specific to WordPress MCP Adapter. Other MCP implementations may not require sessions.

Files

  • claude-publisher-ability.php - WordPress plugin that registers publishing abilities
  • mcp-stdio-bridge.js - Node.js bridge connecting MCP protocol to WordPress HTTP endpoint
  • mcp-bridge-wrapper.sh - Shell wrapper with environment variables (for Claude Code)

Security

  • Uses WordPress Application Passwords for authentication
  • Requires publish_posts capability
  • All inputs are sanitized using WordPress functions
  • HTTPS recommended for production use

Troubleshooting

MCP server not connecting

  1. Verify the bridge script is executable: chmod +x mcp-bridge-wrapper.sh
  2. Check credentials are correct
  3. Ensure WordPress site is accessible
  4. Restart Claude Desktop/Code

"Invalid or expired session" errors

This is fixed in the current version. If you encounter this:

  1. Ensure you're using the latest mcp-stdio-bridge.js
  2. The bridge should automatically capture and reuse session IDs
  3. Sessions expire after 24 hours - restart the MCP server if inactive for long periods

Posts not publishing

  1. Verify MCP Adapter plugin is active
  2. Check user has publish_posts capability
  3. Check WordPress error logs
  4. Verify session is valid (check MCP server connection)

SSL certificate errors (local development)

The bridge includes rejectUnauthorized: false for local .test domains. Remove this for production.

Contributing

Contributions welcome! Please submit issues and pull requests on GitHub.

License

GPL v2 or later

Credits

Created by Lax Mariappan

Built with: