An AI agent that works on WordPress has to reach the site somehow, and WordPress now offers four different doors. You can give the agent a shell and let it run WP-CLI. You can let it call the REST API over HTTP. You can register typed capabilities with the Abilities API and let the agent call those. Or you can install an MCP server, from the official adapter or from a plugin, so a chat client or coding agent sees the site as a set of tools. Most write-ups treat these as rivals and ask which one is best. That is the wrong question, and it leads to bad setups.
The useful question is where the limits live. Every interface lets an agent do things; what differs is what stands between a mistaken instruction and your database. WP-CLI has no gatekeeper of its own: it runs as an operating system user and calls WordPress functions directly. The REST API runs every request through authentication, a permission check and an argument validator. The Abilities API gives each action a name, an input schema, an output schema and a permission callback. MCP is a protocol: it carries calls, but it decides nothing about whether they are wise. The safety of an agent setup is the safety of whatever sits behind the door, not the name on the door.
Here is the single most important idea in this comparison, and the rest of the article hangs on it. These four are not alternatives at the same level. They are layers and neighbours. The Abilities API is a registry inside WordPress. REST can publish it over HTTP. The MCP adapter can publish it over MCP. A plugin-provided MCP server is a packaged set of abilities with an authentication flow around it. WP-CLI sits beside all of them as the administrator’s own tool. A good agent setup picks the narrowest interface that can do the job, adds containment outside it, and keeps the shell for the few jobs nothing else can do, such as repairing a site that no longer boots.
The article goes through each interface in the same order: how it works, how an agent authenticates, what it can and cannot do, how it fails and how the agent learns what exists. Then it compares discovery and error handling, covers the hosting constraints that decide what is even available to you, and ends with a decision framework by task and by risk level.
A few honest notes about what this article is and is not. WPresident has not run lab tests of these interfaces for this piece, so it contains no benchmarks, no speed comparisons and no claims about how any particular model behaves. It describes how the interfaces are documented to work and, where practice is well established, says so. The Abilities API and the MCP adapter are the newest of the four, and their details are still moving: function arguments, metadata keys, endpoint paths and defaults. Wherever this article names one, read it as a pointer to what to look for and confirm it against the current WordPress developer documentation and the adapter’s own repository before you build on it. WP-CLI and the REST API are older and steadier, but their command lists and plugin-specific routes still vary by version and by site.
One disclosure: NibWP, which appears in the section on plugin-provided MCP servers as an example, is made by the publisher of WPresident. It is one approach among several, and the concepts apply whichever plugin or adapter you choose. Any scenario with named sites, counts or numbers is an illustration, not data.
Key points
- Treat the four interfaces as layers and neighbours, not rivals: abilities define what can be done, REST and MCP carry the calls, and WP-CLI is the administrator’s own tool beside them.
- The safety of an interface is the safety of what sits behind it: WP-CLI enforces nothing itself, REST checks capabilities per route, abilities check per action, and MCP carries calls without judging them.
- Prefer the narrowest typed interface that does the job, then add containment outside it: a dedicated user, a staging copy, a restore point and a log you control.
- A shell is the right tool for updates, bulk data work and repairing a site that will not boot, and the wrong default for everyday content edits.
- The Abilities API and the MCP adapter are new, so confirm function arguments, metadata flags, endpoint paths and defaults in current documentation before you build.
- A tool that runs arbitrary PHP or SQL turns any typed interface back into a shell, so judge the tool list, not the protocol.
- Hosting decides your options: no shell means no WP-CLI, stripped Authorization headers break application passwords, and firewalls often block API clients.
The real question: where do the limits live?
Strip away the tooling and every agent runs the same loop. It receives an instruction, chooses an action, sends a call, reads the result and decides what to do next. The interface is what the call travels through, and it decides five things you care about: who the call runs as, what checks WordPress applies, how the agent learns what exists, what an error looks like, and how much of the damage you can undo afterwards.
Those five properties differ sharply between the four options. WP-CLI is free-form text typed into a shell, with the widest reach and no gatekeeper except the operating system. The REST API is structured HTTP: each route has a permission check and a schema, and the request runs as one WordPress user. The Abilities API is a registry inside WordPress where each action is declared with a name, typed inputs and outputs and its own permission callback. MCP is a protocol that carries calls between an agent client and a server, and it says nothing about whether a call is wise.
Notice what that list implies. Only the first three describe what can be done to the site. MCP describes how the request travels. That is why comparing the four as if they were equals produces confused advice. An MCP server in front of a carefully scoped set of abilities is a narrow interface. An MCP server in front of a tool that runs arbitrary PHP is a shell with extra steps. The protocol did not change the risk; the tool list did.
The better mental model is layers and neighbours. The Abilities API is the inner layer: it defines what the site is willing to do and who may ask. REST can publish those abilities over HTTP, and the MCP adapter can publish them over MCP, so both sit on top of the same definitions. A plugin that packages an MCP server adds an authentication flow, a default set of abilities and usually some logging. WP-CLI is a neighbour rather than a layer: it is the administrator’s own tool, and it reaches around all of them.
Three questions keep you honest through the rest of this article. Where is the limit enforced: by the operating system, by WordPress core, by a plugin author’s callback, or only by your prompt? What happens when the site is half broken? And what would you have to look at afterwards to know what the agent did? A prompt that says “be careful” answers none of them. The figure below puts the four side by side so you can keep it in view.
Four interfaces, six differences that matter
| WP-CLI | REST API | Abilities API | MCP server | |
|---|---|---|---|---|
| Transport | Shell command on the server | HTTP requests to the site | PHP functions, published over REST or MCP | JSON-RPC over stdio or HTTP |
| Runs as | An OS user, no WordPress user by default | One WordPress user | The current WordPress user | Whatever user the server maps the session to |
| Limits enforced by | The operating system and your wrapper | Route permission callbacks and capabilities | Each ability’s permission callback | The tools behind it; annotations are only hints |
| Discovery | Help text and a command dump | Index route and OPTIONS schemas | Registry with input and output schemas | Tool, resource and prompt listings |
| Output | Text, or JSON with a format flag | JSON with HTTP status codes | Result validated against a schema | Tool result with an error flag |
| Works when WordPress will not boot | Often, with plugins skipped | No | No | No |
WP-CLI: the shell route and how a command actually runs
WP-CLI is a command-line tool for WordPress. Each time you run it, a fresh PHP process starts, reads the site’s configuration file, loads WordPress, runs one command and exits. There is no daemon and no session. That small fact explains most of its behaviour: it is stateless, every call pays the cost of loading the site, a fatal error in an active plugin can stop a command before it starts, and the PHP settings it uses come from the command-line configuration, which can differ from the web server’s.
Authentication is the unusual part, because there is none in the WordPress sense. Access to the shell is the authentication. If the agent runs on your laptop, it is you. If it reaches a server, it does so over SSH with a key, or it runs on the server itself. WP-CLI can be pointed at a remote host with an SSH option, and it accepts a path and a site URL, which matters on multisite networks. A user option sets the current WordPress user for code that checks capabilities, but most commands call WordPress functions directly and never ask. Treat a WP-CLI session as the site’s administrator, because for practical purposes it is.
What it does well is breadth. Posts, pages, media, users, options, plugins, themes, menus, taxonomies, cron events, rewrite rules, transients and the database all have commands, and core updates, plugin updates and search-replace across the database are first-class jobs. Output is controllable: a format flag produces JSON, a fields flag trims columns, and a porcelain flag on creation commands prints just the new ID, which is far easier for an agent to parse than a formatted table. Long jobs are comfortable, because the command line has no web request timeout by default.
Discovery is by help text. An agent can ask for the list of commands, for the help of a single command and for a dump of the whole command tree. The catch is that help is prose for humans, not a schema, so the agent infers flag names and value formats. The command list also depends on the site: plugins and installed packages can register their own commands, so a list from another site is not a list for this one. Have the agent read the help for each command before first use, and have it confirm the version first.
$ wp --info
$ wp help post create
$ wp post list --post_type=page --fields=ID,post_title,post_status --format=json
Errors arrive as text on standard error, with a non-zero exit status when a command fails. Warnings print but do not fail the command, and some bulk commands report a problem per item. An agent that checks only the exit code will miss partial failures, and one that reads only the text will miss a crash that printed little. It needs both.
One WP-CLI call, start to finish
- Agent runs a commandA shell call such as wp post list, as whichever OS user the agent holds.
- PHP CLI startsA fresh process using the command-line PHP settings, which can differ from the web ones.
- WordPress loadsThe config file, core, plugins and theme, unless you tell WP-CLI to skip them.
- Command runsDirect function calls. No route permission check, and no current user unless you pass one.
- Output and exit codeText or JSON on stdout, errors on stderr, a non-zero status on failure.
Giving an agent a shell: what WP-CLI will let it do
Because WP-CLI runs as an operating system user and calls WordPress functions directly, the capability checks that protect a REST request are simply not in the path. The agent can create administrators, delete every post, empty a table or change the site URL, and WordPress will not object, because nobody asked WordPress to object. Several commands go further and run arbitrary code: one evaluates a PHP string, one runs a PHP file, one opens an interactive PHP shell and one runs raw SQL. Two global flags can load a PHP file or execute a PHP snippet before any command runs. If an agent can run WP-CLI with free arguments, it can run PHP as that user.
That has a consequence people miss when they try to restrict the shell. An allow-list that matches the start of a command line, such as anything beginning with a read-only listing command, can be bypassed by appending one of those global flags. A useful wrapper checks the whole command, rejects flags it did not expect and ideally accepts only exact, fully specified commands. That is real work, and it is a reason to prefer a typed interface whenever one exists.
If you decide the shell is worth it, put containment around it in layers. Work on a copy first. Use a dedicated operating system user with its own SSH key and no access to other sites or to deployment credentials. OpenSSH can attach a forced command to a key in the authorized keys file, so that every login runs your wrapper and never an open shell; check the sshd documentation for the options. Take a database export before any write. Record every command line somewhere the agent cannot edit.
Then use the safety features WP-CLI does have. Search-replace across the database understands serialized data, which is why you should never let an agent run a raw SQL update against content that plugins store as serialized arrays: changing a string without updating its length prefix corrupts the value. Search-replace also has a dry-run flag that reports what would change without writing anything.
$ wp db export before-agent-run.sql
$ wp search-replace 'http://staging.example.com' 'https://www.example.com' --dry-run
$ wp search-replace 'http://staging.example.com' 'https://www.example.com'
One more trap sits outside WordPress entirely. Coding agents run shell commands as you, with your environment. If your terminal holds an SSH alias for production, or your project file points at a production database, an agent working on local code can reach production with the same commands it uses locally. Keep production aliases and credentials in a separate profile that the agent’s shell does not inherit.
Finally, remember what WP-CLI is for. It is the right tool for updates, bulk data work, scheduled jobs and repairing a broken site, and a poor default for everyday content edits, where a typed interface gives you validation and a clear record of intent for free.
Containment layers for an agent with a shell
The REST API: how a request is handled and how an agent signs in
The REST API is built into WordPress core. Every site exposes it under a path that starts with wp-json, or through a query-string fallback when pretty permalinks are off, and the core content types live under a version namespace. An agent needs nothing but HTTPS access and a credential, which makes REST the most portable of the four: it works from a laptop, a cloud function or any chat tool with an HTTP client, on any host that serves the site.
A request passes through a fixed sequence, shown in the figure, and each step is a place where a mistake gets caught or goes unnoticed. Credentials are resolved to a user. The path is matched to a route. The route’s permission callback decides whether that user may do this. Arguments are validated and sanitised against the route’s declared schema. Only then does the handler run. A plugin author who registers a route must supply a permission callback, and core warns when one is missing, but it cannot judge whether the callback is a good one. A callback that always returns true makes the route public.
For agents, the sensible credential is an application password: a per-user credential, sent as HTTP Basic authentication, which WordPress offers over HTTPS. You can create several per user, name each one, see when and from which address it was last used and revoke them one at a time. It cannot be used to sign in to the dashboard. The browser’s own method, a login cookie plus a nonce header, is designed for scripts running inside a logged-in page and is the wrong fit for an agent. Plugins add OAuth or token schemes; if you consider one, check how actively it is maintained and which scopes it really enforces.
The key limit is that core application passwords carry no scopes. The credential can do everything its user can do. So the real access control is the WordPress role: create a dedicated user, give it the lowest role that can perform the task and expect to adjust it. Narrowing further, such as allowing one route and denying the rest, is possible with custom code, but it is custom work, not a setting.
These two requests show the pattern with a read and a draft write. The variable SITE holds the site address, and the credential belongs in an environment variable, never in a file in a repository.
$ curl -s -u "$WP_USER:$WP_APP_PASSWORD" "$SITE/wp-json/wp/v2/posts?per_page=5&_fields=id,title,status"
$ curl -s -u "$WP_USER:$WP_APP_PASSWORD" -H "Content-Type: application/json" -d '{"title":"Draft from an agent","status":"draft"}' "$SITE/wp-json/wp/v2/posts"Life of a REST request
- Request arrivesAn HTTP method, a path under wp-json and credentials in the Authorization header.
- WordPress bootsCore and plugins load and register their routes.
- AuthenticateAn application password or a cookie with a nonce resolves to a user, or to nobody.
- Match and permitThe route’s permission callback decides whether this user may do this.
- Validate argumentsTypes and required fields are checked against the route schema. Bad input returns 400.
- Run and respondThe handler runs and JSON returns with a status code and, on failure, an error code.
What REST can and cannot do, and how it reports errors
REST is strongest where WordPress has modelled the data. Posts, pages, media, comments, users, taxonomies, menus, settings, plugins and revisions are routes with documented fields, and a request can ask for just the fields it needs, expand related objects and page through long lists. Lists return at most one hundred items per page and report how many pages remain in response headers, so an agent must loop instead of assuming it saw everything.
The gaps come from the same fact. Whatever nobody modelled as a route is out of reach. Custom fields are readable and writable only if the plugin or theme registered them with REST exposure. Most plugin settings screens have no route. Core upgrades, database search-replace, cache purges and cron runs are not endpoints. Routes exist to list and activate plugins, but check the current documentation for what plugin and theme updates support on your version. For the rest you need WP-CLI, the host’s tools or an ability that wraps the operation.
Content has its own trap. Post content is stored as block markup: HTML with comment delimiters. The raw form comes back only in the edit context, and an agent that writes plain text where blocks are expected produces output that renders but is awkward to edit later. Updates are partial, which is useful: send only the fields you mean to change. But sending the content field replaces all of it. Deleting moves a post to the trash unless the force flag is set, and some types, such as media, require it.
Creation is where retries bite. A create call is not idempotent. If the connection times out after WordPress saved the post, a retry makes a second post, and WordPress quietly appends a number to the slug so nothing looks wrong. Read back by title or slug before repeating any create. Reads, and updates that set a field to a value, are safe to repeat.
The error shape helps an agent recover. Failures return a JSON object with a machine-readable code, a message and an HTTP status, and validation failures name the offending parameters. Learn the common patterns in the figure, and teach the agent that an HTML response is not a REST error at all but a sign that something in front of WordPress answered first.
Reading REST errors
| Typical status and code | What to check first | |
|---|---|---|
| 404, rest_no_route | No such route | Permalinks, the route spelling, the plugin that registers it, or a firewall hiding the API. |
| 400, rest_invalid_param | Bad input | The response names the parameter. Fix the payload; never retry it unchanged. |
| 401 or 403, rest_forbidden | Not allowed | 401 usually means not authenticated, 403 means signed in but without the capability. |
| 403, rest_cookie_invalid_nonce | Cookie without a nonce | The agent is using browser-style authentication. Switch to an application password. |
| 5xx or a timeout | Outcome unknown | The write may have landed. Read back before any retry of a create. |
| HTML instead of JSON | Something else answered | A firewall, a maintenance page or a cache replied; WordPress never saw the call. |
The Abilities API: typed capabilities inside WordPress
The Abilities API is a registry, introduced in WordPress 6.9, where core, plugins and themes declare what a site can do in a form that software can read. Before it, the same functionality was scattered across admin screens, private AJAX handlers and custom REST routes, with no common way to ask a site what it can do, with which inputs and who may ask. An ability is the answer: a unit of work with a name, a description, a category, a schema for its input, a schema for its output, a permission callback and an execute callback. If you run an older version, check whether a feature plugin provides it, and treat that as a separate thing to verify.
It helps to be clear about what it is not. It is not a transport: by itself it listens on nothing. It is not an authentication system: it runs as whichever user the surrounding request authenticated. And it is not specific to AI, although the typed, self-describing design suits agents well. Its value is the contract. Input is checked against the schema before your code runs, output is checked afterwards, and the permission callback comes first of all.
That callback is where safety lives, and the plugin author writes it. A good one checks a real capability that matches the action. A careless one returns true. The registry cannot tell the difference, so reviewing the abilities a plugin registers, and especially their permission callbacks, is a security task, not a formality. Annotations help clients: an ability can declare itself read-only, destructive or idempotent. They are hints for the caller, and nothing enforces them.
Here is a small read-only ability. The names and argument keys follow the documentation at the time of writing; check the current handbook before you copy it, because this is exactly the kind of detail that moves.
<?php
add_action( 'wp_abilities_api_categories_init', function () {
wp_register_ability_category( 'my-plugin-content', array(
'label' => __( 'Content tools', 'my-plugin' ),
'description' => __( 'Read-only helpers for site content.', 'my-plugin' ),
) );
} );
add_action( 'wp_abilities_api_init', function () {
wp_register_ability( 'my-plugin/count-posts', array(
'label' => __( 'Count posts by status', 'my-plugin' ),
'description' => __( 'Returns how many posts of a type have a given status.', 'my-plugin' ),
'category' => 'my-plugin-content',
'input_schema' => array(
'type' => 'object',
'properties' => array(
'post_type' => array( 'type' => 'string' ),
'status' => array( 'type' => 'string', 'enum' => array( 'publish', 'draft', 'pending' ) ),
),
'required' => array( 'status' ),
),
'output_schema' => array(
'type' => 'object',
'properties' => array( 'count' => array( 'type' => 'integer' ) ),
),
'execute_callback' => function ( $input ) {
$counts = wp_count_posts( $input['post_type'] ?? 'post' );
$status = $input['status'];
return array( 'count' => (int) ( $counts->$status ?? 0 ) );
},
'permission_callback' => function () {
return current_user_can( 'edit_posts' );
},
'meta' => array(
'show_in_rest' => true,
'annotations' => array( 'readonly' => true, 'idempotent' => true ),
),
) );
} );
One design choice is worth copying even if you never register an ability: the narrow ability returns a number, not a database handle or a raw query. The smaller the verb, the easier it is to review.
Anatomy of an ability
MCP: what the protocol adds, and what it leaves to you
The Model Context Protocol is an open standard, introduced by Anthropic and now supported by many agent clients, for connecting an AI application to external tools and data. A client inside the agent application talks to a server that exposes three kinds of things: tools, which are callable actions with a JSON schema for their inputs; resources, which are readable data; and prompts, which are reusable templates. Messages are JSON-RPC. A session opens with an initialize exchange, after which the client can list what the server offers and call it.
There are two common transports. With stdio, the client launches a local process and talks to it through standard input and output, so the server runs on the same machine as the agent. With streamable HTTP, the server is a web endpoint and a session identifier travels in a header. A WordPress site is naturally the second kind, since it already speaks HTTP. A local proxy can bridge the two for clients that only launch local processes: it speaks stdio to the client and HTTP, with an application password, to the site.
What the protocol gives an agent is uniformity. Any compliant client can discover and call any compliant server, and clients know how to show an approval prompt before a tool runs. What it leaves to you is everything about safety. The protocol does not decide whether a tool is wise. Tool annotations such as read-only or destructive are hints that the server asserts and the client cannot verify. HTTP servers can use the specification’s authorisation framework, which is built on OAuth, but a WordPress server commonly relies on application passwords instead, so check what your server and your client each support.
Three practical details matter for an agent. First, errors come in two layers: a protocol error for a malformed request, and a tool result flagged as an error for a call that ran and failed. Handle both. Second, every tool’s name, description and schema is sent to the model, so a server that publishes hundreds of tools spends the agent’s attention before any work starts. Third, anything a tool returns, such as the body of a comment or a form submission, becomes text in the model’s context, and text can contain instructions. Treat tool output as untrusted data. A limit enforced by the interface is the only reliable defence against an agent being steered by what it reads.

