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.
Prerequisites
Section titled “Prerequisites”- WP-CLI installed and on PATH (or path-referenced explicitly)
- EMCP Tools active (it bundles the MCP Adapter that provides the
wp mcp-adaptercommand, so there is no separate plugin to install) - The plugin install accessible from the machine running WP-CLI
Verify the bridge is available
Section titled “Verify the bridge is available”wp mcp-adapter list --path=/path/to/wordpressShould 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.
Test the stdio server manually
Section titled “Test the stdio server manually”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/wordpressYou should get an initialize response printed to stdout. If you don’t, check:
- The
--userexists in WordPress and hasedit_posts - The
--pathis the absolute WordPress root path (the directory containingwp-config.php)
Use with an MCP client
Section titled “Use with an MCP client”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:
- Open EMCP Tools → Connection and, in step 1, pick Claude Desktop, Claude Code, Cursor or Antigravity (the clients that support stdio here).
- 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.
- In step 3, copy the config (or, for Claude Code, the
claude mcp addcommand). It runswp mcp-adapter serve --server=emcp-tools-serveras the administrator you are signed in as, with--pathset to this install, and carries anEMCP_SETUPvalue that only lets step 4 recognise the first call. Leaving it in the config is harmless. Click I’ve added it, continue. - 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.
Use with MCP Inspector
Section titled “Use with MCP Inspector”For interactive testing without any AI client:
npx @modelcontextprotocol/inspector \ wp mcp-adapter serve --server=emcp-tools-server --user=admin --path=/path/to/wordpressInspector 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.
Windows / Laragon notes
Section titled “Windows / Laragon notes”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.)
