### Authorization Header Example Source: https://docs.easymcpai.com/creating-and-managing-api-tokens Shows the format for passing the API token as a Bearer header when configuring an AI client. ```http Authorization: Bearer YOUR_API_TOKEN ``` -------------------------------- ### Config file: ~/.codex/config.toml Source: https://docs.easymcpai.com/connect-openai-codex-cli-to-wordpress Alternative configuration by editing the config.toml file. Add this server definition and save; Codex picks it up on next start. ```toml [mcp_servers.wordpress] command = "npx" args = ["-y", "mcp-remote", "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "--header", "Authorization:Bearer YOUR_API_TOKEN", "--transport", "http-only"] ``` -------------------------------- ### Quick install: codex mcp add command Source: https://docs.easymcpai.com/connect-openai-codex-cli-to-wordpress Run this command in the terminal to add the WordPress MCP server to Codex. Replace the URL and YOUR_API_TOKEN with your actual values. ```bash codex mcp add wordpress -- npx -y mcp-remote https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp --header "Authorization:Bearer YOUR_API_TOKEN" --transport http-only ``` -------------------------------- ### Managed-hosting white-label configuration in wp-config.php Source: https://docs.easymcpai.com/white-label-and-hidden-admin A typical setup for a host that provisions sites from a template. It brands the plugin as 'Acme AI Connector', hides the admin and plugin row, sets a rate limit, requires manage_options for OAuth, and enables self-service keys. Customers see the host's name on the OAuth consent screen and profile page. ```php define( 'EASY_MCP_AI_BRAND_NAME', 'Acme AI Connector' ); define( 'EASY_MCP_AI_HIDE_ADMIN', true ); define( 'EASY_MCP_AI_HIDE_PLUGIN_ROW', true ); define( 'EASY_MCP_AI_RATE_LIMIT_PER_MINUTE', 30 ); define( 'EASY_MCP_AI_OAUTH_MIN_CAPABILITY', 'manage_options' ); define( 'EASY_MCP_AI_SELF_SERVICE_KEYS', true ); ``` -------------------------------- ### Connect with API Token: Endpoint URL Source: https://docs.easymcpai.com/connect-claude-ai-to-wordpress Use this URL format when adding a connector with an API token instead of OAuth. Replace YOUR_API_TOKEN with your actual token (starts with wpmcp_). Note that tokens in URLs can end up in server logs and browser history, so prefer OAuth when available. This method does not work on sites that accept API keys only in the Authorization header. ```text https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp/YOUR_API_TOKEN ``` -------------------------------- ### Verify connection: codex mcp list Source: https://docs.easymcpai.com/connect-openai-codex-cli-to-wordpress List configured MCP servers to verify the WordPress server appears. Run this after configuration. ```bash codex mcp list ``` -------------------------------- ### Configure claude_desktop_config.json with API token Source: https://docs.easymcpai.com/connect-claude-desktop-to-wordpress Add this server entry to claude_desktop_config.json to connect Claude Desktop to WordPress via Easy MCP AI using an API token. Replace the URL with your endpoint and YOUR_API_TOKEN with your actual token. Requires Node.js for the mcp-remote bridge. ```json { "mcpServers": { "wordpress": { "command": "npx", "args": [ "mcp-remote", "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "--header", "Authorization: Bearer YOUR_API_TOKEN" ] } } } ``` -------------------------------- ### Run codex command to restart session Source: https://docs.easymcpai.com/troubleshoot-enabled-tools-not-showing-in-ai-client Quit the current Codex session and run this command to restart it, as Codex loads the tool list when a session starts. ```bash codex ``` -------------------------------- ### Define EASY_MCP_AI_TOOLS in wp-config.php Source: https://docs.easymcpai.com/switch-tools-on-or-off-in-wp-config Add this constant to wp-config.php above the line '/* That's all, stop editing! */' to switch tools on or off. Each entry is a tool name followed by =on or =off, separated by commas or new lines. Names must match exactly; wildcards are not supported. An entry that is neither =on nor =off switches the tool off. The constant is read from wp-config.php first, then from the environment variable. ```php define( 'EASY_MCP_AI_TOOLS', 'wp_delete_user=off,wp_privileged_files_read_query=on' ); ``` -------------------------------- ### Log errors with easy_mcp_ai_after_tool_call Source: https://docs.easymcpai.com/detect-ai-tool-calls-in-your-code Example listener that logs an error when the tool call status is 'error'. It uses error_log() with the tool name, duration, and error message. A listener that throws is logged when WP_DEBUG is on and otherwise ignored. ```php add_action( 'easy_mcp_ai_after_tool_call', function ( $tool, $args, $context ) { if ( 'error' === $context['status'] ) { error_log( sprintf( 'AI tool %s failed after %s ms: %s', $tool, (string) $context['duration_ms'], $context['error'] ) ); } }, 10, 3 ); ``` -------------------------------- ### Export current settings with WP-CLI Source: https://docs.easymcpai.com/wp-config-constants Run this command to generate define() lines for the settings an administrator has already saved. On multisite, add `--url=https://subsite.example.com` to export one site's settings. The command prints the saved values, not the values currently active through constants, and never prints credentials, API keys, or internal state. ```sh wp easy-mcp-ai config export ``` -------------------------------- ### Define Easy MCP AI constants in wp-config.php Source: https://docs.easymcpai.com/wp-config-constants Add these define() lines to wp-config.php above the line '/* That's all, stop editing! Happy publishing. */'. PHP may cache wp-config.php via OPcache; allow revalidation or restart PHP workers after changes. ```php define( 'EASY_MCP_AI_RATE_LIMIT_PER_MINUTE', 30 ); define( 'EASY_MCP_AI_FORCE_DRAFT_ON_CREATE', true ); define( 'EASY_MCP_AI_OAUTH_MIN_CAPABILITY', 'manage_options' ); define( 'EASY_MCP_AI_DISABLED_TOOLS', array( 'wp_delete_post', 'wp_delete_page' ) ); define( 'EASY_MCP_AI_OAUTH_DCR_ENABLED', false ); ``` -------------------------------- ### mcp-remote Bridge Configuration for stdio-Based Clients Source: https://docs.easymcpai.com/connect-other-mcp-clients-to-wordpress JSON configuration for using the mcp-remote bridge to connect stdio-based MCP clients to the WordPress MCP server. Requires Node.js on the client machine; the WordPress server needs no extra setup. ```json { "command": "npx", "args": [ "-y", "mcp-remote", "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "--header", "Authorization:Bearer YOUR_API_TOKEN", "--transport", "http-only" ] } ``` -------------------------------- ### Configure WordPress MCP server in .vscode/mcp.json Source: https://docs.easymcpai.com/connect-github-copilot-to-wordpress Add this JSON to .vscode/mcp.json to register the WordPress MCP server with GitHub Copilot. Replace the URL with your endpoint and YOUR_API_TOKEN with your actual token. Never commit a real token; keep it in a per-developer file or an input variable. ```json { "servers": { "wordpress": { "type": "http", "url": "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "headers": { "Authorization": "Bearer YOUR_API_TOKEN" } } } } ``` -------------------------------- ### Add WordPress MCP server to ~/.cursor/mcp.json Source: https://docs.easymcpai.com/connect-cursor-to-wordpress Configuration for the Easy MCP AI WordPress MCP server. Replace the URL with your endpoint and YOUR_API_TOKEN with your actual token. Save the file; Cursor picks up the new server, or restart Cursor if it doesn't appear. ```json { "mcpServers": { "wordpress": { "url": "https://yoursite.com/wp-json/easy-mcp-ai/v1/mcp", "headers": { "Authorization": "Bearer YOUR_API_TOKEN" } } } } ``` -------------------------------- ### Hook signature for easy_mcp_ai_before_tool_call Source: https://docs.easymcpai.com/detect-ai-tool-calls-in-your-code The action fires immediately before a tool runs, after all gates (authentication, tool list, rate limit, capability, approval) have passed. At this point, easy_mcp_ai_is_tool_call() is already true. ```php do_action( 'easy_mcp_ai_before_tool_call', string $tool_name, array $arguments, array $context ); ```