Skip to main content
Glama
README.md
# wp-content-mcp

MCP server for WordPress content — let an AI assistant (Claude Desktop,
Claude Code, Cursor, …) write blog posts and news, edit existing pages,
manage categories and tags and upload images, through natural language.

- **No plugin needed.** Works with any WordPress 5.6+ site over the standard
  REST API, authenticated with a built-in Application Password.
- **Drafts by default.** New content is saved as a draft; the assistant only
  publishes when you ask it to.
- **Precise edits.** `replace_text` changes one sentence or paragraph and
  leaves the rest of the page — including block markup — untouched.
- **Runs locally over stdio.** Your credentials stay on your machine; there is
  no telemetry and no proxy.

## Install

```bash
pip install wp-content-mcp
```

Requires Python 3.10+.

## Create an Application Password

In wp-admin go to **Users → Profile → Application Passwords**, enter a name
(e.g. "Claude") and click **Add New Application Password**. Copy the password
that appears; WordPress shows it only once.

Use an account with the **Editor** role (or Author, if it should only manage
its own posts) rather than an administrator.

```bash
export WP_URL=https://example.com
export WP_USERNAME=your-username
export WP_APP_PASSWORD="abcd efgh ijkl mnop qrst uvwx"
```

`WP_URL` must use `https://`. For a local test site, set `WP_ALLOW_HTTP=1`.

## Register in your MCP client

**Claude Code:**

```bash
claude mcp add wordpress \
  -e WP_URL=https://example.com \
  -e WP_USERNAME=your-username \
  -e WP_APP_PASSWORD="abcd efgh ijkl mnop qrst uvwx" \
  -- wp-content-mcp
```

**Claude Desktop** (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "wordpress": {
      "command": "wp-content-mcp",
      "env": {
        "WP_URL": "https://example.com",
        "WP_USERNAME": "your-username",
        "WP_APP_PASSWORD": "abcd efgh ijkl mnop qrst uvwx"
      }
    }
  }
}
```

## Tools

| Tool | What it does |
|------|--------------|
| `whoami` | Site name, logged-in user, roles and permissions |
| `list_posts` | Find posts or pages (search, status, paging) |
| `get_post` | Read one post or page including its editable content |
| `create_post` | New post or page — draft unless you ask to publish |
| `update_post` | Change title, content, status, excerpt, slug, categories, tags, featured image or date |
| `replace_text` | Replace one passage in a post or page |
| `trash_post` | Move to trash (recoverable) |
| `list_terms` | List categories or tags |
| `upload_media` | Upload an image, video, audio file or PDF |
| `wp_request` | Call any other REST endpoint |

Categories and tags are passed by name; missing ones are created.
Custom post types work too: pass their REST base as `post_type`.

## Example prompts

- "Write a news post about our new opening hours in the category News, as a draft."
- "On the Contact page, change the phone number to 020 123 4567."
- "Show me all draft posts and publish the one about the summer sale."
- "Upload ~/Pictures/team.jpg with alt text 'Our team' and use it as the featured image of post 128."

## How this differs from WordPress/mcp-adapter

The official [mcp-adapter](https://github.com/WordPress/mcp-adapter) is a
framework for developers: it is a plugin that exposes *abilities* that other
plugins register, via WP-CLI or an HTTP proxy. `wp-content-mcp` is a ready-made
content tool: nothing to install on the site, ten tools that cover everyday
editing work, set up in two minutes.

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

AGPL-3.0-or-later, see [LICENSE](LICENSE). A commercial license is available,
see [LICENSE-COMMERCIAL.md](LICENSE-COMMERCIAL.md).

WordPress is a registered trademark of the WordPress Foundation. This project
is not affiliated with or endorsed by the WordPress Foundation.