Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Adding an MCP Server to the WordPress Core Development Environment

Дата публикации: 08-04-2026 18:41:17

How I've enabled Claude Code to access all abilities registered with the Abilities API via MCP in the wordpress-develop environment.
The post Adding an MCP Server to the WordPress Core Development Environment appeared first on Weston Ruter.


Основное содержимое страницы с новостью.

I wanted to hook up Claude Code to be able to interact with my local wordpress-develop core development environment via MCP (Model Context Protocol). I couldn’t find documentation specifically for doing this, so I’m sharing how I did it here.

Assuming you have set up the environment (with Docker) and started it via npm run env:start.

1. Install & Activate the MCP Adapter plugin

The MCP adapter is not currently available as a plugin to install from the plugin directory. You instead have to obtain it from GitHub and install it from the command line. I installed it as a plugin instead of as a Composer package:

cd src/wp-content/plugins
git clone https://github.com/WordPress/mcp-adapter
cd mcp-adapter
composer install

Next, activate the plugin. Naturally, you can also just activate the “MCP Adapter” plugin from the WP admin. You can also activate it via WP-CLI (but from the project root working directory, since you can’t run this command from inside of the mcp-adapter directory:

npm run env:cli -- plugin activate mcp-adapter
2. Register the MCP server with Claude

Here’s the command I used to register the wordpress-develop MCP server with Claude:

claude mcp add-json wordpress-develop --scope user '{"command":"npm", "args":["--prefix", "~/repos/wordpress-develop/", "run", "env:cli", "--", "mcp-adapter", "serve", "--server=mcp-adapter-default-server", "--user=admin"]}'

Here’s the JSON with formatting:

{
	"command": "npm",
	"args": [
		"--prefix",
		"~/repos/wordpress-develop/",
		"run",
		"env:cli",
		"--",
		"mcp-adapter",
		"serve",
		"--server=mcp-adapter-default-server",
		"--user=admin"
	]
}

You may want to remove --scope user if you just want to register the MCP server for the one project. I tend to re-use the same WP environment for multiple projects (core and plugins), so I think it may make it easier for me to install at the user level instead.

You will also need to change the --prefix arg’s ~/repos/wordpress-develop/ value to correspond to where the repo is actually cloned on your system. I include this arg here so that when I start claude inside of a plugin project (e.g. inside src/wp-content/plugins/performance), it is able to successfully run the npm command in the package.json in the ancestor directory. You can remove this --prefix arg if this is not relevant to you.

Change the user from admin according to your needs.

3. Expose all abilities to MCP

Registered abilities are not exposed to MCP by default. This is a safety measure so that AI agents have to be explicitly allowed to perform potentially sensitive actions. So without any plugins active other than the MCP Adapter, prompting Claude with “discover abilities” results in:

No abilities found. The MCP server connection may be unstable. Try reconnecting again with /mcp.

However, since this is a local development environment, there is no concern about this (for me at least). To opt in all abilities to be exposed to MCP by default, you can use the following plugin code:

add_filter(
	'wp_register_ability_args',
	static function ( array $args, string $ability_id ): array {
		if (
			// Prevent exposing abilities in MCP except on a local dev environment.
			wp_get_environment_type() === 'local'
			&&
			// Omit abilities which the MCP Adapter already makes available itself.
			! str_starts_with( $ability_id, 'mcp-adapter/' )
		) {
			$args['meta']['mcp']['public'] = true;
		}
		return $args;
	},
	10,
	2
);

This is also available in a gist to facilitate installation via Git Updater.

Note: This filter does not currently apply if your ability is registered by extending Abstract_Ability in the AI plugin.

At this point, I can now open Claude (or re-connect to the MCP server) and see that it is able to see all (er, most) abilities that are registered on my wordpress-develop env with the same prompt “discover abilities”:

3 WordPress abilities available:

core/get-environment-info — Returns runtime context (PHP, database, WordPress version) with the ability name.

core/get-site-info — Returns site information (all fields or filtered subset)

core/get-user-info — Returns current user profile details

When I prompt “what’s the environment info?” it executes the core/get-environment-info ability via MCP and prints out:

  • Environment: local
  • PHP Version: 8.3.26
  • Database Server: 8.4.8 (MySQL)
  • WordPress Version: 7.1-alpha-62161-src

Now the environment just needs more abilities! I’ve filed a Performance Lab issue for us at the Core Performance table to work on adding abilities during Contributor Day at WordCamp Asia tomorrow.


Where I’ve shared this:

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1WordPress 6.9 Performance Landings010.9818-11-2025
2Post Date Block: Published & Modified04.3420-01-2026
3Claude Code et les serveurs MCP : ou comment transformer ton terminal en assistant surpuissant5727-07-2025
4nextcloud-mcp-server 0.133.10710-07-2026
5 The New Agency Stack: How Dev Shops Use Claude, Cursor, and Copilot in Production 08.4624-07-2026
6A peptalk for devs09.0118-07-2026
7Claudette5712-03-2026
8Security notice and deprecation: standalone circleci-mcp-server08.3220-07-2026
9[Перевод] Аутентификация в MCP в 2026: как было, как есть и как будет0707-07-2026
10ACP vs MCP: What's the difference for agentic coding?0502-07-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 6.56. Источник: weston.ruter.net.