AI agents can do more than write text. Connected to your WordPress site, they can look up information and, if you allow it, create or change things. The Model Context Protocol (MCP) is an open standard that makes this connection possible.
The setup is not the hard part. The real question is what the agent is allowed to do, and what happens when it gets something wrong. This guide shows how to connect through the official WordPress MCP Adapter, start with read-only access, and keep a human in control.
Quick Answer
- Use a staging site first, with a tested backup.
- Install the official MCP Adapter plugin (WordPress 6.9 or later).
- Create a dedicated, low-privilege user for the agent. Do not connect your admin account.
- Expose only the abilities you need, starting with read-only ones.
- Require approval for anything that changes data, and know how to revoke access.
What Is MCP in WordPress?
MCP gives AI applications a standard way to discover and call external tools. In WordPress, these parts work together:
| Part | What it does |
|---|---|
| AI client | The app you chat with, which asks to use tools |
| MCP Adapter | The server and transport layer on your WordPress site |
| Abilities API | A registry of actions, each with inputs, outputs and a permission check |
| WordPress user | The identity the agent signs in as |

The official MCP Adapter plugin turns WordPress abilities into MCP tools, resources and prompts. It does not add AI features by itself. The Abilities API has been part of WordPress core since version 6.9.
The Default Server
The adapter creates a default server at /wp-json/mcp/mcp-adapter-default-server. It gives the agent three tools:
mcp-adapter/discover-abilities: find available abilitiesmcp-adapter/get-ability-info: read how one ability worksmcp-adapter/execute-ability: run an ability
Important: because one tool can execute many abilities, approving “execute ability” without reading the details is risky. Always check which ability is being called and with what input.
Understand the Risks First
1. Too Much Access
The agent connects as a WordPress user. If that user is an administrator, any exposed ability that checks admin permissions will accept it. Mistakes then have a much bigger impact.
2. Prompt Injection
An agent may read comments, form entries, product reviews or web pages. Someone can hide instructions inside that text, and the AI may treat them as commands. No prompt such as “ignore malicious instructions” fully prevents this. Limit what the agent can reach and do.

3. Untrusted or Vulnerable MCP Software
An MCP plugin adds a new way into your site. Several third-party WordPress MCP-related plugins had serious authorization flaws reported in 2026:
- CVE-2026-110732: AI Engine versions up to 3.8.6, involving its MCP OAuth feature and administrator account takeover.
- CVE-2026-15015: MountDev AI MCP Connector versions up to 1.6.1, an authorization bypass.
- CVE-2026-131688: Secure MCP Server (miniOrange) versions up to 1.5.8, an authorization bypass.
These reports are about those specific plugins and versions, not the official MCP Adapter. They do not prove that any software is risk-free. If you use one of them, check the vendor’s latest fix status and update or disable it.
4. Data Leaving Your Site
Whatever a tool returns can be sent to your AI client and its model provider. Do not return customer details, orders, private messages, API keys or passwords unless you have reviewed the provider’s data terms and your own privacy obligations.
For a wider view, read the OWASP MCP Security Cheat Sheet.

