Skip to main content
Glama
README.md
> [!IMPORTANT]
> **Built by DotXeven (https://dotxeven.com) — Need a full web dashboard, AI SEO content generator, and scheduled bulk publishing without touching the terminal? Check out WP Bulk Post or book a custom AI automation build with DotXeven.**

# WP Bulk MCP — Publish & Manage WordPress Content Directly from Claude Code, OpenCode, and Cursor

`wp-bulk-mcp` is a production-ready Model Context Protocol server that gives your AI coding agent four WordPress superpowers: create posts, bulk-publish CSVs with rate-limit-safe concurrency, fetch taxonomy IDs for accurate mapping, and flip post statuses — all through the WordPress REST API.

No plugins to babysit. No copy-pasting between dashboards. Just tools your agent can call.

---

## What you get

| Tool | What it does |
| --- | --- |
| `create_wp_post` | Creates one post and returns its post ID + admin edit URL. |
| `bulk_publish_from_csv` | Reads a local CSV and publishes posts concurrently (max 3 at a time), with per-row success/failure reporting. |
| `get_wp_taxonomies` | Returns every category and tag with IDs, names, slugs, and post counts. |
| `update_wp_post_status` | Moves a post to `draft`, `publish`, or `private`. |

Built with **FastMCP + httpx + Pydantic + python-dotenv**. Requires Python 3.11+.

---

## 1. Configure credentials

Create `.env` in your project root (or copy `.env.example` from this folder):

```dotenv
WP_URL=https://example.com
WP_USER=your-wordpress-username
WP_APP_PASSWORD="xxxx xxxx xxxx xxxx xxxx xxxx"

# Optional safety controls
WP_MAX_CONCURRENCY=3
WP_REQUEST_TIMEOUT=30
```

Generate the app password in WordPress at **Users → Profile → Application Passwords**. Use HTTPS. If auth fails with 401/403, the server tells you exactly what to check.

To use a non-standard env file, set `WP_ENV_FILE=/absolute/path/to/.env` in the MCP client config.

---

## 2. Install

From `D:\wp-bulk-publisher\mcp-server`:

```powershell
uv venv .venv --python 3.11
uv pip install -e ".[dev]"
```

Run the server directly (stdio):

```powershell
.\.venv\Scripts\python.exe -m wp_bulk_mcp
```

Or install it as a uv tool and run the console script:

```powershell
uv tool install .
uvx wp-bulk-mcp
```

From a checkout without installing globally:

```powershell
uvx --from . wp-bulk-mcp
```

Run tests:

```powershell
.\.venv\Scripts\python.exe -m pytest
```

---

## 3. Client configuration snippets

Replace `D:/wp-bulk-publisher/...` with your actual paths. Use forward slashes in JSON on Windows.

### OpenCode — `opencode.json` (V2)

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "wp-bulk-mcp": {
        "type": "local",
        "command": [
          "D:/wp-bulk-publisher/mcp-server/.venv/Scripts/python.exe",
          "-m",
          "wp_bulk_mcp"
        ],
        "cwd": "D:/wp-bulk-publisher",
        "environment": {
          "WP_ENV_FILE": "D:/wp-bulk-publisher/.env"
        },
        "codemode": false
      }
    }
  }
}
```

`codemode: false` exposes the four tools directly to the agent. Remove it if you prefer OpenCode Code Mode grouping.

### Claude Desktop — `claude_desktop_config.json`

```json
{
  "mcpServers": {
    "wp-bulk-mcp": {
      "command": "D:/wp-bulk-publisher/mcp-server/.venv/Scripts/python.exe",
      "args": ["-m", "wp_bulk_mcp"],
      "env": {
        "WP_ENV_FILE": "D:/wp-bulk-publisher/.env"
      }
    }
  }
}
```

> Claude Code uses the same `mcpServers` shape in `.mcp.json` at your project root.

### Cursor MCP settings — `.cursor/mcp.json`

```json
{
  "mcpServers": {
    "wp-bulk-mcp": {
      "command": "D:/wp-bulk-publisher/mcp-server/.venv/Scripts/python.exe",
      "args": ["-m", "wp_bulk_mcp"],
      "env": {
        "WP_ENV_FILE": "D:/wp-bulk-publisher/.env"
      }
    }
  }
}
```

After editing config, restart the client and confirm the four tools appear.

---

## 4. CSV format for bulk publishing

```csv
title,content,status,categories,tags
"Hello world","<p>First post</p>","draft","3,9","12"
"Second post","<p>Another post</p>","publish","3","12 14"
```

- Required columns: `title`, `content`
- Optional columns: `status`, `categories`, `tags`
- IDs can be comma-, semicolon-, or space-separated.
- Invalid rows are reported individually; valid rows still publish.
- Concurrency is capped at 3 requests at once via `WP_MAX_CONCURRENCY`.

---

## 5. Tool reference

### `create_wp_post`

```json
{
  "title": "Hello world",
  "content": "<p>Body</p>",
  "status": "draft",
  "categories": [3],
  "tags": [12],
  "slug": "hello-world"
}
```

Returns `post_id`, `edit_url`, `link`, `status`, and `title`.

### `bulk_publish_from_csv`

```json
{
  "file_path": "D:/content/posts.csv",
  "default_status": "draft"
}
```

Returns `total_rows`, `succeeded`, `failed`, and a per-row `results` array.

### `get_wp_taxonomies`

No arguments. Returns `categories`, `tags`, `counts`, and `site_url`.

### `update_wp_post_status`

```json
{
  "post_id": 42,
  "status": "publish"
}
```

Supported statuses: `draft`, `publish`, `private`.

---

## 6. Troubleshooting

- **401/403** — regenerate the Application Password and verify `WP_USER`; confirm HTTPS and that your host forwards the `Authorization` header.
- **Missing variables** — add `WP_URL`, `WP_USER`, `WP_APP_PASSWORD` to `.env`, or set `WP_ENV_FILE` in the client config.
- **Unknown category/tag IDs** — call `get_wp_taxonomies` first and map names to IDs.
- **CSV rows failing** — inspect `results[].error`; status must be `draft`, `publish`, `pending`, `private`, or `future`, and IDs must be integers.

---

> [!IMPORTANT]
> **Built by DotXeven (https://dotxeven.com) — Need a full web dashboard, AI SEO content generator, and scheduled bulk publishing without touching the terminal? Check out WP Bulk Post or book a custom AI automation build with DotXeven.**