The MCP Adapter: turning abilities into agent tools
The MCP Adapter is the WordPress project’s bridge between the Abilities API and MCP. It takes abilities and presents them as MCP tools, resources and prompts, and it ships a default server. That server does not publish one tool per ability. It publishes three generic ones, which a connected client shows as discover abilities, get ability info and execute ability. The agent lists what is available, fetches the schema of the one it needs and then calls it by name with parameters.
That three-tool design is a deliberate trade. It keeps the model’s tool list short and stable no matter how many abilities a site has, and it moves the real documentation into the schemas the agent fetches on demand. The cost is an extra step, and a risk: an agent that skips the schema fetch is guessing at parameter names. When you review a transcript, check that the fetch happened before the first call to each ability. Developers can also define custom servers that publish chosen abilities as individual tools, which suits a small, fixed set.
Exposure takes a deliberate opt-in. An ability registered in PHP is not automatically available to agents. Its metadata controls whether it appears over REST, and a separate flag in the adapter’s documented metadata controls whether it appears on the default MCP server. Two opt-ins are good design, because an ability meant for internal use stays internal. They also mean a missing ability is usually a missing flag, so check there first. Confirm the current key names in the adapter’s documentation, because they are exactly the kind of detail that changes between versions.
Authentication follows the transport. Over HTTP, the adapter serves from a REST route, so WordPress authenticates the request first, normally with an application password, and each ability’s permission callback then runs for that user. Over stdio, the adapter is started through WP-CLI, which brings back the properties of the shell: the connection is trusted because of where it runs, and you choose the WordPress user it acts as. Both paths end in the same permission callbacks, which is the reason to write them well.
Errors map across the layers. A failed permission check or invalid input becomes an error result in the tool response, so the agent reads a message that originated in PHP. A clear error message in the ability, written for a model reader, pays off. Verify the adapter version, its requirements and its transports in the current repository before you depend on them.
From a PHP function to an agent tool
- RegisterA plugin registers an ability with schemas and a permission callback.
- Opt in to exposureMetadata flags decide whether it appears over REST and over MCP.
- Adapter listsThe default server offers discover, get-info and execute tools.
- Agent discoversIt lists abilities, then fetches the schema of the one it needs.
- Agent executesThe call is authenticated, validated against the schema and permission-checked.
- Result returnsOutput is validated and sent back; a failure becomes a tool error.
Plugin-provided MCP servers, with NibWP as one example
The Abilities API and the adapter are plumbing. Most site owners need something finished: a set of useful abilities, a way to connect a client without hand-editing configuration, and some limits and logs. That is the gap plugin-provided MCP servers fill, and they differ in how they fill it. Some build on the Abilities API and the adapter, so what they register is visible through standard interfaces. Others bring their own endpoint, their own tools and their own token scheme. Neither is wrong, but the second kind ties you more tightly to the vendor.
NibWP is one example. It is made by the publisher of WPresident, so read this paragraph as a description, not an endorsement. According to its documentation, it is a WordPress plugin built on the Abilities API and the MCP Adapter, so it needs a WordPress version that includes the former. It registers a curated set of abilities covering content, taxonomies, media, comments, menus, users, custom fields, an allow-list of options and files. It authenticates with application passwords, offers a master switch that turns its abilities off without revoking credentials, and records AI actions in a local audit log. Confirm each of these against the current listing, since features and defaults change between versions and editions.
Whatever product you evaluate, ask the same questions. What exactly does it register, and does any ability run arbitrary PHP, SQL or shell commands? Those are the ones to switch off, or to keep for staging. How does it authenticate, and can you give each client its own revocable credential? Can you turn it off in one place? Where does the audit log live, who can read it and does it keep request parameters? Which abilities are destructive, and does the plugin ask for confirmation? How quickly does the vendor ship security fixes, and has the plugin appeared in vulnerability databases?
The trust chain matters here. A plugin that exposes broad abilities is a privileged codebase running inside your site, and an agent connected to it inherits its mistakes. Keep it updated like any other plugin, review what it exposes after each update and never attach it to a user with more rights than the task needs. Because abilities are a shared standard, what one plugin registers can in principle be reached through another compliant adapter. The vendor’s interface, logging and confirmations are not portable in the same way.