Before You Start
- WordPress 6.9 or later and PHP 7.4 or later for the adapter. For production, run a supported PHP version.
- A staging copy of your site. If you need hosting with staging, compare options in our WordPress hosting guide and confirm the feature on the plan.
- A backup of files and database that you know how to restore
- HTTPS for any remote connection
- An AI client that supports MCP
- Node.js on your computer for the remote HTTP method, or WP-CLI for the local method
On staging, remove or anonymize real customer data, use test payment keys and stop outgoing emails and live webhooks.
How to Connect AI Agents to WordPress Using MCP
Step 1: Install the Official MCP Adapter
Go to Plugins → Add New, search for MCP Adapter, check that it is the plugin from WordPress.org, then install and activate it. With WP-CLI:
wp plugin install mcp-adapter --activate
The source code and detailed guides are in the MCP Adapter GitHub repository.
Step 2: Check Which Abilities Are Exposed
This step is easy to miss. An ability must be marked public to be reachable through the default server. Since adapter version 0.6.0, meta.public set to true also exposes it, unless meta.mcp.public opts it out. WordPress 7.1 introduced this unified public flag.
So do not assume that only your own abilities are visible. Another plugin may have registered public ones. After connecting, ask the agent to list all abilities without running them. Review that list, and repeat the check after installing or updating plugins.
Step 3: Add One Narrow, Read-Only Ability
Start with a small task. The example below lets an agent list the ID, title and modified date of draft posts. It cannot edit or publish anything. Save it as wp-content/plugins/dt-mcp-safe-abilities/dt-mcp-safe-abilities.php on staging, then activate it.
<?php
/**
* Plugin Name: DT MCP Safe Abilities
* Description: One narrow, read-only ability exposed to MCP.
* Version: 1.0.0
* Requires at least: 6.9
* Requires PHP: 7.4
*/
defined( 'ABSPATH' ) || exit;
add_action( 'wp_abilities_api_categories_init', function () {
wp_register_ability_category(
'dt-content',
array(
'label' => 'DT Content',
'description' => 'Limited content tools.',
)
);
} );
add_action( 'wp_abilities_api_init', function () {
wp_register_ability(
'dt/list-drafts',
array(
'label' => 'List draft posts',
'description' => 'Returns the ID, title and last modified date of recent draft posts. Does not change anything.',
'category' => 'dt-content',
'input_schema' => array(
'type' => 'object',
'properties' => array(
'limit' => array(
'type' => 'integer',
'minimum' => 1,
'maximum' => 20,
),
),
'additionalProperties' => false,
'default' => array(),
),
'output_schema' => array(
'type' => 'array',
'items' => array( 'type' => 'object' ),
),
'execute_callback' => 'dt_mcp_list_drafts',
'permission_callback' => function () {
return current_user_can( 'dt_read_drafts' );
},
'meta' => array(
'annotations' => array(
'readonly' => true,
'destructive' => false,
'idempotent' => true,
),
'mcp' => array( 'public' => true ),
),
)
);
} );
function dt_mcp_list_drafts( $input = array() ) {
$limit = isset( $input['limit'] ) ? max( 1, min( 20, (int) $input['limit'] ) ) : 10;
$posts = get_posts(
array(
'post_type' => 'post',
'post_status' => 'draft',
'numberposts' => $limit,
'orderby' => 'modified',
)
);
return array_map(
function ( $post ) {
return array(
'id' => $post->ID,
'title' => $post->post_title,
'modified' => $post->post_modified_gmt,
);
},
$posts
);
}
What makes this safer:
- It does one job and does not accept raw SQL, PHP, file paths or URLs.
- It limits input to a maximum of 20 results.
- It returns only three fields, not post content.
- It requires a custom capability,
dt_read_drafts. - It contains no code that writes data.
The readonly and destructive annotations are hints, not security controls. Your permission check and your code decide what can really happen. Never use __return_true as the permission check for private data or actions that change something. Note that this ability can show draft titles from all authors, so only grant it where that is acceptable.
Step 4: Create a Dedicated Low-Privilege User
Create a role just for the agent and give it only what it needs:
wp role create dt_ai_agent "AI Agent"
wp cap add dt_ai_agent read
wp cap add dt_ai_agent dt_read_drafts
wp user create ai-agent [email protected] --role=dt_ai_agent
Replace the email with an address you control. The user has no permission to edit posts, manage plugins or manage users through this role. Also check that no other plugin adds extra capabilities to it:
wp user list-caps ai-agent
Step 5: Create an Application Password
For a remote connection, open the agent user’s profile as an administrator and find Application Passwords. Add a descriptive name such as AI client, staging laptop. Or use WP-CLI:
wp user application-password create ai-agent "AI client - staging laptop" --porcelain
- The password is shown once. Store it securely.
- Use a separate password for each device or client, so you can revoke one without affecting others.
- An Application Password is not limited to MCP. It can also authenticate other API requests with that user’s permissions. This is another reason to keep the role small.
- Never put it in a prompt, a screenshot, a support ticket or a Git repository.
Read the official Application Passwords documentation.
Step 6: Connect Your AI Client
The configuration file location and format differ between clients. Follow your client’s documentation. The examples below use a common mcpServers format.
Option A: Remote Site over HTTP
This uses mcp-wordpress-remote, a proxy that runs on your computer:
{
"mcpServers": {
"wordpress-staging": {
"command": "npx",
"args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
"env": {
"WP_API_URL": "https://staging.example.com/wp-json/mcp/mcp-adapter-default-server",
"WP_API_USERNAME": "ai-agent",
"WP_API_PASSWORD": "YOUR_APPLICATION_PASSWORD"
}
}
}
}
The configuration file now contains a secret. Restrict access to it and keep it out of version control. @latest is convenient for testing, but for ongoing use consider pinning a version you have reviewed.
Option B: Local Site over STDIO
If your WordPress site and AI client are on the same computer, WP-CLI can run the server. No Application Password is needed:
{
"mcpServers": {
"wordpress-local": {
"command": "wp",
"args": [
"--path=/path/to/wordpress",
"mcp-adapter",
"serve",
"--server=mcp-adapter-default-server",
"--user=ai-agent"
]
}
}
}
STDIO is not automatically safe. It runs a program on your computer with your operating system access. The --user value sets the WordPress identity, so do not use an administrator.
Step 7: Test What Works and What Must Fail
Restart your AI client. Start with prompts like these:
- “List the available WordPress abilities. Do not execute any of them except the discovery tool.”
- “Show information about dt/list-drafts.”
- “Run dt/list-drafts with a limit of 5.”
Then run negative tests:
| Test | Expected result |
|---|---|
| Ask it to publish a draft | No tool or permission to do it |
| Request 500 drafts | Rejected by the input limit |
| Revoke the dt_read_drafts capability | The ability is denied |
| Revoke the Application Password | The remote connection can no longer authenticate |
| Add a draft titled with a fake instruction | The agent still has no tool to change the site |
Do not rely only on what the AI says it did. Check the WordPress data and available logs yourself.
Give Access in Stages

