Generate an API Key
import { Tabs, TabItem } from ‘@astrojs/starlight/components’;
API keys authenticate AI agents to your site. Each key can be scoped to a role (admin, editor, designer, author) to limit what agents can do.
Option A — WP Admin
Section titled “Option A — WP Admin”- Go to WP Admin → MCPWP → Setup
- Click Generate API Key
- Copy the key — it’s shown once
Option B — WP-CLI
Section titled “Option B — WP-CLI”docker exec wp-test-wordpress-1 bash -c 'php -r "require_once \"/var/www/html/wp-load.php\";\$key = \"mcpwp_\" . bin2hex(random_bytes(24));update_option(\"mcpwp_api_key\", wp_hash_password(\$key));echo \$key;"'Or on a standard install:
wp eval '$key = "mcpwp_" . bin2hex(random_bytes(24));update_option("mcpwp_api_key", wp_hash_password($key));echo $key;'Key roles
Section titled “Key roles”| Role | What agents can do |
|---|---|
admin | Everything — full site control |
editor | Content + Elementor + media + SEO (~99 tools) |
designer | Elementor + Gutenberg + media + site CSS (~82 tools) |
author | Content + media + taxonomy (~40 tools) |
Use editor or designer for agency client installs. Reserve admin for your own AI sessions.
Verify the key
Section titled “Verify the key”curl -s https://YOUR-SITE.com/wp-json/mcpwp/v1/site-info \ -H "X-API-Key: mcpwp_YOUR_KEY" | jq .name→ Next: Connect your AI client