> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# WP CLI

> Manage GetMCP servers, tools, and API keys from the command line — and run a one-shot health check from your CI.

GetMCP ships a `wp getmcp` command tree for [WP-CLI](https://wp-cli.org/), the official WordPress command-line interface. Use it to manage servers, list and test tools, mint API keys, and run a self-diagnostic — all without opening the admin UI.

It's the right tool when you want to:

* Provision servers from a deploy script or `wp-config` bootstrap
* Run a quick health check from CI before/after a release
* Pipe server or tool data into another tool (`--format=json` plays nicely with `jq`)
* Test a tool against a real upstream API without spinning up an MCP client

***

## Prerequisites

* **WP-CLI 2.5+** installed on the server. Check with `wp --info`. If WP-CLI isn't installed, follow the [official install guide](https://wp-cli.org/#installing).
* **GetMCP plugin active** on the WordPress install you're running commands against.
* Permission-wise, `wp` runs as the user that owns the WordPress install — there's no separate auth.

***

## Command Tree

```bash theme={null}
wp getmcp version
wp getmcp doctor

wp getmcp servers list           [--status=<status>] [--per-page=<n>] [--format=<format>]
wp getmcp servers get <id>       [--format=<format>]
wp getmcp servers create         --name=<name> [--slug=<slug>] [--auth-type=<type>]
wp getmcp servers delete <id>    [--yes]
wp getmcp servers pause <id>
wp getmcp servers resume <id>

wp getmcp tools list <server>    [--status=<status>] [--format=<format>]
wp getmcp tools test <server> <tool>
wp getmcp tools delete <tool>    [--yes]

wp getmcp keys list              [--format=<format>]
wp getmcp keys create            --name=<name> [--scopes=<scopes>]
wp getmcp keys revoke <id>       [--hard]
```

Run `wp help getmcp <subcommand>` for full options on any command (replace `<subcommand>` with the actual command name, e.g. `wp help getmcp servers create`).

***

## Common Tasks

### List your servers

<CodeGroup>
  ```bash Table theme={null}
  wp getmcp servers list
  ```

  ```bash JSON (for piping into jq) theme={null}
  wp getmcp servers list --format=json | jq '.[] | {slug, status}'
  ```

  ```bash Active only theme={null}
  wp getmcp servers list --status=active
  ```
</CodeGroup>

### Get one server's full configuration

```bash theme={null}
wp getmcp servers get my-api
```

The argument can be the server's **slug**, **UUID**, or **numeric ID** — the resolver tries each in order.

### Create a server from a deploy script

```bash theme={null}
wp getmcp servers create \
  --name="Customer API" \
  --slug=customer-api \
  --auth-type=bearer
```

The slug becomes part of the MCP endpoint URL: `https://yoursite.com/mcp/customer-api`.

### Pause and resume

```bash theme={null}
wp getmcp servers pause my-api
wp getmcp servers resume my-api
```

Paused servers return `503 Service Unavailable` to MCP clients without removing the server config — ideal for emergency cutovers.

### Test a tool against your upstream API

```bash theme={null}
wp getmcp tools test my-api list_users
```

Runs the tool through the live executor (with auth, parameter mapping, response transforms — everything an MCP client would trigger). Exits `1` if the upstream returns `isError: true` so you can use it as a smoke test in CI.

### Mint a one-shot API key

```bash theme={null}
wp getmcp keys create --name="CI deployment key" --scopes=tools,prompts
```

The plaintext key is printed **once** at creation. Copy it immediately — there's no way to retrieve it after this command exits.

```
Key:    ak_live_8f3a9b2c4e1d6f7a8b9c0d1e2f3a4b5c
ID:     12
Scopes: tools, prompts
```

### Revoke an API key

```bash theme={null}
wp getmcp keys revoke 12        # soft revoke (kept in DB for audit)
wp getmcp keys revoke 12 --hard # delete the row entirely
```

***

## Output Formats

Every list-style subcommand supports the standard WP-CLI formats via `--format=<format>`:

| Format  | Use when                                                        |
| ------- | --------------------------------------------------------------- |
| `table` | Human reading (default)                                         |
| `json`  | Piping into `jq` or another tool                                |
| `csv`   | Importing into a spreadsheet                                    |
| `yaml`  | Config-file generation                                          |
| `count` | You only need the row count                                     |
| `ids`   | You only need the IDs (e.g., to feed into another `wp` command) |

Combine `ids` + `xargs` for batch operations:

```bash theme={null}
wp getmcp servers list --status=draft --format=ids \
  | xargs -n1 wp getmcp servers delete --yes
```

***

## `wp getmcp doctor`

Runs a self-diagnostic and reports the status of every dependency GetMCP cares about. **Exits `1` on any failed check** so it's CI-friendly.

```bash theme={null}
wp getmcp doctor
```

Sample output:

```
✓ sodium extension              available
✓ curl extension                available
✓ database tables               present
✓ active servers                3 server(s) active
✓ license tier                  pro (active until 2027-05-12)

Status: HEALTHY
```

Use it as a release gate:

```yaml theme={null}
# .github/workflows/deploy.yml (excerpt)
- name: Verify GetMCP install
  run: wp getmcp doctor
```

If `doctor` exits non-zero the workflow fails before the rest of the deploy continues.

***

## Recipes

### Bulk-create servers from a CSV

```bash theme={null}
while IFS=, read -r name slug auth; do
  wp getmcp servers create --name="$name" --slug="$slug" --auth-type="$auth"
done < servers.csv
```

### Snapshot all servers as JSON for backup

```bash theme={null}
wp getmcp servers list --format=json > servers-backup-$(date +%Y%m%d).json
```

### Revoke every key matching a name pattern

```bash theme={null}
wp getmcp keys list --format=json \
  | jq -r '.[] | select(.name | startswith("CI ")) | .id' \
  | xargs -n1 wp getmcp keys revoke --hard
```

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="`wp: command not found`">
    WP-CLI isn't installed. Follow the [WP-CLI install guide](https://wp-cli.org/#installing) — on most VPS hosts it's a one-line `curl + chmod` step.
  </Accordion>

  <Accordion title="`Error: This does not seem to be a WordPress installation.`">
    Run from inside your WordPress directory, or pass `--path=/var/www/html` (the path to your WP root).
  </Accordion>

  <Accordion title="`Error: 'getmcp' is not a registered wp command`">
    The plugin isn't active on this install. Activate it with `wp plugin activate getmcp` and try again.
  </Accordion>

  <Accordion title="`tools test` fails with a 401 or 403">
    The tool's authentication isn't configured on this server. Check the **Authentication** tab in the GetMCP admin and confirm the bearer token / API key / OAuth credentials are set for the parent server.
  </Accordion>

  <Accordion title="`doctor` reports a license-tier error">
    Either the license activation hasn't completed yet (the InfiAuth client is still warming up) or your activation has expired. Check **License** in the admin and re-activate.
  </Accordion>
</AccordionGroup>

***

<Note>
  WP-CLI commands are gated behind `defined( 'WP_CLI' ) && WP_CLI` so the command classes never load during normal web requests — there's zero runtime cost on your front end.
</Note>
