Skip to content

WP-CLI bridge

The WordPress MCP Adapter (bundled with EMCP Tools) ships a wp mcp-adapter serve command that exposes any registered MCP server as a stdio process. This is the lowest-latency way to talk to EMCP Tools: no HTTP, no sessions, no auth config.

  • WP-CLI installed and on PATH (or path-referenced explicitly)
  • EMCP Tools active (it bundles the MCP Adapter that provides the wp mcp-adapter command, so there is no separate plugin to install)
  • The plugin install accessible from the machine running WP-CLI
Terminal window
wp mcp-adapter list --path=/path/to/wordpress

Should print:

+-----------------------+----------+
| server_id | tool_count |
+-----------------------+----------+
| emcp-tools-server | 113 |
+-----------------------+----------+

(Tool count varies, see Requirements.)

If you get wp: command not found, install WP-CLI: https://wp-cli.org/

If you get Command 'mcp-adapter' not found, EMCP Tools isn’t active on that install (it provides the bundled adapter), or --path points at a different WordPress.

Terminal window
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | \
wp mcp-adapter serve --server=emcp-tools-server --user=admin --path=/path/to/wordpress

You should get an initialize response printed to stdout. If you don’t, check:

  • The --user exists in WordPress and has edit_posts
  • The --path is the absolute WordPress root path (the directory containing wp-config.php)

On a site whose environment type is local or development (set with WP_ENVIRONMENT_TYPE in wp-config.php), the Connection wizard generates the stdio config for you:

  1. Open EMCP Tools → Connection and, in step 1, pick Claude Desktop, Claude Code, Cursor or Antigravity (the clients that support stdio here).
  2. In step 2, choose WP-CLI on this computer (“The client starts WP-CLI directly. Local sites only.”). The option does not appear on other environment types.
  3. In step 3, copy the config (or, for Claude Code, the claude mcp add command). It runs wp mcp-adapter serve --server=emcp-tools-server as the administrator you are signed in as, with --path set to this install, and carries an EMCP_SETUP value that only lets step 4 recognise the first call. Leaving it in the config is harmless. Click I’ve added it, continue.
  4. Restart the client. Step 4 waits for its first MCP call and confirms it.

The command the config starts comes from the WP-CLI command field under EMCP Tools → Connection → 3rd-party services (default wp). On Windows, set it to your full php.exe and wp-cli.phar paths (see below) before you copy the config. WP-CLI requests appear in EMCP Tools → Safety → MCP Log like any other client.

For a hand-written config, see the matching guide for each client:

The VS Code MCP extension defaults to HTTP. Use HTTP there even on local dev, unless you have a specific reason to wire stdio.

For interactive testing without any AI client:

Terminal window
npx @modelcontextprotocol/inspector \
wp mcp-adapter serve --server=emcp-tools-server --user=admin --path=/path/to/wordpress

Inspector opens in a browser, lists every tool, and lets you call them with JSON arguments. Best way to learn what each tool returns and which arguments it accepts.

WP-CLI on Windows usually needs explicit paths to php.exe and wp-cli.phar. Replace wp in the commands above with:

"C:\laragon\bin\php\php-8.4.15-nts-Win32-vs17-x64\php.exe" "C:\wp-cli\wp-cli.phar"

(Adjust paths to your install.)