' \ * --env WP_API_URL='' \ * --env WP_API_USERNAME='' \ * --env WP_API_PASSWORD='' \ * -- npx -y '@automattic/mcp-wordpress-remote@latest' * * Shell metacharacters in URL/token are escape-safe via escapeshellarg(). */ final class ClaudeCodeClient extends AbstractMCPClient { /** * {@inheritDoc} */ public function get_client_slug(): string { return 'claude-code'; } /** * {@inheritDoc} */ public function get_client_name(): string { return 'Claude Code'; } /** * {@inheritDoc} * * @param string $server_url Already-sanitised server URL. * @param string $auth_token Already-issued Application Password (may be empty). * * @return string Shell-command snippet for `claude mcp add`. */ public function get_config_snippet( string $server_url, string $auth_token ): string { $key = $this->derive_server_key( $server_url ); $token = $this->safe_token( $auth_token ); $username = $this->current_username(); return sprintf( 'claude mcp add %s --env WP_API_URL=%s --env WP_API_USERNAME=%s --env WP_API_PASSWORD=%s -- npx -y %s', escapeshellarg( $key ), escapeshellarg( $server_url ), escapeshellarg( $username ), escapeshellarg( $token ), escapeshellarg( '@automattic/mcp-wordpress-remote@latest' ) ); } }