Skip to content

Switch Tools On or Off from wp-config.php ​

The EASY_MCP_AI_TOOLS constant switches individual Easy MCP AI tools on or off from wp-config.php or an environment variable. A tool named there is locked on the admin screens, so nobody can change it from WordPress. With one extra entry, the same constant also keeps every tool a future plugin update adds switched off until you name it. This guide explains the format and when to use each form.

In this article

When to Use It ​

Use EASY_MCP_AI_TOOLS when the set of tools on a site must not depend on what is saved in the database:

  • You manage many sites from one template or deployment pipeline and want the same tools on each.
  • You want a privileged tool such as the search and replace tool switched on, but only from code. See Privileged Tools in Easy MCP AI.
  • You want the tool list to stay exactly as you approved it, even after the plugin updates and adds new tools.

For a one-off change on a single site, the Disabled tools grid under Easy MCP AI > Settings > Advanced is simpler.

Name Tools On or Off ​

Add the constant to wp-config.php above the line /* That's all, stop editing! */:

php
define( 'EASY_MCP_AI_TOOLS', 'wp_delete_user=off,wp_privileged_files_read_query=on' );

Or set an environment variable with the same name:

sh
EASY_MCP_AI_TOOLS="wp_delete_user=off,wp_privileged_files_read_query=on"

The rules:

  • Each entry is a tool name followed by =on or =off. Separate entries with commas or new lines.
  • Names must match exactly. Wildcards are not supported, so wp_delete_*=off switches nothing off.
  • An entry that is neither =on nor =off, such as wp_delete_user or wp_delete_user=yes, switches the tool off. A tool listed twice with different values is also off. A typo can therefore never leave a tool on by accident.
  • A name that matches no tool is ignored.
  • The constant is read from wp-config.php first, then from the environment variable. It cannot be set from the database or by another plugin.

📝 Info: In wp-config.php you can also pass an array, such as array( 'wp_delete_user' => 'off', 'wp_privileged_files_read_query' => 'on' ), with 'on', 'off', true or false as values.

Keep New Tools Off After Updates ​

Without any extra entry, a tool that a later plugin update adds follows its own default, which is on for almost every tool. To keep your list complete instead, add *=off:

php
define( 'EASY_MCP_AI_TOOLS', 'wp_get_post=on,wp_list_posts=on,wp_update_post=on,*=off' );

With *=off in the list:

  • Every tool the list does not name is switched off, including plugin-integration tools, WordPress Ability tools and any tool a future update adds.
  • No admin screen and no saved setting can switch an unnamed tool on.
  • To allow a new tool after an update, add it to the list with =on.

* always means "everything not named here is off". Writing *=on or * on its own has the same effect as *=off; it never switches every tool on.

⚠️ Warning: With *=off, any tool you forget to name stops working for every AI client. Review the list after each plugin update, and name every tool your clients rely on.

How It Works with the Admin Screens ​

EASY_MCP_AI_TOOLS decides first. For a tool it does not name, the usual settings apply in this order:

  1. The Disabled tools list, saved under Easy MCP AI > Settings > Advanced or set with the EASY_MCP_AI_DISABLED_TOOLS constant.
  2. The tools an administrator switched on that are off by default, such as the privileged tools.
  3. The tool's own default.

On Easy MCP AI > Settings > Advanced and on Easy MCP AI > Tools, a tool named in the constant shows its state and is locked, with a note naming the constant. With *=off every row is locked, and a tool the list does not name shows as off.

The constant only decides whether a tool exists on the site. Each API token and OAuth connection still needs access to it; see Creating and Managing API Tokens and Managing OAuth Access.

EASY_MCP_AI_TOOLS is not included in the wp easy-mcp-ai config export command, and it does not appear in the Deployment-controlled settings list. For the other constants Easy MCP AI reads, see Configuring Easy MCP AI with wp-config.php Constants.

Examples ​

Switch off one tool and switch on one privileged tool, leaving everything else as configured:

php
define( 'EASY_MCP_AI_TOOLS', 'wp_delete_user=off,wp_privileged_search_replace_run=on' );

Allow only a fixed set of read tools, now and after every update:

php
define( 'EASY_MCP_AI_TOOLS', 'wp_get_post=on,wp_list_posts=on,wp_search=on,*=off' );

Bring back one tool that EASY_MCP_AI_DISABLED_TOOLS switches off:

php
define( 'EASY_MCP_AI_TOOLS', 'wp_delete_post=on' );
Was this helpful?