WordPress MCP Server

MCP server for WordPress. Manage posts, users, comments, terms, metadata, and settings.

8No licenseother

Install

Config snippet generator goes here (5 client tabs)

README

# wp-mcp

`@rnaga/wp-mcp` is a Model Context Protocol (MCP) server for WordPress that turns your site into an AI-operable surface. By exposing WordPress CRUD primitives to clients like Claude Desktop, an assistant can draft a post on demand, refine it collaboratively, and publish it straight into your database—no trip through wp-admin required.

Here are a few common scenarios this unlocks:

- Draft, revise, and publish posts directly from MCP clients such as Claude Desktop.
- Inspect WordPress users, their roles, and capabilities to audit site permissions or generate access reports.

Built on top of [`@rnaga/wp-node`](https://github.com/rnaga/wp-node), the server ships with a curated MCP toolset covering posts, users, comments, terms, revisions, metadata, options, and site settings. The MCP server can manage the following database tables/resources:

| Resource           | What you can do                                                                        |
| ------------------ | -------------------------------------------------------------------------------------- |
| Posts              | Create, update, read, or delete posts and their revisions.                             |
| Comments           | Moderate discussion threads or inject generated replies.                               |
| Users              | Onboard contributors, adjust roles, or disable accounts with native capability checks. |
| Terms              | Manage categories, tags, and custom taxonomies.                                        |
| Metadata           | Inspect, create, update, or delete post, user, comment, term, and site meta fields.    |
| Settings & Options | Toggle site-level configuration safely.                                                |

You can spin up a **STDIO server** for direct database access or host a **Streamable HTTP MCP server** for remote access. For convenience, layer on the **CLI proxy** whenever your MCP client needs a local bridge to the HTTP server. The proxy behaves like a local MCP server while relaying requests to the HTTP endpoint—perfect for clients that lack OAuth or WordPress Application Password support—so you can fit MCP workflows into existing editorial pipelines without re-implementing WordPress business logic.

The project includes a CLI (`wp-mcp`) that helps you:

- configure and launch a local STDIO MCP server that connects straight to your WordPress database;
- scaffold and initialize an Express-based Streamable HTTP MCP server (with env/TS boilerplate);
- authenticate against a remote WordPress environment (OAuth or Application Password) and run a JSON-RPC proxy so MCP clients can reach it securely;
- inspect available MCP primitives and manage the credentials stored under `~/.wp-mcp`.

Run this command to list the available CLI commands:

```
npx @rnaga/wp-mcp -- --help
```

```
Usage: <command> <subcommand> [options]

Commands:
   local            Local MCP (stdio) server commands
   utils            Utility commands for configuration, debugging, and MCP inspection
   http             Scaffold a TypeScript project for the MCP streamable HTTP server and related tooling.
   remote           Remote MCP server commands
```

Together, the server, CLI utilities, and proxy tooling let you CRUD WordPress content, manage users, and sync settings through the MCP standard without re-implementing WordPress logic.

## Getting Started

### Local STDIO server

Run the STDIO server when you can reach the database directly. The CLI launches an MCP process that assumes a WordPress user locally and exposes your site's tools over STDIO to the MCP client.

```mermaid
flowchart LR
  client(["MCP Client<br/>(e.g. Claude Desktop)"])
  stdio(["Local STDIO MCP Server<br/>(wp-mcp CLI)"])
  db(["WordPress Database"])

  client <--> stdio
  stdio <--> db
```

1. Run the CLI to set up the database connection:
   ```sh
   npx @rnaga/wp-mcp -- local config-set
   ```
   The CLI prompts you for `host`, `port`, `database name`, `user`, and `password`. If your database requires SSL, you can provide CA, cert, and key file paths to secure remote access. Run `npx @rnaga/wp-mcp local config` anytime to review the saved values.
2. Configure your MCP client to launch the server. For **Claude Desktop**, open Settings → Developer → Edit Config and add this to your `claude_desktop_config.json`:

   ```json
   {
     "mcpServers": {
       "wp-mcp": {
         "command": "npx",
         "args": ["-y", "@rnaga/wp-mcp", "--", "local", "start"],
         "env": {
           "LOCAL_USERNAME": "wp-admin"
         }
       }
     }
   }
   ```

   **Activate the server:** Save the config file, then quit and restart your MCP client (for example, Claude Desktop). The WordPress tools will now appear in the MCP indicator at the bottom right of the chat input.

   **Important:** Replace `wp-admin` with your WordPress username. The server uses this to determine which MCP primitives are available based on the user's WordPress capabilities