WP-CLI Testing MCP Server
This MCP server provides tools for testing WordPress plugins on an external WordPress multisite installation via WP-CLI over SSH.
Tools Provided
1. test_plugin_external_wp
Runs automated CLI tests on an external WordPress installation with full isolation via multisite subsites.
Features:
- Automatic subsite provisioning (
wp site create) - Plugin upload and activation
- Dependency installation (WooCommerce, ACF, etc.)
- WP-CLI based test execution
- Automatic cleanup after delay
Example:
{
"plugin_path": "/workspace/my-plugin",
"plugin_slug": "my-plugin",
"test_mode": "cli",
"required_plugins": [
{"plugin_slug": "woocommerce", "activate": true}
],
"test_scenarios": [
{
"name": "Plugin activates",
"type": "custom",
"wp_cli_command": "plugin activate my-plugin",
"assertions": {"wp_cli_success": true}
}
]
}
2. external_wp_testing_config
Returns the resolved configuration and validates required environment variables.
Example:
{}
Returns:
{
"ok": true,
"missing": [],
"config": {
"wpHost": "wp-test.example.com",
"wpSshUser": "wordpress",
"enableMultisite": true,
...
}
}
How It's Loaded
This server is NOT loaded automatically. It's injected dynamically by the chat server only when:
- The Builder "External WP CLI testing" toggle is enabled
- The chat server sets
OPENCODE_EXTRA_MCP_SERVERSenvironment variable - OpenCode reads that variable and adds this MCP server to its configuration
Configuration
All configuration is via environment variables (see EXTERNAL_WP_CLI_TESTING_SETUP.md):
TEST_WP_HOST- WordPress server hostnameTEST_WP_SSH_USER- SSH usernameTEST_WP_SSH_KEY- Path to SSH private keyTEST_WP_PATH- WordPress installation pathTEST_WP_BASE_URL- Base URL of siteTEST_WP_MULTISITE- Enable multisite (default: true)- etc.
Architecture
OpenCode (when toggle enabled)
↓ loads MCP server via OPENCODE_EXTRA_MCP_SERVERS
wp-cli-testing MCP Server
↓ imports ../../../chat/external-wp-testing.js
External WP Testing Module
↓ SSH connection
WordPress Multisite Test Server
↓ creates subsite
Isolated Test Environment
Dependencies
This MCP server relies on:
@modelcontextprotocol/sdk(provided by OpenCode)zod(provided by OpenCode)../../../chat/external-wp-testing.js(CommonJS module)
Notes
- Only
test_mode: "cli"is implemented (visual mode not yet supported) - Requires WordPress multisite configured on external server
- All plugin operations happen on isolated subsites
- Automatic cleanup scheduled after test completion