One loop, four interfaces: discovery, retries and the record
Whichever door you use, a careful agent runs the same loop: discover what exists, read the details of the thing it will use, read the current state, plan, act and then read back. The interfaces differ in how much help they give at each step, and that difference shows up as the kind of mistake you will see.
With WP-CLI the agent learns from help text and infers flags, so mistakes are semantic: the right command with the wrong flag, or a flag that exists in one version only. With REST the agent can read the index and the schema of each route, so mistakes tend to be about meaning rather than form, such as the wrong object ID or the wrong content format. With abilities and MCP the schemas are the contract, so malformed calls are rejected before they run, and what remains is the agent choosing the wrong ability or the wrong target. Typed interfaces do not stop wrong decisions. They stop malformed ones, and they make the remaining ones easier to see in a transcript.
Retries need one rule set on all four. Reads can be repeated freely. A rejected call, such as an authentication failure, a validation error or a lost session, never ran, so fixing it and repeating is safe. Updates that set a field to a value are safe to repeat, because the second run changes nothing. Creations, deletions and anything that appends are not. After a timeout the outcome is unknown, not failed, so read back before repeating: list the posts by title, check whether the file exists, query the option. Cap retries, back off and stop when the host keeps erroring, because hammering a struggling server prolongs the outage.
Observability is the weakest part of most setups. WP-CLI leaves a shell history only if you arrange one. REST leaves access-log lines with the method and path but usually not the body, and application passwords record their last use and address. Abilities leave nothing by default. An MCP plugin may keep an audit log, which helps only if you know what it stores. Add your own record: have the agent write its plan and each call to a file outside the site, and compare that file with the server’s logs after the run. A change you cannot reconstruct is a change you cannot reverse.
Finally, verify by a route that does not pass through the agent’s own account. Read the stored value with WP-CLI, in wp-admin or with a plain request, and look at the public page. An agent confirming its own work is a witness, not an audit.
The same loop on every interface
- DiscoverList what exists: commands, routes, abilities or tools.
- Read the contractFetch the help text, route schema or ability schema before first use.
- Read the stateRecord the current value of anything that is about to change.
- PlanState each call, its target and how to undo it, then wait for approval.
- ActMake one change first, then the rest in small batches.
- Read backCheck the stored result and the public page by a route the agent did not use.
Hosting constraints and the failures you will actually meet
Your host decides which interfaces you have before you decide anything. Shared plans often provide no SSH, or disable the PHP functions WP-CLI needs, so the shell route is closed. Many managed WordPress hosts provide SSH and WP-CLI, but policies differ, so check yours. REST and plugin-provided MCP servers need only HTTPS, which makes them available almost everywhere, and the Abilities API needs a WordPress version that includes it.
The common failures cluster around HTTP and credentials. Application passwords need HTTPS and can be disabled by a security plugin or a site filter. Some FastCGI setups strip the Authorization header before PHP sees it, so a correct password returns 401. A staging site protected by server-level Basic authentication collides with application passwords, since both use the same header. Firewalls and bot protection often return an HTML challenge to non-browser clients, and a CDN may cache a REST response and show stale data after a write. The agent sees all of these as “the API is broken”, which is why you should test the connection by hand with curl before blaming the agent.
The shell has its own set. The command-line PHP may be a different version, with different extensions and limits, from the one serving the site. WP-CLI changes the database directly, so a page cache keeps serving the old page until you purge it. Web requests time out within seconds or minutes, while command-line jobs run on, so a bulk job that works in the shell may fail over REST unless you chunk it.
Then there are failures that belong to agents, whatever the interface. Misreported success: the agent says it saved, and the stored value differs. Duplicates after a timeout. Bulk runs that stop halfway. Permission creep, where someone raises a role to get past an error and never lowers it. Schema drift: a plugin update renames a field or changes an ability, and yesterday’s working call now fails. And injection: a comment or form entry holding instructions that the agent follows. Every one of these is smaller when the interface is narrow, the user is low-privilege and the run happens on a copy.
What your hosting gives you to work with
A decision framework by task and risk level
Use four rules. Pick the narrowest interface that can do the job. Prefer typed over untyped. Read before you write. And match containment to reach: the wider the interface, the more has to be built around it.
Then sort the task by risk. Level one is read-only work: audits, inventories, reports. Level two is reversible writes, such as drafts, which visitors cannot see and which can be deleted. Level three is live changes that are hard to undo: edits to published pages, options, custom fields without history, deletions, and anything touching orders or users. Level four is changes to code and system state: updates, file writes, SQL and PHP. As the level rises, the interface should get narrower and the human should get closer. Levels one and two suit a low-privilege user over REST or MCP. Level three suits narrow abilities, a read-first rule and a person who reads each call. Level four belongs on a copy, with a restore point and a person approving the exact command.
The table maps common tasks to a first choice and the guardrail that goes with it. A few cases deserve a sentence. When the site will not load, only the shell can help, because REST and MCP need WordPress to boot. When a non-developer wants to work from a chat window, a plugin-provided MCP server is the practical route. When you are building a repeatable operation into your own product, register an ability so every client, human or agent, gets the same checked contract. And when someone proposes giving an agent a tool that runs arbitrary PHP so that it can do anything, the answer is the same on every interface: that is a shell, so contain it like one.
Which interface for which task
| Best first choice | Guardrail to add | |
|---|---|---|
| Audit or inventory | REST or MCP read abilities | A low-privilege user with no write abilities. |
| Draft new content | REST or MCP content abilities | Drafts only; a person publishes. |
| Edit live pages | Typed abilities or REST updates | Read first, keep the old value, change one object before the batch. |
| Change site settings | One narrow ability per setting | An allow-list of options and a recorded old value. |
| Update core, plugins, themes | WP-CLI or the host’s tools | Staging first, a fresh backup, a person approving. |
| Search-replace and bulk data | WP-CLI | A dry run, a database export and work in chunks. |
| Repair a site that will not load | WP-CLI with plugins skipped | A person watching the session. |
| A repeatable operation in your product | Your own ability | Real schemas and a real permission check. |
What to verify in current documentation, and a safe order of adoption
Because the newer parts of this stack are moving, treat the following as a list of things to check, not facts to memorise. On the WordPress side: which versions include the Abilities API, the current function and hook names, whether categories are required, the argument keys an ability accepts, the metadata keys for annotations and for REST exposure, the namespace and paths for listing and running abilities, and which HTTP methods the run endpoint uses. On the adapter side: the current version, its PHP and plugin requirements, the transports it supports, the name and tools of the default server, the metadata flag that exposes an ability to MCP and the authentication it supports for remote clients. For the older interfaces: the commands installed on your host, found with WP-CLI itself, and the routes your plugins register, found at the REST index.
The best source is your own site. Ask it what it exposes: list the abilities and the routes, read the schemas and run one read-only call by hand with curl before you involve an agent. Then read the developer handbook, the adapter’s repository and its changelog to understand why the answer is what it is. Pin versions where you can, and repeat the check after updating WordPress, the adapter or any plugin that registers abilities, because a renamed field breaks a working call without warning.
Adopt in stages, each one earning the next. Prepare a staging copy, a dedicated low-privilege user and a restore point you have proved works. Start read-only and verify what the agent quotes against the site. Move to drafts through a typed interface. Allow narrow writes on staging and read back after each. Replay reviewed calls on production in small batches with a fresh backup. Afterwards, read the logs, tighten the rules and remove abilities nobody used.
A safe order of adoption
Read this next
About this comparison. This is general guidance written by WPresident Editorial from documentation and widely used practice. WPresident has not benchmarked the products or methods described. Interfaces and plan limits change, so check the vendor’s current documentation before you act. Not legal, tax or financial advice. See our editorial policy.
Frequently asked questions
Which interface should an AI agent use for WordPress?
Use the narrowest typed interface that can do the job. For everyday content work that means abilities exposed through an MCP server, or the REST API with a low-privilege user. Keep WP-CLI for updates, bulk data work and repairing a site that will not load, and run it on a copy behind a wrapper. The interface matters less than what is registered behind it and which user the agent runs as.
Is the REST API enough, or do I need MCP?
REST is enough when you write the integration yourself or the agent can make HTTP calls and read JSON, and it needs no extra plugin. MCP adds uniform discovery and calling for chat clients and coding agents, plus approval prompts. If your client already supports MCP and you want curated, typed actions that are easy to review, MCP over abilities is the easier route. Both can run side by side.
Does MCP replace the REST API?
No. MCP is a protocol between an agent client and a server. A WordPress MCP server often sits on top of the REST system, because the adapter's HTTP transport is served from a REST route and WordPress authenticates the request in the usual way. REST remains the general interface for scripts and other applications, and many plugins keep using it. They solve different problems and commonly coexist.
Is WP-CLI safe to give an AI agent?
Only with containment. WP-CLI runs as an operating system user and calls WordPress functions directly, so capability checks do not apply, and several commands and flags run arbitrary PHP or SQL. Give the agent a copy of the site, a dedicated user, a wrapper that accepts only exact commands, a fresh database export and a log you control. For routine content edits, a typed interface is the safer choice.
What is the Abilities API in plain terms?
It is a registry in WordPress, introduced in version 6.9, where code declares named actions with a description, input and output schemas and a permission check. It lets software ask a site what it can do and then do it in a validated way. It is not a transport and not a login system; REST and MCP are the ways its abilities reach an agent. Verify current details in the developer documentation.
How does an agent authenticate to WordPress?
Over HTTP, normally with an application password: a revocable credential tied to one user, sent as HTTP Basic authentication over HTTPS. The agent then acts with that user's capabilities. With WP-CLI there is no login; access to the shell is the credential. Browser cookies and nonces suit scripts inside a logged-in page, not agents. Plugins may add OAuth or tokens, so check which limits they really enforce.
What if my host does not offer SSH or WP-CLI?
Use the HTTP routes. The REST API and plugin-provided MCP servers need only HTTPS, so they work on hosts that give you no shell. You lose the shell-only jobs: core and bulk updates, search-replace and repairing a site that will not boot, which you would do through your host's tools or a staging copy. Test the Authorization header and firewall behaviour by hand with curl first.
How do I stop an agent that is mid-run?
Stop it in the client first, then cut access at the site. Revoke its application password, which ends its access at the WordPress layer. If you use a plugin-provided MCP server, use its off switch, and on a shell setup disable the key. Then compare the agent's plan with your logs and restore only what you need from revisions, saved values or a backup.
Can content on my site hijack an agent that reads it?
Yes, and the attack is called prompt injection. A comment, a form entry or a product description can contain instructions, and an agent that reads it may follow them. The defence is structural: give the agent a low-privilege user, narrow tools and human approval for writes, so that even a steered agent cannot do much. Treat everything any interface returns as untrusted text.
Should I let an agent run PHP or SQL directly?
Rarely, and not on production by default. Arbitrary PHP or SQL removes the limits that make typed interfaces useful, and one mistake can reach files, users and every table. If you must, do it on throwaway staging with a fresh backup, a named purpose and a person reading every line first. Most such jobs can be done by a narrow ability or a reviewable file.