| Level | Examples | Recommended control |
|---|---|---|
| Read | List drafts, view a site summary | Narrow fields and limits |
| Draft | Create a new draft | Force draft status in code; human publishes |
| Change | Edit live content | Check permission for the specific item; approve each call; keep revisions |
| Destructive | Delete content, manage users or plugins, refund orders | Do not expose unless there is a strong, reviewed need |
If You Later Add Write Abilities
- Create separate abilities such as “create draft”, not a general “manage posts” tool.
- Set sensitive values such as post status in server code. Do not accept them from the agent.
- Validate input and sanitize it for how it will be used.
- Check permission for the specific post, for example with
current_user_can( 'edit_post', $post_id ). - Design retries so they do not create duplicates.
- Keep an audit record without storing passwords or private data.
Safety Rules for Daily Use
- Keep approval on for the generic execute tool, especially if any write ability is exposed.
- Read each tool call before approving: ability name, target and input.
- Separate untrusted content from power. Do not let the same session read public submissions and make sensitive changes.
- Be careful with other connected tools. An agent with WordPress, email and web access may move data between them.
- Monitor activity. Use server, security or application logs. Do not assume every ability call is logged for you.
- Limit abuse with rate limiting or firewall rules where appropriate, and test that they do not block valid requests.
- Update WordPress, the adapter, ability plugins and your AI client.
- Remove unused access, passwords and plugins.
A security rule or host may block REST API requests or the Authorization header. Do not turn security off completely to fix it. Find the exact rule and allow only what is needed.
Troubleshooting
| Problem | What to check |
|---|---|
| 401 Unauthorized | Username, Application Password, whether it was revoked, and whether the server passes the Authorization header |
| 403 Forbidden | User capabilities, firewall and security plugin logs |
| 404 on the endpoint | Plugin activation, permalinks and the full endpoint URL |
| Ability is missing | Plugin activation, the public flag and correct registration hooks |
| Ability is denied | The permission callback and the user’s capability |
| WP-CLI connection fails | The –path value, database access, user, and the wp command available to the client |
| Tools do not appear in the client | JSON syntax, Node.js, and restarting the client |
Emergency: How to Disconnect an AI Agent
- Stop the agent session and disconnect the MCP server in your client.
- Revoke the Application Password in the user’s profile.
- If needed, deactivate the MCP Adapter and the ability plugins.
- If you suspect compromise, check administrator accounts, plugins, content, settings and logs. Rotate any exposed secrets.
- Restore from a clean backup if necessary, after identifying the cause where possible.
Disconnecting the adapter alone may not remove a compromise. Also, other MCP plugins can have their own endpoints and tokens, so disable and revoke them separately.
Pre-Launch Security Checklist
- ☐ Tested on staging with safe data
- ☐ Backup created and restore method confirmed
- ☐ Official or reviewed software only, fully updated
- ☐ Complete list of exposed abilities reviewed
- ☐ Dedicated non-admin user with minimum capabilities
- ☐ Specific permission check on every ability
- ☐ HTTPS for remote access
- ☐ Secrets kept out of prompts and repositories
- ☐ Human approval enabled
- ☐ Negative tests passed
- ☐ Logging, monitoring and revocation plan ready
Frequently Asked Questions
Is WordPress MCP safe?
It can be used more safely with limited abilities, a low-privilege user, approval and monitoring. No setup removes all risk, including prompt injection.
Do I need to know PHP?
Not necessarily to connect, if another trusted plugin registers the abilities you need. To build or review custom abilities, you need PHP and WordPress security knowledge.
Can I connect an AI agent to a live site?
Yes, but test on staging first. On production, start with narrow read-only access and review exactly what data leaves the site.
Does MCP work with WooCommerce?
MCP can work with abilities or integrations that WooCommerce or extensions provide. Check their current documentation. Treat orders, customers and refunds as sensitive.
Can the agent do only what my abilities allow?
Through MCP, it can call what the server exposes, subject to permissions. But the same Application Password may work with other APIs, and your AI client may have other tools. Control all of them.
Final Thoughts
Connecting an AI agent to WordPress is a permission decision, not just a technical setup. Start with one read-only task, test what should fail, and add access only when you have a clear reason. Convenience should never require handing over your admin account.
For more on AI software, browse our AI Tools section. Before choosing a server, you may also find our Hostinger review useful. Need help with setup or maintenance? See our web development and maintenance services.
Last updated: 2 December 2026. MCP software changes quickly, so check the official documentation before following any step.

