"Publish the draft about the promo"
A café owner types in her AI app: "Publish the draft about the autumn promo and add it to the menu." The app doesn't open wp-admin or click buttons. It knows the site can publish-post and update-menu, calls those two actions, and WordPress checks whether the user the app is connected as is allowed to do that.
How does the AI app know the site can do this? From the same list of abilities as in lesson 1.1. Between them sit the MCP protocol and the MCP Adapter plugin.
Agenda
In 10 minutes you will:
- follow a request from the AI app to
execute_callback; - understand why an ability is a tool for AI;
- see where permissions are checked;
- learn the two places where a site can give away more than you wanted.
Theory
MCP in one paragraph
MCP (Model Context Protocol) is an open protocol that AI apps (Claude, ChatGPT, an IDE with an agent) use to connect to external systems. The system they connect to is an MCP server. The server announces its tools (actions) and prompts (ready scenarios). The AI model decides on its own which tool to call to do what the person asked.
A WordPress site becomes an MCP server through the official MCP Adapter plugin: it turns abilities into tools.
The request path
flowchart LR
U["Person<br/>writes a request"] --> APP["AI app"]
APP -- "MCP" --> PX["Local proxy<br/>STDIO"]
PX -- "HTTPS +<br/>Application Password" --> SRV["MCP server<br/>/wp-json/…/mcp"]
SRV --> AD["MCP Adapter"]
AD --> REG["Abilities registry"]
REG --> CH{"schema +<br/>permission_callback"}
CH -- "OK" --> EX["execute_callback"]
CH -- "no" --> ERR["error"]
- The person writes a request in plain language.
- The AI app is connected to the site as an MCP connector and knows the list of tools.
- The request goes through a local proxy over HTTPS to the site's MCP server endpoint, with an Application Password.
- The MCP Adapter finds the matching ability in the registry.
- WordPress validates the input against
input_schemaand callspermission_callback, as the real user. - Only then does
execute_callbackrun, and the result goes back to the agent.
Transport details (STDIO, HTTP) are in module 4.
What the agent sees
The agent doesn't see "the site". It sees a list of tools with descriptions and schemas. So:
- Description is an instruction for the model. A vague name means the agent picks the wrong tool.
- Schemas tell the model which arguments to pass. Without them the agent guesses.
- Annotations (
readonly,destructive) help the AI app decide whether to ask the person before acting.
Your code still decides
The AI model doesn't bypass permissions. Every call goes through the same permission_callback as a call from PHP or REST. If the user the agent works as doesn't have publish_posts, nothing gets published.
Two places where a site gives away more than you wanted
| Place | What happens | How to close it |
|---|---|---|
meta.public / meta.mcp.public | the plugin itself marks the ability as open to MCP | you, not the plugin, decide what to turn on |
| The MCP Adapter default server | by default the adapter starts a server that exposes "public" abilities | add_filter( 'mcp_adapter_create_default_server', '__return_false' ); |
This is how our 4WP MCP Connector does it: the default server is off, one server 4wp runs (/wp-json/4wp/mcp), every ability is off by default, the administrator turns them on one by one, and every call goes to a log (time, user, ability, status, no request contents). It's one option; modules 6–7 cover the others.
Code / commands
// Turn off the MCP Adapter default server: the agent sees only your server.
add_filter( 'mcp_adapter_create_default_server', '__return_false' );
# Which abilities are open as "public" on your site
wp eval 'foreach ( wp_get_abilities() as $a ) { $m = $a->get_meta(); if ( ! empty( $m["public"] ) || ! empty( $m["mcp"]["public"] ) ) { echo $a->get_name(), PHP_EOL; } }'
Trade-offs
| Option | Simpler | Risk / cost | When to choose |
|---|---|---|---|
| The MCP Adapter default server as is | zero setup | exposes everything plugins marked public | local development, demos |
| Default off + your own allow-list | control over every ability | the list needs setting up and maintaining | a client site, production |
| Your own MCP server outside the adapter | full freedom | separate code and infrastructure | special requirements (course appendix A) |
Common mistakes
| Symptom | Cause | Fix |
|---|---|---|
| The agent sees abilities you didn't turn on | the default server is running, plugins marked them public | turn off the default server, use an allow-list |
| The agent picks the wrong tool | vague label and description | describe the action the way a person would phrase it |
| The agent "can't" do what the admin can | connected with the password of a user with fewer permissions | that's how it should be: permissions = the user's permissions |
| Trusting AI as a permission check | "the model is smart" | permissions live only in permission_callback |
Practice
- List the abilities with
publicinmetathroughwp eval. - Find which of them belong to core and which to plugins.
- Write down which of them you wouldn't want to give to a client's AI app.
Result: you know what your site is already ready to give an agent, and what needs closing.
Quiz
- What does an ability become for an AI app through the MCP Adapter?
- As whom are permissions checked when an agent calls?
- What does the
mcp_adapter_create_default_serverfilter with__return_falsedo? - Why does the agent need the description and schemas?
<details> <summary>Answers</summary>
- A tool.
- As the real WordPress user whose Application Password was used.
- Turns off the adapter's default server; only your server remains.
- To pick the right tool and pass the right arguments.
</details>
FAQ
No. Every call goes through the ability's permission_callback and the capabilities of the user the agent is connected as. The agent can ask, but your code decides.
The official plugin that makes a WordPress site an MCP server and exposes abilities as tools for AI apps.
No, but the adapter's default server exposes the ones plugins marked as public. So on a client site, turn off the default server and turn abilities on explicitly.
The ability's response goes back to the AI app, and so to the AI model provider. Don't hand out secrets and personal data through abilities unless needed (module 7).