If you ship a WordPress plugin, your users may soon ask whether it works with AI assistants. Adding MCP support lets a user’s assistant do things like create an item, run a report, or check a setting in your plugin, through a controlled interface you design.
This guide explains how to add MCP support to a WordPress plugin using the Abilities API and the MCP Adapter, and how to plan, secure, test, and document it. Versions and details change, so confirm specifics in the official documentation.
The Basic Idea
You do not have to build an MCP server inside your plugin. WordPress core includes the Abilities API, where plugins register “abilities”. The official MCP Adapter can expose those abilities to AI clients over MCP. Your plugin’s job is to describe what it can do, safely.
Step-by-Step Plan
- Decide what to expose. Pick a small set of high-value actions.
- Check requirements. The Abilities API needs a WordPress version that includes it. The MCP Adapter is separate.
- Register abilities on the
wp_abilities_api_initaction. - Define schemas for inputs, and describe them clearly.
- Write permission callbacks that use real capability checks.
- Write execute callbacks that validate input and return structured results.
- Decide visibility. Choose which abilities are public to MCP.
- Test with a real MCP client.
- Document what you expose and how to control it.
Decide What to Expose
| Good first abilities | Expose later, with care |
|---|---|
| Read settings or status | Change settings |
| List or search your plugin’s items | Bulk updates |
| Generate a read-only report | Delete data |
| Create a draft item | Publish or send anything to customers |
Register an Ability
This follows the pattern shown in the MCP Adapter’s documentation. It is an illustration, so check the current docs for required fields.
add_action( 'wp_abilities_api_init', function () {
wp_register_ability( 'my-plugin/list-items', [
'label' => 'List Items',
'description' => 'Lists items created by My Plugin',
'category' => 'site',
'input_schema' => [
'type' => 'object',
'properties' => [
'limit' => [ 'type' => 'integer', 'default' => 10 ],
],
],
'execute_callback' => 'my_plugin_list_items',
'permission_callback' => function () {
return current_user_can( 'manage_options' );
},
'meta' => [
'public' => true,
'annotations' => [ 'readonly' => true ],
],
] );
} );
Control Visibility
According to the adapter’s documentation, an ability’s meta.public setting controls whether it is discoverable on the default MCP server, and meta.mcp.public can override that for MCP only. This lets you keep an ability available to other WordPress code while opting it out of MCP. Behavior depends on WordPress and adapter versions, so verify it.
Security Checklist for Plugin Developers
- Write a real capability check for every ability. Never return true for sensitive actions.
- Validate and sanitize every input, even with a schema.
- Escape and limit outputs. Do not return secrets or unnecessary personal data.
- Mark read-only and destructive behavior accurately in annotations.
- Start with read-only abilities, and make write abilities opt-in.
- Consider a settings toggle so site owners can disable MCP exposure.
- Assume the caller is an AI model that can misunderstand instructions.
Give Site Owners Control
- List every exposed ability in your documentation.
- Offer a way to turn each one off.
- Explain the permissions each ability requires.
- Recommend using a limited user.
Test Thoroughly
- Run each ability with valid and invalid input.
- Test as users with different roles.
- Connect a real MCP client and try natural prompts.
- Check that opting out of MCP works.
- Test on the WordPress versions you support.
Document It
Good documentation helps users and reduces support. Explain what is exposed, what permissions apply, how to connect a client, and what to check if something fails.
Troubleshooting
Abilities Do Not Show Up
Check registration on wp_abilities_api_init, the visibility flags, and that the MCP Adapter is active.
Users Report Permission Errors
Their connected account may not meet your permission callback. Explain the required role.
It Fails on Older WordPress Versions
The Abilities API requires a version that includes it. Add a check and a clear notice.
Frequently Asked Questions
Do I need to write an MCP server in my plugin?
Not necessarily. Registering abilities lets the MCP Adapter expose them.
Which WordPress versions do I need?
A version that includes the Abilities API. Check the current documentation for details.
Should I expose write actions?
Start read-only. Add write actions carefully, with strong permission checks.
Can users disable it?
They should be able to. Offer a setting and explain it in your documentation.
Conclusion
To add MCP support to a WordPress plugin, register a small set of well-described abilities, protect each with real permission checks, control visibility, and document the result. Start read-only and expand with care.
See also our free MCP server for WordPress and what to expect from MCP Manager.
Explore ByteCore Stack Plugins
- MCP Manager β connect your WordPress site to AI assistants through MCP.
- SMTP Manager β reliable WordPress email delivery.
- Lightsail Manager β manage your AWS Lightsail CDN from WordPress.
