Most people using AI with WordPress are still copying text out of a chat window and pasting it into the editor. That is the slow way, and it is no longer the only way. You can connect AI tools directly to a WordPress site you host yourself and have them do the actual work: create and edit posts, install and configure plugins, run database queries, fix a broken theme, migrate content between sites. The AI drives WordPress; you supervise.
There are three ways to make that connection, and they build on each other. This is a step-by-step guide to all three, on a normal WordPress install running on your own hosting plan, not a managed sandbox. Pick the one that matches how you work, or set up all three. Read the guardrails section at the end before you point any of this at a live site.
The three ways to connect AI to WordPress
Each method below is a different door into the same house:
- WP-CLI over SSH lets an AI coding agent run WordPress commands directly on your server. Most direct, most powerful, needs SSH access.
- The REST API with an application password lets any AI tool that can make web requests read and write your content over HTTPS. No SSH required.
- MCP, the Model Context Protocol wraps your site’s capabilities into a set of tools an AI assistant can discover and call by itself, in plain language. This is the big change of the past year.
They are not mutually exclusive. In practice, the application password you create for method two is the same credential the MCP setup in method three uses.
Method 1: WP-CLI over SSH, step by step
WP-CLI is the command-line interface for WordPress. It manages posts, plugins, themes, users, the database, and caching without touching wp-admin. It has been the way experienced WordPress developers work for years, and it is exactly the interface modern AI coding agents like Claude Code, Cursor, and the Gemini CLI are built to use. Give an agent SSH access to your account and it can operate your site the way a developer would.
Step 1. Turn on SSH access. Shell access is off by default on most shared hosting for security. On our plans it is available on Medium and Professional, and we enable it on request. Once it is on, you will have an SSH username, your server’s hostname, and a port. Your connection command looks like this:
ssh youruser@yourserver.canspace.ca
Step 2. Confirm WP-CLI is there. WP-CLI is pre-installed on our servers. From your SSH session, change into your site’s directory and check it:
cd public_html
wp --info
wp core version
If those return version information, you are ready. If you host elsewhere and wp is not found, WP-CLI has to be installed on the server first, which needs shell access anyway.
Step 3. Point your AI coding agent at the session. The simplest setup is to run an AI coding tool inside your SSH session. Install Claude Code (or your agent of choice) on the server or connect it over SSH, open it in your site directory, and it can now read your files, read your logs, and run WP-CLI on your behalf. Instead of remembering commands, you describe the outcome:
- “Find every published post that mentions our old phone number and update it to the new one.” The agent writes a
wp search-replacethat handles WordPress’s serialized data safely, something a naive find-and-replace would corrupt. - “One of my plugins is throwing the fatal error in the log. Find it and deactivate it.” The agent reads the error log, checks status with
wp plugin list, and disables the offending plugin withwp plugin deactivate. - “Export the database, then bulk-import the posts from this CSV as drafts.” It runs
wp db exportfirst, then scripts the import. - “Regenerate all the image thumbnails and flush the cache.” Two commands it already knows.
This is the highest-leverage option because the agent is not limited to content. It can see error logs, run server-level diagnostics, and fix problems that never touch the WordPress admin. The trade-off is that it also has the most reach, which is why the guardrails below matter most here.
Method 2: The REST API and application passwords, step by step
If you do not have SSH access, or you want an AI tool to work with your site from somewhere else, WordPress has a full REST API built in. Every post, page, user, comment, and media item is reachable over HTTPS at /wp-json/wp/v2/. The AI does not need to be on your server. It just needs to make authenticated web requests.
The authentication trips people up, and it should not. WordPress has had application passwords built into core since version 5.6. They are separate credentials for programs, so you never hand out your real login.
Step 1. Create an application password. In wp-admin, go to Users, then Profile (or edit the specific user), and scroll to the Application Passwords section near the bottom. Type a name that tells you what it is for, such as “Claude” or “content bot,” and click Add New Application Password. WordPress shows you a 24-character password once, formatted with spaces like abcd EFGH 1234 wxyz 5678 ijkl. Copy it now, spaces and all. You cannot see it again.
Step 2. Test it. From any terminal, confirm the credential works by asking the API for your posts. Use your WordPress username and the application password together:
curl -u "yourusername:abcd EFGH 1234 wxyz 5678 ijkl" \
https://www.yoursite.com/wp-json/wp/v2/posts
You should get back a JSON list of posts. To prove you can write as well as read, create a draft:
curl -u "yourusername:abcd EFGH 1234 wxyz 5678 ijkl" \
-X POST https://www.yoursite.com/wp-json/wp/v2/posts \
-H "Content-Type: application/json" \
-d '{"title":"Created by the API","status":"draft"}'
Check your Drafts in wp-admin and it will be there.
Step 3. Hand the credential to your AI tool. Anything that can make HTTP requests, a custom script, an automation platform, or an AI assistant with web access, can now use that same username-and-application-password pair to manage your content. This is the route for automations and scheduled jobs rather than interactive terminal work. It is also the credential the MCP setup below uses.
To revoke access, go back to the same Application Passwords screen and click Revoke next to the entry. That instantly kills that one connection without affecting your login or any other tool. Create a separate application password per tool so you can cut one off cleanly.
Method 3: MCP, the standard that ties it together
The most significant change of the past year is MCP, the Model Context Protocol. It is an open standard for letting an AI assistant discover what a system can do and call those capabilities itself, in conversation, instead of you spelling out every command or API call.
WordPress moved on this quickly. Core 6.9 introduced the Abilities API, a standard way for WordPress and its plugins to declare what they can do. A plugin then exposes those abilities as MCP tools that Claude, Cursor, and other MCP-capable assistants can connect to. Once it is set up, you stop issuing commands and start delegating: “Draft a post summarizing our three most recent case studies, set a featured image, add it to the News category, and leave it as a draft for me to review.” The AI makes the right calls on its own.
Here is the setup on a self-hosted site, using Automattic’s WordPress MCP plugin and Claude as the client. You will need Node.js installed on your own computer for this, since the connector runs there.
Step 1. Install the plugin. Download the latest WordPress MCP plugin release from its GitHub releases page (search “Automattic wordpress-mcp”), then in wp-admin go to Plugins, Add New, Upload Plugin, upload the zip, and activate it.
Step 2. Enable MCP in the settings. Go to Settings, then WordPress MCP. Turn the feature on, and choose which operations to allow. Start conservative: enable read and create, leave update and delete off until you trust the workflow. This screen is your master switch and the first place to lock things down.
Step 3. Create an application password for the connection, exactly as in Method 2 above. (The plugin can also issue short-lived JWT tokens if you prefer; an application password is the simpler starting point.)
Step 4. Connect Claude to your site. If you use the Claude desktop app, open its configuration file and add your site as an MCP server. On macOS the file is at ~/Library/Application Support/Claude/claude_desktop_config.json; on Windows it is at %APPDATA%\Claude\claude_desktop_config.json. Add this, filling in your own site URL, username, and application password:
{
"mcpServers": {
"wordpress": {
"command": "npx",
"args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
"env": {
"WP_API_URL": "https://www.yoursite.com/",
"WP_API_USERNAME": "yourusername",
"WP_API_PASSWORD": "abcd EFGH 1234 wxyz 5678 ijkl"
}
}
}
}
If you use Claude Code in the terminal instead, you can add the same server with one command:
claude mcp add wordpress \
--env WP_API_URL=https://www.yoursite.com/ \
--env WP_API_USERNAME=yourusername \
--env "WP_API_PASSWORD=abcd EFGH 1234 wxyz 5678 ijkl" \
-- npx -y @automattic/mcp-wordpress-remote@latest
Step 5. Restart and test. Fully quit and reopen the Claude desktop app (config changes only load on start). Then ask it, “What WordPress tools do you have available?” It should list actions like listing posts, creating a post, and managing media. From there you are talking to your site in plain language.
One point worth stressing, because most of the coverage of WordPress and MCP misses it: this all works on a site you host yourself. A lot of the noise around WordPress and AI is really about WordPress.com’s paid managed offering, where MCP is bundled into higher plans. You do not need that. On your own WordPress install, on standard hosting, the plugin plus an application password gets you the same capability, under your control, with your content and your data staying exactly where you put them. (The plugin ecosystem here is moving fast, and the official direction is a core-level MCP adapter built on the 6.9 Abilities API, so expect the exact plugin to consolidate over the next few releases. The connection model, an MCP server on your site authenticated by an application password, is what will stick.)
Before you point any of this at a live site
Connecting an AI agent to a real site cuts both ways. The same access that fixes a broken theme in seconds can delete the wrong 200 posts just as fast if you are careless with instructions. None of this is a reason to avoid it. It is the difference between an AI that saves you an afternoon and one that costs you a weekend. Five rules from experience:
- Test on a staging copy first. Run the whole workflow where a mistake costs nothing, then move to production once you trust it. If your host offers one-click staging, use it.
- Use an application password, never your real admin password, and create a separate one per tool so you can revoke a single connection without disrupting the others.
- Give the AI a dedicated user account with the lowest role it needs. An assistant that only drafts posts should be an Author or Editor, not an Administrator. The MCP permission switches in Step 2 are a second layer on top of this.
- Back up before anything destructive. Ask the agent to export the database first; over WP-CLI that is a single
wp db export, and on a managed plan you have nightly backups to fall back on. - Read what it proposes before approving a bulk change. A search-replace across a live database, a mass delete, a plugin update on a busy store: review those, do not rubber-stamp them.
The bottom line
The gap between “AI can write about WordPress” and “AI can operate WordPress” closed this year. Between WP-CLI over SSH, the REST API with application passwords, and the new MCP plugins, you can hand an AI assistant real, scoped access to a site you host yourself and have it build and maintain that site with you, not just generate text you paste in later. What it takes on the hosting side is modest: shell access and WP-CLI for the direct route, or just an application password for the API and MCP routes. The tools are ready. The main thing between you and this workflow is setting it up once, and deciding how much you are comfortable letting the AI do.
Some readers will have noticed this article is on a hosting provider’s blog. Full disclosure: we’re CanSpace, a Canadian-incorporated company with all data centers in Canada and Canadian-staffed support. Everything above runs on a WordPress site you control, which is the entire point. Our Medium and Professional plans include the SSH access and WP-CLI that the most powerful of these methods needs, and every plan gives you the REST API and application passwords the other two use.
If you want to try this on a site that stays on Canadian soil, our WordPress hosting plans cover the specs, our web hosting page lays out what shell access and resources come with each tier, and if you are not sure whether your current plan can support this kind of workflow, send us the details and we’ll tell you straight.




