Files
shopify-ai-backup/opencode/mcp-servers/wp-cli-testing/README.md
2026-02-08 20:15:38 +00:00

107 lines
2.7 KiB
Markdown

# 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:**
```json
{
"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:**
```json
{}
```
**Returns:**
```json
{
"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:
1. The Builder "External WP CLI testing" toggle is enabled
2. The chat server sets `OPENCODE_EXTRA_MCP_SERVERS` environment variable
3. 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 hostname
- `TEST_WP_SSH_USER` - SSH username
- `TEST_WP_SSH_KEY` - Path to SSH private key
- `TEST_WP_PATH` - WordPress installation path
- `TEST_WP_BASE_URL` - Base URL of site
- `TEST_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