Lesson 1.2. How an AI App Uses Abilities

"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"]
  1. The person writes a request in plain language.
  2. The AI app is connected to the site as an MCP connector and knows the list of tools.
  3. The request goes through a local proxy over HTTPS to the site's MCP server endpoint, with an Application Password.
  4. The MCP Adapter finds the matching ability in the registry.
  5. WordPress validates the input against input_schema and calls permission_callback, as the real user.
  6. Only then does execute_callback run, 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

PlaceWhat happensHow to close it
meta.public / meta.mcp.publicthe plugin itself marks the ability as open to MCPyou, not the plugin, decide what to turn on
The MCP Adapter default serverby default the adapter starts a server that exposes "public" abilitiesadd_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

PHP
// Turn off the MCP Adapter default server: the agent sees only your server.
add_filter( 'mcp_adapter_create_default_server', '__return_false' );
BASH
# 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

OptionSimplerRisk / costWhen to choose
The MCP Adapter default server as iszero setupexposes everything plugins marked publiclocal development, demos
Default off + your own allow-listcontrol over every abilitythe list needs setting up and maintaininga client site, production
Your own MCP server outside the adapterfull freedomseparate code and infrastructurespecial requirements (course appendix A)

Common mistakes

SymptomCauseFix
The agent sees abilities you didn't turn onthe default server is running, plugins marked them publicturn off the default server, use an allow-list
The agent picks the wrong toolvague label and descriptiondescribe the action the way a person would phrase it
The agent "can't" do what the admin canconnected with the password of a user with fewer permissionsthat'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

  1. List the abilities with public in meta through wp eval.
  2. Find which of them belong to core and which to plugins.
  3. 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

  1. What does an ability become for an AI app through the MCP Adapter?
  2. As whom are permissions checked when an agent calls?
  3. What does the mcp_adapter_create_default_server filter with __return_false do?
  4. Why does the agent need the description and schemas?

<details> <summary>Answers</summary>

  1. A tool.
  2. As the real WordPress user whose Application Password was used.
  3. Turns off the adapter's default server; only your server remains.
  4. 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).

Save your progress

Sign in or create a free account to mark lessons as completed and continue the whole course. You will come back to this lesson.