// guide

How to connect your WordPress site to Claude Code

Claude Code can manage your self-hosted WordPress site from the terminal — publishing posts, running WP-CLI, and editing theme files by request. Install the free Cowboy MCP plugin, generate an API key under Settings → Cowboy MCP, and run one claude mcp add command to register your site as a remote MCP server. It's fully self-hosted, with no Node.js bridge or proxy to run. New to MCP? Start with the WordPress MCP server guide.

// what you can ask

What can Claude Code do on your WordPress site once it's connected?

Once connected, Claude Code acts on your live site with real tools, not just code you paste in yourself. It can vibe code a theme or plugin, run WP-CLI commands, read the PHP error log to debug what broke, and make bulk edits across posts or WooCommerce products. Cowboy MCP exposes 137 WordPress tools that Claude Code calls straight from your terminal.

claude-code — cowboy-mcp
$ "Add a REST route to my theme that returns the 5 latest posts as JSON."
$ "Run wp plugin update --all, then run a site-health check."
$ "Read the error log and fix the fatal on the checkout page."
$ "Bump every Summer Sale product price 20% and clear the cache."
// setup

How do you connect Claude Code to WordPress in three steps?

Connecting takes three steps and one command. Install the Cowboy MCP plugin, generate an API key under Settings → Cowboy MCP, then run a single claude mcp add command in your terminal to register the site. Because Claude Code is a terminal client, it authenticates with that key over an HTTP Bearer header — there's no browser sign-in and no config file to hand-edit.

  1. 1

    Install the free plugin

    In WordPress, go to Plugins → Add New, search for Cowboy MCP, and click Install then Activate.

  2. 2

    Generate an API key

    Open Settings → Cowboy MCP, name a key on the Connection tab, and generate it — it's shown once, so copy it now.

  3. 3

    Run the add command

    Paste the one-line claude mcp add command below into your terminal, swapping in your site and key.

terminal — claude mcp add
$ claude mcp add --transport http your-site https://your-site.com/wp-json/cowboy-mcp/v1/endpoint --header "Authorization: Bearer YOUR_API_KEY"

Then open a new Claude Code session and run /mcp — your site should be listed as connected.

// architecture

Why doesn't Claude Code need a Node.js bridge to reach WordPress?

Many MCP setups run a local Node.js process that proxies requests between the AI and a remote service. Cowboy MCP needs none of that. The MCP endpoint is a standard WordPress REST route at /wp-json/cowboy-mcp/v1/endpoint, so Claude Code connects to your site directly over HTTPS — no bridge process, no npm install, and nothing extra to keep running. The plugin is itself the MCP server.

That means the setup survives reboots and laptop swaps: the connection lives on your server, not in a background daemon on your machine. It also means the same endpoint works for every MCP client — Claude Desktop and claude.ai, Cursor, Codex — so switching tools never means re-plumbing the site.

// safety

Is it safe to run Claude Code against your live production site?

Yes, with the same guardrails the plugin applies to every client. Safe mode is on by default, so destructive tools ask for confirmation before they run. Any write can be previewed as a dry run, every change lands in a per-change undo journal you can roll back, and requests are rate-limited to 120 per minute. It all runs on your own server. More on security →

// faq

Questions, answered.

Do I need Node.js or npm to connect Claude Code?

No. Cowboy MCP runs entirely inside WordPress as a REST endpoint, so there's no Node.js bridge, no npm install, and no local proxy to keep running. You only need Claude Code and the one-line claude mcp add command.

Where do I get the API key, and can I revoke it?

Generate it under Settings → Cowboy MCP on the Connection tab — it's shown once and stored only as a hash, so copy it right away. Every key is listed there with one-click revoke, and you can create a separate key per device.

What's the difference between Claude Code and Claude Desktop for WordPress?

Claude Code is the terminal client: you connect it with an API key and one command. Claude Desktop and claude.ai use a no-terminal browser sign-in instead. Both reach the same tools on your site — pick whichever you already work in.

Can I use it on a live production site?

Yes, with care. Safe mode asks before destructive actions, writes can be previewed as a dry run, and every change lands in an undo journal you can roll back. Take a database checkpoint before big changes, and review the audit log regularly.

// get started

Ready to connect Claude Code to your WordPress site?

Install the free, open-source Cowboy MCP plugin, generate an API key, and run one command — Claude Code is managing your site minutes later. It works on any self-hosted WordPress site running version 6.2 or newer on PHP 8.0+. If you'd rather use the browser than the terminal, the Claude Desktop and claude.ai guide covers the no-terminal path.