Plugin Directory

Changeset 3799490


Ignore:
Timestamp:
11/13/2026 01:02:10 AM (5 days ago)
Author:
puneetindersingh
Message:

2.5.0: MCP server built in (POST /seo-meta-bridge/v1/mcp), Bearer keys, checklist setup screen

Location:
bulk-seo-meta-editor-for-ai-agents/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • bulk-seo-meta-editor-for-ai-agents/trunk/README.md

    r3767548 r3799490  
    252252`GET` shows the installed version and the version WordPress.org offers. `POST {"check": true}` asks WordPress to look for a new version now, `POST {"install": true}` installs the offered version the way the Update button does (the plugin stays active). It runs WordPress's own update code, so the build can only come from WordPress.org. Installing needs the right to update plugins, a site that forbids file changes is left alone, and an API key with the default scope cannot use the route.
    253253
    254 ## MCP server (Claude Code / Claude Desktop)
     254## MCP server inside the plugin (2.5.0+)
     255
     256The plugin is its own MCP server. Nothing to install on your computer.
     257
     2581. Settings > AI CLI Connector > **Make my key**.
     2592. Copy the setup for your tool. Claude Code:
     260
     261```
     262claude mcp add --transport http wp-your-site 'https://your-site.com/wp-json/seo-meta-bridge/v1/mcp' \
     263  --header 'Authorization: Bearer bsme_...'
     264```
     265
     266Cursor, VS Code and other clients that take an MCP settings file:
     267
     268```json
     269{ "mcpServers": { "wp-your-site": {
     270    "url": "https://your-site.com/wp-json/seo-meta-bridge/v1/mcp",
     271    "headers": { "Authorization": "Bearer bsme_..." } } } }
     272```
     273
     274Tools: `get_status`, `export_seo`, `update_seo`, `get_schema`, `update_image_alts`, `read_content`, `edit_content`, `replace_text`, `list_backups`, `undo_content_change`, `clone_page`, `list_redirects`, `save_redirect`, `delete_redirect`, `flush_sitemaps`.
     275
     276How it works: `POST /wp-json/seo-meta-bridge/v1/mcp`, JSON-RPC 2.0 over Streamable HTTP, one JSON answer per request (no event stream, no session; GET and DELETE answer 405). It signs nobody in by itself: the request needs an API key (`Authorization: Bearer`, `X-Bulkseme-Key` or Basic auth), an application password, or a browser session with a REST nonce, and the user needs `edit_posts`. Each tool runs one of the plugin's own routes inside the same request, so every route's argument and capability checks apply unchanged, and a default-scope key stays inside the plugin's routes. Requests with an `Origin` header from another site are refused. Security plugins or firewall rules that match on the REST path only see `/mcp`; the inner route's own checks still run.
     277
     278claude.ai and the ChatGPT app add remote servers through an OAuth sign-in, which this version does not offer.
     279
     280## Bundled npm MCP server (older setup)
    255281
    256282A Node.js MCP server is bundled in `mcp-server/`. Adds these tools to Claude:
  • bulk-seo-meta-editor-for-ai-agents/trunk/bulk-seo-meta-editor-for-ai-agents.php

    r3767548 r3799490  
    44 * Plugin URI:  https://github.com/puneetindersingh/bulk-ai-cli-connector
    55 * Description: Lets AI agents (Claude, ChatGPT, Perplexity) and automation scripts work on a site over the REST API: bulk-update Yoast SEO or Rank Math titles, descriptions and schema, edit page copy in Elementor, Beaver Builder, SiteOrigin, ACF and block or classic pages with a backup before every write, manage redirects, and sign in with an application password or an API key. Includes CSV import and export and a bundled MCP server.
    6  * Version: 2.4.0
     6 * Version: 2.5.0
    77 * Author: Puneet Singh
    88 * Author URI: https://github.com/puneetindersingh
    … …  
    1414
    1515// Keep in sync with the `Version:` header line above on every release.
    16 define('BULKSEME_VERSION', '2.4.0');
     16define('BULKSEME_VERSION', '2.5.0');
    1717
    1818define('BULKSEME_FILE', __FILE__);
    … …  
    4545require_once BULKSEME_DIR . '/includes/updates.php';
    4646
     47// An MCP server for AI tools, built on the routes above.
     48require_once BULKSEME_DIR . '/includes/mcp.php';
     49
    4750// ---- Schema merge filters ----------------------------------------------------
    4851// Registered from this file on purpose: a companion build finds these two
  • bulk-seo-meta-editor-for-ai-agents/trunk/includes/admin.php

    r3767548 r3799490  
    114114        'manual'  => __('Copy did not work. Press Ctrl+C (Cmd+C on a Mac) to copy', 'bulk-seo-meta-editor-for-ai-agents'),
    115115        'confirm' => __('Revoke this key? Anything that uses it stops working at once.', 'bulk-seo-meta-editor-for-ai-agents'),
     116        'mcpUrl'      => bulkseme_mcp_url(),
     117        'testing'     => __('Checking...', 'bulk-seo-meta-editor-for-ai-agents'),
     118        'testOk'      => __('Reachable. AI tools can reach this site; if yours still cannot connect, check the key.', 'bulk-seo-meta-editor-for-ai-agents'),
     119        'test404'     => __('Not found. The REST API address does not answer: check Settings > Permalinks, or a security plugin that turns the REST API off.', 'bulk-seo-meta-editor-for-ai-agents'),
     120        /* translators: %s: HTTP status code */
     121        'testBlocked' => __('Something is in the way (HTTP %s). A firewall or security plugin may be blocking the REST API.', 'bulk-seo-meta-editor-for-ai-agents'),
     122        'testFailed'  => __('No answer from the site. A firewall may be blocking the REST API.', 'bulk-seo-meta-editor-for-ai-agents'),
    116123    ]);
    117124});
    … …  
    147154}
    148155
     156/**
     157 * When an AI tool last used the site: the newest of the MCP endpoint's note and
     158 * the keys' last-used times. Returns ['time' => int, 'client' => string] or [].
     159 */
     160function bulkseme_last_ai_use() {
     161    $seen   = get_option('bulkseme_mcp_seen', []);
     162    $seen   = is_array($seen) ? $seen : [];
     163    $time   = isset($seen['time']) ? (int) $seen['time'] : 0;
     164    $client = '';
     165    $who    = isset($seen['user']) && is_string($seen['user']) ? $seen['user'] : '';
     166    if (!empty($seen['client']) && is_string($seen['client'])) {
     167        $client = $seen['client'] . (!empty($seen['client_version']) && is_string($seen['client_version']) ? ' ' . $seen['client_version'] : '');
     168    }
     169    foreach (bulkseme_keys_last_used() as $t) {
     170        if ((int) $t > $time) {
     171            $time   = (int) $t;
     172            $client = '';
     173            $who    = '';
     174        }
     175    }
     176    return $time ? ['time' => $time, 'client' => $client, 'user' => $who] : [];
     177}
     178
     179/** One step of the checklist: a tick or a number, a heading and its body. */
     180function bulkseme_step_open($done, $number, $title) {
     181    $circle = 'display:inline-block;width:26px;height:26px;border-radius:50%;text-align:center;line-height:26px;font-weight:600;margin-right:10px;box-sizing:border-box;';
     182    echo '<div style="border-top:1px solid #dcdcde;padding:14px 0 6px"><h3 style="margin:0 0 6px;display:flex;align-items:center">';
     183    if ($done) {
     184        echo '<span aria-hidden="true" style="' . esc_attr($circle . 'background:#00a32a;color:#fff') . '">&#10003;</span>';
     185    } else {
     186        echo '<span aria-hidden="true" style="' . esc_attr($circle . 'border:1px solid #8c8f94;color:#50575e;line-height:24px') . '">' . esc_html((string) (int) $number) . '</span>';
     187    }
     188    echo esc_html($title);
     189    if ($done) {
     190        echo ' <span class="screen-reader-text">' . esc_html__('(done)', 'bulk-seo-meta-editor-for-ai-agents') . '</span>';
     191    }
     192    echo '</h3><div style="margin-left:36px">';
     193}
     194
     195function bulkseme_step_close() {
     196    echo '</div></div>';
     197}
     198
     199/**
     200 * The ready-to-use setups for a new key. Fixed English, never translated: they
     201 * carry a live key, so a language pack must not be able to change an address
     202 * or add an instruction to them.
     203 */
     204function bulkseme_connection_setups($key, $scope, $user_login) {
     205    $api    = rest_url('seo-meta-bridge/v1/');
     206    $mcp    = bulkseme_mcp_url();
     207    $parts  = wp_parse_url($api);
     208    $origin = (isset($parts['scheme'], $parts['host']) ? $parts['scheme'] . '://' . $parts['host'] : home_url())
     209        . (isset($parts['port']) ? ':' . (int) $parts['port'] : '');
     210    $host   = wp_parse_url(home_url(), PHP_URL_HOST);
     211    $name   = 'wp-' . preg_replace('/[^a-z0-9-]+/', '-', strtolower(is_string($host) ? $host : 'site'));
     212    $name   = trim(substr($name, 0, 40), '-');
     213
     214    // The user pastes this into a shell. The site address comes from settings and filters, so the
     215    // command is left out entirely when the address holds anything but plain URL characters, and none
     216    // of those is special inside double quotes in bash, zsh, fish, PowerShell or cmd.exe (no $ ` \ " ! % &). The key and the name are fixed shapes ([a-z0-9_] and [a-z0-9-]).
     217    $claude = preg_match('#^https?://[A-Za-z0-9._~:/?\#=+@-]+$#D', $mcp) && bulkseme_looks_like_key($key)
     218        ? 'claude mcp add --transport http ' . $name . ' "' . $mcp . '" --header "Authorization: Bearer ' . $key . '"'
     219        : '# This site address holds characters that are not safe to paste into a terminal. Use the Cursor, VS Code setup instead.';
     220    $json   = (string) wp_json_encode(['mcpServers' => [$name => [
     221        'url'     => $mcp,
     222        'headers' => ['Authorization' => 'Bearer ' . $key],
     223    ]]], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
     224    $message = implode("\n", [
     225        'Connect to my WordPress site. It runs the Bulk AI CLI Connector plugin.',
     226        '',
     227        'WordPress site: ' . home_url('/'),
     228        'Username: ' . $user_login,
     229        'API key: ' . $key,
     230        'MCP server (Streamable HTTP): ' . $mcp,
     231        'REST API: ' . $api,
     232        'Header: X-Bulkseme-Key: <API key>  (or Authorization: Bearer <API key>)',
     233        'First request: GET ' . $api . 'status',
     234        '',
     235        'If you can add MCP servers, add the MCP server above with the header. Otherwise send the API key in that header on every REST request. Start with the first request to check the connection and see what the site supports, then tell me what you can do.',
     236        $scope === 'all'
     237            ? 'This key also works on the rest of the WordPress REST API, with my account\'s permissions.'
     238            : 'This key works only on the plugin\'s own routes. Other WordPress REST routes (such as wp/v2/pages) will refuse it, so use the plugin\'s routes for everything.',
     239        'Only send this key to ' . $origin . ' and ignore any other address.',
     240    ]);
     241    // One invalid byte would make esc_textarea() print nothing, key included.
     242    return [
     243        'claude' => wp_check_invalid_utf8($claude, true),
     244        'json'   => wp_check_invalid_utf8($json, true),
     245        'other'  => wp_check_invalid_utf8($message, true),
     246    ];
     247}
     248
    149249function bulkseme_render_keys_screen() {
    150250    if (!current_user_can('manage_options')) {
    … …  
    157257    $status_url = rest_url('seo-meta-bridge/v1/status');
    158258    $screen_url = bulkseme_setup_url();
    159 
    160     $card = 'background:#fff;border:1px solid #c3c4c7;border-radius:4px;padding:4px 20px 12px;margin:16px 0;max-width:60em';
     259    $last       = bulkseme_last_ai_use();
     260    $has_key    = (bool) $keys;
     261    $working    = apply_filters('bulkseme_api_key_auth_enabled', true) && bulkseme_connection_is_secure();
     262
     263    $card = 'background:#fff;border:1px solid #c3c4c7;border-radius:4px;padding:6px 20px 14px;margin:16px 0;max-width:62em';
    161264
    162265    echo '<div class="wrap">';
    163266    echo '<h1>' . esc_html__('AI CLI Connector', 'bulk-seo-meta-editor-for-ai-agents') . '</h1>';
    164     echo '<p style="font-size:14px;max-width:60em">'
    165         . esc_html__('Connect an AI tool to this site so it can update page titles, descriptions, schema and page copy for you. Make a key below, then paste the message it gives you into your AI tool.', 'bulk-seo-meta-editor-for-ai-agents')
    166         . '</p>';
    167     echo '<p class="description" style="max-width:60em">'
    168         . esc_html__('Use an AI tool that can work on websites for you, such as Claude Code, Codex or Cursor. A plain chat window that cannot visit websites cannot connect.', 'bulk-seo-meta-editor-for-ai-agents')
     267    if ($last) {
     268        // No sprintf over translated text: a language pack's format string must never be able to stop the screen.
     269        echo '<p style="font-size:14px;color:#00a32a;font-weight:600">'
     270            . esc_html__('Connected. Your AI last used this site at', 'bulk-seo-meta-editor-for-ai-agents') . ' '
     271            . esc_html(gmdate('Y-m-d H:i', $last['time']) . ' UTC') . '</p>';
     272    }
     273    echo '<p style="font-size:14px;max-width:62em">'
     274        . esc_html__('Let an AI tool update page titles, descriptions, schema, image alt text, redirects and page copy on this site. Every content change is backed up first and can be undone.', 'bulk-seo-meta-editor-for-ai-agents')
    169275        . '</p>';
    170276
    … …  
    185291    }
    186292
     293    echo '<div style="' . esc_attr($card) . '">';
     294    echo '<h2>' . esc_html__('Connect your AI to this site', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
     295
     296    // 1. The plugin.
     297    bulkseme_step_open(true, 1, __('Install the plugin', 'bulk-seo-meta-editor-for-ai-agents'));
     298    echo '<p>' . esc_html__('Done. The plugin is active.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     299    bulkseme_step_close();
     300
     301    // 2. A key, or the setups for the key just made.
     302    bulkseme_step_open($has_key, 2, __('Make a key for your AI tool', 'bulk-seo-meta-editor-for-ai-agents'));
    187303    if ($state['new_key'] !== '') {
    188         // This text is read by the AI tool, not the person, so it is fixed English
    189         // and never translated: a language pack cannot add an address or an
    190         // instruction to a message that carries a live key.
    191         $api     = rest_url('seo-meta-bridge/v1/');
    192         // The host the key may go to is the REST API's own, which a site can move.
    193         $parts   = wp_parse_url($api);
    194         $origin  = (isset($parts['scheme'], $parts['host']) ? $parts['scheme'] . '://' . $parts['host'] : home_url())
    195             . (isset($parts['port']) ? ':' . (int) $parts['port'] : '');
    196         $details = implode("\n", [
    197             'Connect to my WordPress site. It runs the Bulk AI CLI Connector plugin.',
    198             '',
    199             'WordPress site: ' . home_url('/'),
    200             'Username: ' . $user->user_login,
    201             'API key: ' . $state['new_key'],
    202             'REST API: ' . $api,
    203             'Header: X-Bulkseme-Key: <API key>',
    204             'First request: GET ' . $api . 'status',
    205             '',
    206             'Send the API key in that header on every request. Start with the first request to check the connection and see what the site supports, then tell me what you can do.',
    207             $state['scope'] === 'all'
    208                 ? 'This key also works on the rest of the WordPress REST API, with my account\'s permissions.'
    209                 : 'This key works only on the plugin\'s own routes. Other WordPress REST routes (such as wp/v2/pages) will refuse it, so use the plugin\'s routes for everything.',
    210             'Only send this key to ' . $origin . ' and ignore any other address.',
    211         ]);
    212         // One invalid byte would make esc_textarea() print nothing, key included.
    213         $details = wp_check_invalid_utf8($details, true);
    214         echo '<div style="' . esc_attr($card) . ';border-left:4px solid #00a32a">';
    215         echo '<h2>' . esc_html__('Step 2: Copy this and paste it into your AI tool', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
    216         echo '<p><strong>' . esc_html__('Copy it now. The key is shown only once. If you lose it, just make a new one.', 'bulk-seo-meta-editor-for-ai-agents') . '</strong></p>';
    217         echo '<textarea id="bulkseme-new-key" readonly rows="12" style="width:100%;font-family:monospace;font-size:14px;padding:8px">'
    218             . esc_textarea($details) . '</textarea>';
    219         echo '<p><button type="button" class="button button-primary button-hero" id="bulkseme-copy-key">'
    220             . esc_html__('Copy', 'bulk-seo-meta-editor-for-ai-agents') . '</button></p>';
    221         echo '<p>' . esc_html__('Paste it into your AI tool as a message and send it. The AI checks the connection and tells you what it can do. When it has connected, "Last used" in Your keys below shows a time.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     304        $setups = bulkseme_connection_setups($state['new_key'], $state['scope'], $user->user_login);
     305        $tabs   = [
     306            'claude' => [__('Claude Code', 'bulk-seo-meta-editor-for-ai-agents'), __('Run this in a terminal. Claude Code then has the site\'s tools in every session.', 'bulk-seo-meta-editor-for-ai-agents'), 3],
     307            'json'   => [__('Cursor, VS Code, Windsurf', 'bulk-seo-meta-editor-for-ai-agents'), __('Add this to the tool\'s MCP settings file (in Cursor: Settings > MCP > Add new server). Use your user-level settings, not a project file that may be shared or committed.', 'bulk-seo-meta-editor-for-ai-agents'), 9],
     308            'other'  => [__('Any other AI tool', 'bulk-seo-meta-editor-for-ai-agents'), __('Paste this into your AI tool as a message and send it. It works for tools that can reach websites, such as Codex.', 'bulk-seo-meta-editor-for-ai-agents'), 14],
     309        ];
     310        echo '<div style="border-left:4px solid #00a32a;padding-left:14px">';
     311        echo '<p><strong>' . esc_html__('Your key is ready. Pick your AI tool and copy its setup now: the key is shown only once. If you lose it, just make a new one.', 'bulk-seo-meta-editor-for-ai-agents') . '</strong></p>';
     312        echo '<p class="bulkseme-tabs" role="tablist">';
     313        $first = true;
     314        foreach ($tabs as $slug => $tab) {
     315            echo '<button type="button" role="tab" class="button' . ($first ? ' button-primary' : '') . '" data-bulkseme-tab="' . esc_attr($slug) . '" aria-selected="' . ($first ? 'true' : 'false') . '" style="margin:0 6px 6px 0">'
     316                . esc_html($tab[0]) . '</button>';
     317            $first = false;
     318        }
     319        echo '</p>';
     320        $first = true;
     321        foreach ($tabs as $slug => $tab) {
     322            echo '<div class="bulkseme-setup" data-bulkseme-panel="' . esc_attr($slug) . '"' . ($first ? '' : ' hidden') . '>';
     323            echo '<p>' . esc_html($tab[1]) . '</p>';
     324            echo '<textarea class="bulkseme-secret" readonly rows="' . (int) $tab[2] . '" style="width:100%;font-family:monospace;font-size:13px;padding:8px">'
     325                . esc_textarea($setups[$slug]) . '</textarea>';
     326            echo '<p><button type="button" class="button button-primary button-hero bulkseme-copy">'
     327                . esc_html__('Copy', 'bulk-seo-meta-editor-for-ai-agents') . '</button></p>';
     328            echo '</div>';
     329            $first = false;
     330        }
     331        echo '<p class="description">' . esc_html__('claude.ai and the ChatGPT app add sites through a sign-in screen that this version does not offer yet. Use one of the tools above.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
    222332        echo '</div>';
    223     }
    224 
     333    } else {
     334        if ($has_key) {
     335            echo '<p>' . esc_html__('Keys on this site:', 'bulk-seo-meta-editor-for-ai-agents') . ' ' . esc_html((string) count($keys)) . '. '
     336                . esc_html__('Make another one for a new AI tool or computer.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     337        }
     338        echo '<form method="post" action="' . esc_url($screen_url) . '">';
     339        wp_nonce_field('bulkseme_keys');
     340        echo '<input type="hidden" name="bulkseme_keys_action" value="generate">';
     341        echo '<p><label for="bulkseme-label"><strong>' . esc_html__('Name this key', 'bulk-seo-meta-editor-for-ai-agents') . '</strong></label><br>';
     342        echo '<input type="text" id="bulkseme-label" name="bulkseme_label" maxlength="80" class="regular-text" placeholder="'
     343            . esc_attr__('for example: Claude on my laptop', 'bulk-seo-meta-editor-for-ai-agents') . '"></p>';
     344        echo '<p><label for="bulkseme-scope"><strong>' . esc_html__('What the key can do', 'bulk-seo-meta-editor-for-ai-agents') . '</strong></label><br>';
     345        echo '<select id="bulkseme-scope" name="bulkseme_scope">';
     346        echo '<option value="plugin">' . esc_html__('SEO and page edits through this plugin only (safest)', 'bulk-seo-meta-editor-for-ai-agents') . '</option>';
     347        echo '<option value="all">' . esc_html__('Everything my account can do over the REST API', 'bulk-seo-meta-editor-for-ai-agents') . '</option>';
     348        echo '</select></p>';
     349        echo '<p class="description" style="max-width:48em">'
     350            . esc_html__('The key acts as your account and can never do more than your account can. The first choice covers every tool this plugin gives your AI. Pick the second only if your AI also needs to work outside this plugin, such as uploading images. Treat either kind like a password.', 'bulk-seo-meta-editor-for-ai-agents')
     351            . ' ' . esc_html__('Your account:', 'bulk-seo-meta-editor-for-ai-agents') . ' <code>' . esc_html($user->user_login) . '</code></p>';
     352        echo '<p><button type="submit" class="button button-primary button-large">'
     353            . esc_html__('Make my key', 'bulk-seo-meta-editor-for-ai-agents') . '</button></p>';
     354        echo '</form>';
     355    }
     356    bulkseme_step_close();
     357
     358    // 3. Add it to the AI tool.
     359    bulkseme_step_open((bool) $last, 3, __('Add it to your AI tool', 'bulk-seo-meta-editor-for-ai-agents'));
     360    echo '<p>' . esc_html__('After you make a key, this page gives you a ready setup for Claude Code, for Cursor and VS Code, and a message for any other AI tool. Nothing to install on your computer.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     361    echo '<p>' . esc_html__('MCP server address:', 'bulk-seo-meta-editor-for-ai-agents') . ' <code>' . esc_html(bulkseme_mcp_url()) . '</code></p>';
     362    bulkseme_step_close();
     363
     364    // 4. Proof that it worked.
     365    bulkseme_step_open((bool) $last, 4, __('Your AI has used this site', 'bulk-seo-meta-editor-for-ai-agents'));
     366    if ($last) {
     367        echo '<p>' . esc_html__('Confirmed at', 'bulk-seo-meta-editor-for-ai-agents') . ' ' . esc_html(gmdate('Y-m-d H:i:s', $last['time']) . ' UTC.');
     368        if ($last['client'] !== '') {
     369            echo ' ' . esc_html__('Client:', 'bulk-seo-meta-editor-for-ai-agents') . ' <code>' . esc_html($last['client']) . '</code>';
     370        }
     371        if ($last['user'] !== '') {
     372            echo ' ' . esc_html__('Account:', 'bulk-seo-meta-editor-for-ai-agents') . ' <code>' . esc_html($last['user']) . '</code>';
     373        }
     374        echo '</p>';
     375    } else {
     376        echo '<p>' . esc_html__('Not yet. This turns green the first time your AI tool reaches the site with a key.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     377    }
     378    echo '<p><button type="button" class="button" id="bulkseme-test">' . esc_html__('Check the site can be reached', 'bulk-seo-meta-editor-for-ai-agents') . '</button> '
     379        . '<span id="bulkseme-test-result" role="status" style="margin-left:8px"></span></p>';
     380    echo '<p class="description" style="max-width:48em">' . esc_html__('Run this if your AI reports a connection problem. It asks the MCP server address from your browser without signing in, the way an AI tool first reaches it, so it shows whether a firewall or security plugin is in the way. Nothing is sent anywhere else.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     381    if (!$working) {
     382        echo '<p><strong>' . esc_html__('Keys will not work until the warning at the top of this page is fixed.', 'bulk-seo-meta-editor-for-ai-agents') . '</strong></p>';
     383    }
     384    bulkseme_step_close();
     385    echo '</div>';
     386
     387    // Undo.
    225388    echo '<div style="' . esc_attr($card) . '">';
    226     echo '<h2>' . esc_html($keys
    227         ? __('Make another key', 'bulk-seo-meta-editor-for-ai-agents')
    228         : __('Step 1: Make a key for your AI tool', 'bulk-seo-meta-editor-for-ai-agents')) . '</h2>';
    229     echo '<form method="post" action="' . esc_url($screen_url) . '">';
    230     wp_nonce_field('bulkseme_keys');
    231     echo '<input type="hidden" name="bulkseme_keys_action" value="generate">';
    232     echo '<table class="form-table" role="presentation"><tbody>';
    233     echo '<tr><th scope="row"><label for="bulkseme-label">' . esc_html__('Name this key', 'bulk-seo-meta-editor-for-ai-agents') . '</label></th>';
    234     echo '<td><input type="text" id="bulkseme-label" name="bulkseme_label" maxlength="80" class="regular-text" placeholder="'
    235         . esc_attr__('for example: Claude', 'bulk-seo-meta-editor-for-ai-agents') . '">';
    236     echo '<p class="description">' . esc_html__('Optional. Helps you tell keys apart later.', 'bulk-seo-meta-editor-for-ai-agents') . '</p></td></tr>';
    237     echo '<tr><th scope="row"><label for="bulkseme-scope">' . esc_html__('What the key can do', 'bulk-seo-meta-editor-for-ai-agents') . '</label></th>';
    238     echo '<td><select id="bulkseme-scope" name="bulkseme_scope">';
    239     echo '<option value="plugin">' . esc_html__('SEO and page edits through this plugin only (safest)', 'bulk-seo-meta-editor-for-ai-agents') . '</option>';
    240     echo '<option value="all">' . esc_html__('Everything my account can do over the REST API', 'bulk-seo-meta-editor-for-ai-agents') . '</option>';
    241     echo '</select>';
    242     echo '<p class="description" style="max-width:46em">'
    243         . esc_html__('The key acts as your account and can never do more than your account can. Pick the second choice if your AI tool also needs to list posts, upload images or work outside this plugin. Treat either kind like a password.', 'bulk-seo-meta-editor-for-ai-agents')
    244         . ' ' . esc_html__('Your account:', 'bulk-seo-meta-editor-for-ai-agents') . ' <code>' . esc_html($user->user_login) . '</code></p></td></tr>';
    245     echo '</tbody></table>';
    246     echo '<p><button type="submit" class="button button-primary button-large">'
    247         . esc_html__('Make my key', 'bulk-seo-meta-editor-for-ai-agents') . '</button></p>';
    248     echo '</form>';
    249     if (!$keys) {
    250         echo '<h3>' . esc_html__('Step 2: Paste it into your AI tool', 'bulk-seo-meta-editor-for-ai-agents') . '</h3>';
    251         echo '<p>' . esc_html__('After you click Make my key, this page shows a short message with your site address and key, and a Copy button. Paste that message into your AI tool.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
    252     }
     389    echo '<h2>' . esc_html__('Undo', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
     390    echo '<p style="max-width:60em">' . esc_html__('Before your AI changes the text of a page or a category description, the old version is saved. The ten newest versions of each page are kept. To go back, ask your AI, for example: "Undo your last change to the About page."', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
    253391    echo '</div>';
    254392
     393    // Keys.
     394    echo '<div style="' . esc_attr($card) . '">';
    255395    echo '<h2>' . esc_html__('Your keys', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
    256396    if (!$keys) {
    257397        echo '<p>' . esc_html__('No API keys yet.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
    258398    } else {
    259         echo '<table class="widefat striped" style="max-width:62em"><thead><tr>';
     399        echo '<table class="widefat striped"><thead><tr>';
    260400        echo '<th>' . esc_html__('Label', 'bulk-seo-meta-editor-for-ai-agents') . '</th>';
    261401        echo '<th>' . esc_html__('Key starts with', 'bulk-seo-meta-editor-for-ai-agents') . '</th>';
    … …  
    269409                continue;
    270410            }
    271             $owner_id = isset($rec['user_id']) ? (int) $rec['user_id'] : 0;
    272             $owner    = bulkseme_key_user($rec);
    273             $prefix   = isset($rec['prefix']) && in_array($rec['prefix'], bulkseme_key_prefixes(), true) ? $rec['prefix'] : 'bsme_';
    274             $last    = !empty($used[$id])
     411            $owner_id  = isset($rec['user_id']) ? (int) $rec['user_id'] : 0;
     412            $owner     = bulkseme_key_user($rec);
     413            $prefix    = isset($rec['prefix']) && in_array($rec['prefix'], bulkseme_key_prefixes(), true) ? $rec['prefix'] : 'bsme_';
     414            $last_used = !empty($used[$id])
    275415                ? gmdate('Y-m-d H:i', (int) $used[$id]) . ' UTC'
    276416                : __('never', 'bulk-seo-meta-editor-for-ai-agents');
    277             $scope    = (isset($rec['scope']) && $rec['scope'] === 'all')
     417            $scope     = (isset($rec['scope']) && $rec['scope'] === 'all')
    278418                ? __('every REST route', 'bulk-seo-meta-editor-for-ai-agents')
    279419                : __('this plugin only', 'bulk-seo-meta-editor-for-ai-agents');
    … …  
    286426            echo '<td>' . esc_html($scope) . '</td>';
    287427            echo '<td>' . esc_html(!empty($rec['created']) ? gmdate('Y-m-d', (int) $rec['created']) : '-') . '</td>';
    288             echo '<td>' . esc_html($last) . '</td>';
     428            echo '<td>' . esc_html($last_used) . '</td>';
    289429            echo '<td><form method="post" action="' . esc_url($screen_url) . '" class="bulkseme-revoke-form" style="margin:0">';
    290430            wp_nonce_field('bulkseme_keys');
    … …  
    297437        echo '</tbody></table>';
    298438    }
    299 
    300     echo '<h2>' . esc_html__('Other ways to connect', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
    301     echo '<p style="max-width:60em">' . esc_html__('An application password works too, if your host allows it. Make one on your profile page and give your AI tool your username and that password instead of a key.', 'bulk-seo-meta-editor-for-ai-agents')
     439    echo '</div>';
     440
     441    // Disconnecting.
     442    echo '<div style="' . esc_attr($card) . '">';
     443    echo '<h2>' . esc_html__('Disconnecting an AI tool', 'bulk-seo-meta-editor-for-ai-agents') . '</h2>';
     444    echo '<p style="max-width:60em">' . esc_html__('Revoke its key in the table above. It stops working at once. Deactivating this plugin also stops every key, because only this plugin accepts them.', 'bulk-seo-meta-editor-for-ai-agents') . '</p>';
     445    echo '<p style="max-width:60em">' . esc_html__('If you ever gave an AI tool an application password instead of a key, deactivating this plugin does not stop it: revoke it on your profile page.', 'bulk-seo-meta-editor-for-ai-agents')
    302446        . ' <a href="' . esc_url(admin_url('profile.php#application-passwords-section')) . '">'
    303447        . esc_html__('Open Application Passwords', 'bulk-seo-meta-editor-for-ai-agents') . '</a></p>';
    304     echo '<details style="max-width:60em"><summary style="cursor:pointer">' . esc_html__('For developers', 'bulk-seo-meta-editor-for-ai-agents') . '</summary>';
     448    echo '</div>';
     449
     450    echo '<details style="max-width:62em"><summary style="cursor:pointer">' . esc_html__('For developers', 'bulk-seo-meta-editor-for-ai-agents') . '</summary>';
    305451    echo '<p class="description">'
    306         . esc_html__('Send the key in the X-Bulkseme-Key header, or as the password of HTTP Basic auth together with your username:', 'bulk-seo-meta-editor-for-ai-agents')
     452        . esc_html__('The MCP server answers JSON-RPC over POST (Streamable HTTP, no event stream). Send the key as Authorization: Bearer, in the X-Bulkseme-Key header, or as the password of HTTP Basic auth together with your username. An application password works on every route too.', 'bulk-seo-meta-editor-for-ai-agents')
    307453        . '</p>';
    308454    echo '<p><code>curl -H "X-Bulkseme-Key: bsme_..." ' . esc_html($status_url) . '</code></p>';
  • bulk-seo-meta-editor-for-ai-agents/trunk/includes/key-auth.php

    r3767548 r3799490  
    9292/**
    9393 * The key this request carries, or ''. Read from the X-Bulkseme-Key header
    94  * (X-SEOCLI-Key is accepted as a second name for it) or from the password of
     94 * (X-SEOCLI-Key is accepted as a second name for it), from the password of
    9595 * HTTP Basic auth, which WordPress has already split out of the Authorization
    96  * header.
     96 * header, or from an Authorization: Bearer header.
    9797 */
    9898function bulkseme_request_key() {
    … …  
    107107        }
    108108    }
     109    // "Authorization: Bearer <key>", the form most MCP clients send. Some
     110    // servers hand the header over only under the REDIRECT_ name.
     111    foreach (['HTTP_AUTHORIZATION', 'REDIRECT_HTTP_AUTHORIZATION'] as $name) {
     112        if (empty($_SERVER[$name]) || !is_string($_SERVER[$name])) {
     113            continue;
     114        }
     115        $value = trim(sanitize_text_field(wp_unslash($_SERVER[$name])));
     116        if (strncasecmp($value, 'Bearer ', 7) === 0) {
     117            $value = trim(substr($value, 7));
     118            if (bulkseme_looks_like_key($value)) {
     119                return $value;
     120            }
     121        }
     122    }
    109123    return '';
    110124}
    … …  
    168182        '', '/status', '/schema', '/sitemap/flush', '/bulk', '/bulk-alts', '/export', '/import',
    169183        '/content', '/content/replace', '/content/backups', '/content/revert', '/clone',
    170         '/redirect', '/merchant-policy', '/register-key',
     184        '/redirect', '/merchant-policy', '/register-key', '/mcp',
    171185    ];
    172186}
  • bulk-seo-meta-editor-for-ai-agents/trunk/includes/rest-seo.php

    r3760960 r3799490  
    198198                'supports_redirects' => true,
    199199                'supports_update'   => true,
     200                'supports_mcp'      => true,
     201                'mcp_url'           => bulkseme_mcp_url(),
    200202                'drops_invalid_product_schema' => (bool) apply_filters('bulkseme_drop_invalid_product_schema', true),
    201203                'builders'          => bulkseme_builders_status(current_user_can('activate_plugins')),
  • bulk-seo-meta-editor-for-ai-agents/trunk/js/keys-screen.js

    r3767548 r3799490  
    1 /* Settings > AI CLI Connector: copy the connection details once, and confirm before a key is revoked. */
     1/* Settings > AI CLI Connector: pick a setup, copy it once, check the site can be reached, and confirm before a key is revoked. */
    22( function () {
    33        'use strict';
    44
    55        var text = window.bulksemeKeys || {};
    6         var field = document.getElementById( 'bulkseme-new-key' );
    7         var button = document.getElementById( 'bulkseme-copy-key' );
     6        var fields = document.querySelectorAll( '.bulkseme-secret' );
     7        var buttons = document.querySelectorAll( '.bulkseme-copy' );
    88
    9         function done() {
    10                 field.value = text.cleared || 'Copied.';
    11                 button.disabled = true;
     9        // The key is shown once: after one confirmed copy every setup that holds it is cleared.
     10        function done( button ) {
     11                Array.prototype.forEach.call( fields, function ( f ) {
     12                        f.value = text.cleared || 'Copied.';
     13                        f.defaultValue = f.value; // the key also sits in the textarea's original text
     14
     15                } );
     16                Array.prototype.forEach.call( buttons, function ( b ) {
     17                        b.disabled = true;
     18                } );
    1219                button.textContent = text.copied || 'Copied';
    1320        }
    … …  
    1522        // Clear the key only when it really reached the clipboard. If the browser
    1623        // refused, leave it selected so it can be copied by hand.
    17         function legacyCopy() {
     24        function legacyCopy( field, button ) {
    1825                var copied = false;
    1926                try {
    … …  
    2229                } catch ( e ) {}
    2330                if ( copied ) {
    24                         done();
     31                        done( button );
    2532                } else {
    2633                        field.focus();
    … …  
    3037        }
    3138
    32         if ( field && button ) {
     39        Array.prototype.forEach.call( buttons, function ( button ) {
     40                var panel = button.closest( '.bulkseme-setup' );
     41                var field = panel ? panel.querySelector( '.bulkseme-secret' ) : null;
     42                if ( ! field ) {
     43                        return;
     44                }
    3345                field.addEventListener( 'click', function () {
    3446                        field.select();
    … …  
    3749                        var value = field.value;
    3850                        if ( navigator.clipboard && navigator.clipboard.writeText ) {
    39                                 navigator.clipboard.writeText( value ).then( done, legacyCopy );
     51                                navigator.clipboard.writeText( value ).then( function () {
     52                                        done( button );
     53                                }, function () {
     54                                        legacyCopy( field, button );
     55                                } );
    4056                        } else {
    41                                 legacyCopy();
     57                                legacyCopy( field, button );
    4258                        }
     59                } );
     60        } );
     61
     62        // Tabs: one setup shown at a time.
     63        var tabs = document.querySelectorAll( '[data-bulkseme-tab]' );
     64        Array.prototype.forEach.call( tabs, function ( tab ) {
     65                tab.addEventListener( 'click', function () {
     66                        var want = tab.getAttribute( 'data-bulkseme-tab' );
     67                        Array.prototype.forEach.call( tabs, function ( t ) {
     68                                var on = t === tab;
     69                                t.classList.toggle( 'button-primary', on );
     70                                t.setAttribute( 'aria-selected', on ? 'true' : 'false' );
     71                        } );
     72                        Array.prototype.forEach.call( document.querySelectorAll( '[data-bulkseme-panel]' ), function ( p ) {
     73                                p.hidden = p.getAttribute( 'data-bulkseme-panel' ) !== want;
     74                        } );
     75                } );
     76        } );
     77
     78        // Reachability: ask the MCP address without signing in, as an AI tool first
     79        // does. A 401 from this plugin means the address works; anything else means
     80        // something stands in the way.
     81        var test = document.getElementById( 'bulkseme-test' );
     82        var out = document.getElementById( 'bulkseme-test-result' );
     83        if ( test && out && text.mcpUrl && window.fetch ) {
     84                test.addEventListener( 'click', function () {
     85                        test.disabled = true;
     86                        out.textContent = text.testing || 'Checking...';
     87                        window.fetch( text.mcpUrl, {
     88                                method: 'POST',
     89                                credentials: 'omit',
     90                                headers: { 'Content-Type': 'application/json' },
     91                                body: '{"jsonrpc":"2.0","id":1,"method":"ping"}'
     92                        } ).then( function ( r ) {
     93                                return r.json().catch( function () {
     94                                        return null;
     95                                } ).then( function ( body ) {
     96                                        var ok = r.status === 401 && body && body.code === 'rest_not_logged_in';
     97                                        if ( ok ) {
     98                                                out.textContent = text.testOk || 'Reachable.';
     99                                                out.style.color = '#00a32a';
     100                                        } else if ( r.status === 404 ) {
     101                                                out.textContent = text.test404 || 'Not found.';
     102                                                out.style.color = '#d63638';
     103                                        } else {
     104                                                out.textContent = ( text.testBlocked || 'Blocked: HTTP %s.' ).replace( '%s', String( r.status ) );
     105                                                out.style.color = '#d63638';
     106                                        }
     107                                } );
     108                        } ).catch( function () {
     109                                out.textContent = text.testFailed || 'No answer.';
     110                                out.style.color = '#d63638';
     111                        } ).then( function () {
     112                                test.disabled = false;
     113                        } );
    43114                } );
    44115        }
  • bulk-seo-meta-editor-for-ai-agents/trunk/readme.txt

    r3767548 r3799490  
    44Requires at least: 5.7
    55Tested up to: 7.1
    6 Stable tag: 2.4.0
     6Stable tag: 2.5.0
    77Requires PHP: 7.4
    88License: GPLv2 or later
    … …  
    2323= What you can do with it =
    2424
    25 * **Connect Claude or ChatGPT to WordPress**: Claude Code and other command-line agents call the REST routes directly. Claude Desktop connects through the bundled MCP server. Anything else that can send an authenticated HTTP request works the same way, including n8n, Zapier and Make.
     25* **Connect Claude or ChatGPT to WordPress**: The plugin is its own MCP server: Claude Code, Cursor, VS Code and other MCP clients add one address and a key, with nothing to install on the computer. Agents that do not speak MCP call the REST routes directly. Anything else that can send an authenticated HTTP request works the same way, including n8n, Zapier and Make.
    2626* **Bulk edit Yoast SEO and Rank Math meta**: SEO titles, meta descriptions, focus keywords, canonical URLs, robots directives, Open Graph and Twitter fields on up to 100 posts, pages, products or term archives in one call. Works on the free editions.
    2727* **Edit Elementor and Beaver Builder pages with an AI agent**: read the headings, paragraphs, button labels and list items of a page as a list, change only the ones you name, and leave the layout exactly as it was. SiteOrigin Page Builder, Advanced Custom Fields text fields, Gutenberg, the classic editor, Divi and WPBakery pages are covered too.
    … …  
    6868* **Bulk image alt text**: update `_wp_attachment_image_alt` on up to 200 media-library attachments per call by image URL. Resolves CDN paths and `-WIDTHxHEIGHT` thumbnail suffixes back to the parent attachment automatically (v1.5.0+)
    6969* **CSV import / export**: round-trip your SEO meta through Excel or Google Sheets, posts and terms in one file
    70 * **MCP server**: bundled Node.js companion (`bulk-seo-meta-editor-mcp` on npm) so Claude Desktop and Claude Code can drive the plugin natively
     70* **MCP server built in**: one address on your site for Claude Code, Cursor, VS Code and other MCP clients, with 15 tools for SEO fields, schema, alt text, page copy, undo, page copies and redirects
    7171* **Auto-detection**: works with Yoast SEO or Rank Math, picks the active one automatically
    7272* **Per-object permission checks**: Contributors and Authors can only edit posts, media and terms they could edit in wp-admin; site-wide archive and global settings require an administrator
    … …  
    117117Plus robots, OG/Twitter description fields, and Rank Math primary-taxonomy keys.
    118118
    119 = MCP server for Claude Desktop and Claude Code =
    120 
    121 A Node.js MCP server is bundled at https://github.com/puneetindersingh/bulk-ai-cli-connector/tree/main/mcp-server and published to npm as `bulk-seo-meta-editor-mcp`. Add to Claude Desktop / Claude Code with one command and Claude can read, edit, bulk-update, and CSV-roundtrip SEO meta on any of your sites.
    122 
    123 The MCP server has ten tools, for SEO meta and schema. Page content, redirects and the other routes added in 2.0 are REST routes: an agent that can send HTTP requests, Claude Code for example, calls them directly.
     119= MCP server built in =
     120
     121The plugin answers MCP requests itself at `/wp-json/seo-meta-bridge/v1/mcp` (Streamable HTTP). Make a key on **Settings > AI CLI Connector** and copy the ready setup for Claude Code, for Cursor and VS Code, or a message for any other AI tool. Nothing to install on your computer.
     122
     123It has 15 tools: site status, SEO export and bulk update, stored schema, image alt text, read and edit page content, find and replace, content backups and undo, page copies, redirects and sitemap rebuilds. Each tool runs one of the plugin's own REST routes with the same permission checks, so a key limited to this plugin stays limited. claude.ai and the ChatGPT app add remote servers through a sign-in screen that this version does not offer yet.
     124
     125The older Node.js MCP server (`bulk-seo-meta-editor-mcp` on npm) still works for Claude Desktop.
    124126
    125127= Security =
    … …  
    1411431. Install from the WordPress.org plugin directory: **Plugins → Add New**, search for **Bulk AI CLI Connector**. Or with WP-CLI: `wp plugin install bulk-seo-meta-editor-for-ai-agents --activate`. Or upload `bulk-seo-meta-editor-for-ai-agents.zip` via **Plugins → Add New → Upload Plugin**
    1421442. Activate. A notice offers **Set up now**, or click **Settings** next to the plugin on the Plugins screen. Both open **Settings > AI CLI Connector**
    143 3. Click **Make my key**, then **Copy connection details**, and paste the site address, username and key into your AI tool. An Application Password (**Users > Your Profile > Application Passwords**) works too where the host allows it
     1453. Click **Make my key**, pick your AI tool and copy its setup: a Claude Code command, an MCP settings block for Cursor and VS Code, or a message for any other AI tool. An Application Password (**Users > Your Profile > Application Passwords**) works too where the host allows it
    1441464. Test: `curl -u 'username:app pass' https://yoursite.com/wp-json/seo-meta-bridge/v1/status`, or with a key: `curl -H 'X-Bulkseme-Key: bsme_...' https://yoursite.com/wp-json/seo-meta-bridge/v1/status`
    145147
    146 For the optional MCP server, install via npm: `npm install -g bulk-seo-meta-editor-mcp` and configure Claude Desktop / Claude Code with `WP_BASE_URL`, `WP_USER`, and `WP_APP_PASS` environment variables.
     148MCP clients (Claude Code, Cursor, VS Code): use the setup the settings screen gives you after you make a key. It adds `/wp-json/seo-meta-bridge/v1/mcp` with the key as an `Authorization: Bearer` header.
    147149
    148150== Frequently Asked Questions ==
    … …  
    150152= How do I connect Claude or ChatGPT to WordPress? =
    151153
    152 Install and activate the plugin, then open **Settings > AI CLI Connector** (or click **Settings** under the plugin's name on the Plugins screen), make a key and copy the connection details into your agent. An Application Password under **Users > Your Profile** works too where the host allows it. Claude Code and other command-line agents call the REST routes under `/wp-json/seo-meta-bridge/v1/` directly. Claude Desktop uses the bundled MCP server. ChatGPT and other tools work wherever they can send an authenticated HTTPS request. Start with `GET /status`, which reports the active SEO plugin and the fields available.
     154Install and activate the plugin, then open **Settings > AI CLI Connector** (or click **Settings** under the plugin's name on the Plugins screen), make a key and copy the setup for your agent. An Application Password under **Users > Your Profile** works too where the host allows it. Claude Code, Cursor and VS Code connect to the plugin's built-in MCP server with the setup the screen gives you. Other agents call the REST routes under `/wp-json/seo-meta-bridge/v1/` directly. ChatGPT and other tools work wherever they can send an authenticated HTTPS request. Start with `GET /status`, which reports the active SEO plugin and the fields available.
    153155
    154156= Is this an MCP server for WordPress? =
    155157
    156 It is a REST API plugin with an MCP server bundled alongside it. The MCP server (`bulk-seo-meta-editor-mcp` on npm) runs on your own computer and gives Claude Desktop and Claude Code ten tools for SEO meta and schema. Page content, redirects, page copies and API keys are REST routes, which an agent calls over HTTPS without MCP.
     158Yes. Since 2.5.0 the plugin is an MCP server itself, at `/wp-json/seo-meta-bridge/v1/mcp`, with 15 tools covering SEO fields, schema, alt text, page content with undo, page copies and redirects. Everything is also a REST route, which an agent can call over HTTPS without MCP.
    157159
    158160= Do I need WP-CLI, SSH or server access? =
    … …  
    178180= Can Claude or ChatGPT edit my WordPress SEO meta? =
    179181
    180 Yes, that is what it was built for. The bundled MCP server (`bulk-seo-meta-editor-mcp` on npm) gives Claude Code and Claude Desktop ten tools: status, read, write, bulk update, list posts, list terms, CSV export, CSV import, and schema get and set. Any other agent or automation tool can call the REST endpoints directly over HTTP Basic Auth.
     182Yes, that is what it was built for. Through the built-in MCP server, Claude Code and other MCP clients read and bulk update titles, descriptions, focus keywords, canonicals, social fields and schema. Any other agent or automation tool can call the REST endpoints directly with a key or an application password.
    181183
    182184= How do I bulk update image alt text? =
    … …  
    275277
    276278== Changelog ==
     279
     280= 2.5.0 =
     281* **MCP server built in.** The plugin answers MCP requests at `/wp-json/seo-meta-bridge/v1/mcp`, so Claude Code, Cursor, VS Code and other MCP clients connect with one address and a key, with nothing to install. 15 tools, each running one of the plugin's own routes with the same permission checks.
     282* API keys are also accepted as `Authorization: Bearer`, the form MCP clients send.
     283* New setup screen: a checklist with ready setups for Claude Code, for Cursor and VS Code, and a message for other AI tools; a check that the site can be reached; when and from which client your AI last used the site; and short Undo and Disconnect sections.
     284* `/status` reports `supports_mcp` and `mcp_url`.
    277285
    278286= 2.4.0 =
    … …  
    350358* Deleting the plugin now removes its API key hashes, on every site of a network.
    351359
    352 = 1.9.1 =
    353 * Security: SEO fields registered on the core `wp/v2` routes are now returned in the `edit` context only. Before this, a plain `GET /wp/v2/posts/<id>` included them for anyone who could read the post, logged in or not, and that included the focus keyword, which is not printed anywhere on the page. Clients that read `meta` from a core route must add `?context=edit`. The bundled MCP server already does.
    354 * Security: the active SEO plugin's own role rules now apply to writes through `/bulk`, `/import` and the core routes. Yoast SEO: canonical, robots and breadcrumb title fields, and custom schema, need `wpseo_edit_advanced_metadata` or `wpseo_manage_options` while Yoast's "Security: no advanced or schema settings for authors" setting is on. Rank Math: its `rank_math_onpage_general`, `rank_math_onpage_advanced`, `rank_math_onpage_social` and `rank_math_onpage_snippet` capabilities. A refused field is reported as `forbidden_field:<key>`. Filter: `bulkseme_user_can_edit_field_group`.
    355 * Security: archive and global scope settings now need the SEO plugin's own settings capability (`wpseo_manage_options` or `rank_math_titles`) as well as `manage_options`. This matters on multisite and on sites that use a role manager.
    356 * Security: `/bulk-alts` now also requires `upload_files`, so only users who can manage media can call it.
    357 * Security: `/export` now neutralises spreadsheet formulas. A cell that starts with `=`, `+`, `-`, `@`, a tab or a carriage return is written with a leading apostrophe, so Excel, Google Sheets and LibreOffice show it as text instead of running it. `/import` removes that apostrophe again, so a CSV round trip gives back the stored value unchanged. Use `/bulk` for values that must be taken literally.
    358 * Security hardening: text fields sent as an array or an object are now refused with `invalid_value_type:<key>` instead of being stored unsanitised. Before this, such a value could also end the request with a PHP error when it reached a URL field. Booleans and numbers are stored as text, and the two Rank Math list fields (`robots`, advanced robots) still accept lists.
    359 * `schema` sent as a JSON object or array, not only as a JSON string, is now validated and stored. It used to be read as empty, which cleared the stored schema.
    360 * `rank_math_primary_<taxonomy>` is only accepted for a taxonomy that exists.
    361 * Items and rows that are not objects are answered with `invalid_item` or `invalid_row`.
    362 
    363 = 1.9.0 =
    364 * New: custom JSON-LD schema on taxonomy terms. `/bulk` items with `kind: "term"` accept the same `schema` and `schema_mode` fields as posts, stored in term meta under the same keys, and `GET /schema?id=<term_id>&kind=term&taxonomy=<slug>` reads them back. The schema renders on the first page of the term archive only. On Rank Math the archive keeps its `CollectionPage` type next to an injected `FAQPage` instead of losing it.
    365 * New: schema output when no SEO plugin graph is printed. With no Yoast or Rank Math installed, or with their schema output switched off, stored schema is printed as the plugin's own JSON-LD block (encoded with JSON_HEX_TAG and JSON_HEX_AMP, on top of the existing markup checks). When a graph is printed, nothing changes: the nodes still merge into it. Filter `bulkseme_print_standalone_schema` disables the standalone block.
    366 * New: `post_title` accepted in `/bulk` items. Plain text only, slug untouched, `edit_post` required, empty values rejected with `empty_post_title`. `/import` keeps treating `post_title` as a read-only column.
    367 * New: `POST /sitemap/flush` clears the Rank Math and Yoast sitemap caches (`edit_others_posts` required) so sitemaps pick up REST edits without a wp-admin save.
    368 * New: invalid Product schema guard. `Product` nodes without `offers`, `review` or `aggregateRating` are removed from the Yoast and Rank Math graphs, together with any dangling `@id` references to them. Priced products are untouched. Disable with `add_filter('bulkseme_drop_invalid_product_schema', '__return_false')`.
    369 * `/status` now reports `supports_term_schema`, `supports_post_title`, `supports_sitemap_flush` and `drops_invalid_product_schema`.
    370 * Requires WordPress 5.7 or later (was 5.6) for `wp_print_inline_script_tag()`.
    371 
    372 = 1.8.2 =
    373 * Security: the custom JSON-LD schema field now rejects any value that contains a raw HTML angle bracket (< or >) when saved, and strips angle brackets from stored schema on output. This closes a stored cross-site scripting issue on Rank Math sites, where a crafted JSON-LD object key could break out of the schema script block. Yoast sites were not affected. No valid JSON-LD needs raw angle brackets, so normal schema is untouched. Reported responsibly by Junhui Mo (Guangzhou University).
    374 
    375 = 1.8.1 =
    376 * Security: `GET /export` now capability-filters every row it returns, using the same capability the matching write path enforces. Term rows require the `edit_term` meta capability on each term, so taxonomies registered with their own capabilities are respected. CPT archive rows require `manage_options`, matching the archive write path, because those values live in the SEO plugin's site-wide settings rather than on an object. Post rows are checked with `edit_post` per post instead of relying on the `edit_others_posts` pre-filter, which covers only the core post capabilities and not custom post types that declare their own `capability_type`. Rows the caller cannot manage are omitted, so `/export` no longer returns SEO metadata for objects the caller could not open in wp-admin.
    377 * Note: a caller who could previously export taxonomy terms or CPT archive settings without holding the matching capability will now receive fewer rows. Administrators, and Editors acting within their own capabilities, see no change. `row_count` still reports the number of rows actually emitted.
    378 
    379 = 1.8.0 =
    380 * Security: every bulk write now enforces a per-object capability check in addition to the route-level `edit_posts` gate. `POST /bulk-alts` checks `edit_post` on each resolved attachment, term updates check the `edit_term` meta capability on each term, and CPT archive updates now require `manage_options` (they change the SEO plugin's site-wide settings, the same bar the global scopes already had). Authors and Contributors can no longer touch objects they could not edit in wp-admin.
    381 * Changed: writes into Yoast SEO settings now go through Yoast's own public API instead of updating its stored options directly. Term meta is saved with `WPSEO_Taxonomy_Meta::set_values()` (merged with the term's current values so untouched fields are preserved) and archive/global titles with `WPSEO_Options::set()`, which routes each key to the right option group, validates it, and clears Yoast's caches. Rank Math ships no public setter for its title settings, so those writes still read-modify-write the option array Rank Math reads back, through a single documented helper.
    382 * Internal: the plugin version constant is now a plain define kept in sync with the plugin header, replacing the runtime header parse.
    383 
    384 = 1.7.0 =
    385 * Changed: `GET /export` now returns JSON in the shape `{ "filename", "row_count", "csv" }` instead of streaming raw CSV bytes. The `csv` field holds the complete CSV content; save it to a file to open in a spreadsheet. The plugin no longer produces any direct output, so every response flows through the REST API serializer. Query parameters and the CSV column shape are unchanged, and `/import` accepts the same CSV as before.
    386 * Upgraders: scripts that saved the old raw response body to a file should now read the `csv` field of the JSON response. The bundled MCP server 1.7.0 handles both shapes automatically.
    387 
    388 = 1.6.1 =
    389 * Fix: image alt updates now resolve far more image URLs to their media-library attachment. Previously the resolver only matched the exact stored file URL, so it missed the most common front-end forms and returned "not in media library" for images that were genuinely in the library. It now also resolves: size crops (foo-1024x683.jpg), the "-scaled" big-image original WordPress generates since 5.3 (whether the page references the scaled file or the plain original), cache-busting query strings, and images served from a CDN or alternate host that keep the /wp-content/uploads/ path. A safe filename fallback resolves year/month folder drift only when exactly one attachment owns that filename, so it never guesses between duplicates. Genuinely external or page-builder-hardcoded images (including most inline SVG icons) still report a clear "not an attachment" hint, since their alt lives in the builder, not the media library.
    390 
    391 = 1.6.0 =
    392 * New: custom JSON-LD schema per post or page. Store a block of structured data against any post and it is rendered inside the active SEO plugin's schema graph at output time (Yoast via the `wpseo_schema_graph` filter, Rank Math via `rank_math/json_ld`). The plugin emits no markup itself, so there is no extra output-escaping surface, and the nodes join the existing `@graph` instead of creating a second competing block (no duplicate-schema conflict).
    393   * Write with the `schema` field on `/bulk` or `/import`, e.g. `{ id: 12, meta: { schema: "{...JSON-LD...}", schema_mode: "add" } }`. JSON is validated on write; invalid JSON is rejected with `invalid_json_schema`.
    394   * `schema_mode`: `add` (default) merges your nodes into the graph; `replace` makes your nodes the whole graph for that page.
    395   * Accepts a full document (`{ "@context": ..., "@graph": [...] }`), a bare list of nodes, or a single node object. Per-node `@context` is dropped so the SEO plugin sets one top-level context.
    396   * New `GET /schema?id=123` reads back the stored schema and mode for a post.
    397   * `/status` now reports `supports_schema: true`.
    398 
    399 = 1.5.1 =
    400 * Internal: renamed all internal PHP function and define prefixes from `seo_meta_bridge_*` / `SEO_META_BRIDGE_*` to `bulkseme_*` / `BULKSEME_*` so the prefix derives directly from the plugin slug. No public REST surface changes: endpoints still live at `/wp-json/seo-meta-bridge/v1/*`. No migration required.
    401 * Internal: removed `if (!function_exists(...))` guards around the plugin's own helper functions per WordPress.org plugin guidelines. Unique prefixes prevent collisions; the guards were unnecessary and risked loading a same-named function from another plugin instead of ours.
    402 * Code clarity: added comments next to `update_option('wpseo_titles', ...)` and `update_option('rank-math-options-titles', ...)` documenting that those option keys belong to Yoast SEO and Rank Math respectively, not this plugin. We integrate WITH those plugins by reading and writing the exact keys they use; a custom-prefixed key would store data nowhere those plugins look.
    403 
    404 = 1.5.0 =
    405 * **New: bulk update image alt text.** New endpoint `POST /seo-meta-bridge/v1/bulk-alts` accepts `{ items: [{ image_url, new_alt }, ...] }` (max 200/req) and updates `_wp_attachment_image_alt` on the matching media-library attachment. Resolves URLs via `attachment_url_to_postid()` with two fallbacks: strips `-WIDTHxHEIGHT.ext` size suffix (so a `-300x200.jpg` thumb still maps to its parent attachment), then strips any query string. Each row reports `status: ok | unchanged | skipped | error` plus `attachment_id`, `matched_via`, and `previous_alt` so callers can audit changes. Skipped rows include a hint when the URL doesn't resolve to a media-library item (typical for CDN-hosted or page-builder-hardcoded images). `/status` now reports `supports_alts: true`.
    406 
    407 = 1.4.2 =
    408 * **Security: `/export` now filters by author for low-privilege roles.** Authors and Contributors (anyone with `edit_posts` but not `edit_others_posts`) calling `/export` previously received titles and SEO meta for every post and draft on the site, including drafts owned by other users. The endpoint now scopes the underlying `WP_Query` to the calling user's own authored posts when they lack `edit_others_posts`, matching the behaviour of the wp-admin Posts list. No change for Editors or Administrators: they continue to see all posts as before. Recommended upgrade for any site with multi-author setups.
    409 
    410 = 1.4.1 =
    411 * **Bug fix: term meta updates now invalidate Yoast's Indexable cache.** Previously, writing to `wpseo_taxonomy_meta` via `/bulk` (kind=term) updated the option correctly and `/export` read the new value back, but the FRONT-END kept rendering the old meta description because Yoast 14+ caches rendered SEO meta in the `yoast_indexable` table and our update didn't fire the hooks Yoast's Indexable_Term_Watcher listens on. After updating the term option, the plugin now also fires `do_action('wpseo_save_taxonomy_meta', $term_id, $taxonomy)` and the standard `do_action('edited_term', ...)`, and as a final safety net deletes the term's row in the Yoast indexable repository so Yoast rebuilds it on the next request. No-op when Yoast isn't installed (Rank Math path was unaffected and unchanged).
    412 
    413 = 1.4.0 =
    414 * CPT archive page support: write SEO meta to custom-post-type archive pages (e.g. `/challenges/`, `/news/`) for any CPT registered with `has_archive=true`. Yoast: stored in `wpseo_titles` option (`title-ptarchive-{ptype}`, `metadesc-ptarchive-{ptype}`); Rank Math: stored in `rank-math-options-titles` (`pt_{ptype}_archive_title`, `pt_{ptype}_archive_description`).
    415 * Global SEO scopes: write meta for `author_archive`, `date_archive`, `search`, `p404`, `home` (latest-posts mode) via a single registry. New scopes can be added in one place without touching dispatch code.
    416 * `/status` reports `supports_archives`, `supports_globals`, `archive_fields`, and `global_scopes` (alias map per active scope).
    417 * `/export?include_archives=1` appends one synthetic row per CPT-with-archive (id=0, kind=cpt_archive). Backwards compatible: pre-1.4 consumers ignore unknown kind values.
    418 * `/bulk` accepts the new kinds:
    419   * `{ id: 0, kind: "cpt_archive", post_type: "challenges", meta: {...} }`
    420   * `{ kind: "author_archive" | "date_archive" | "search" | "p404" | "home", meta: {...} }`
    421 * `/import` reads cpt_archive and global rows from CSV for round-trip edits.
    422 * Permission: cpt_archive requires the post type's `edit_posts` cap; global scopes require `manage_options` (admin-only: they affect site-wide SEO settings).
    423 
    424 = 1.3.0 =
    425 * **Taxonomy term archives are now editable**: categories, tags, and any custom taxonomy archive (e.g. WooCommerce `product_cat`, `product_tag`, theme-registered taxonomies). Previously the plugin only handled posts, pages and CPTs; term archive SEO meta had to be edited in wp-admin one term at a time.
    426 * `/status` now reports `supports_terms: true` and a `term_fields` alias map so clients can detect the capability.
    427 * `/export?include_terms=1` appends term archive rows to the CSV. New trailing `kind` and `taxonomy` columns flag term rows; post rows have `kind=post` with an empty `taxonomy`. Filter to specific taxonomies with `?taxonomy=category,product_cat`. Backwards compatible: v1.2.x clients that ignore the trailing columns see the same column shape.
    428 * `/export?post_type=any` now correctly returns all public post types (previously needed an explicit comma list of CPTs).
    429 * `/bulk` accepts term updates via `{ id: <term_id>, kind: "term", taxonomy: "category", meta: {...} }`. Existing post-update payloads are unchanged.
    430 * `/import` reads `kind` and `taxonomy` columns from CSV uploads so a mixed posts+terms export round-trips cleanly.
    431 * Yoast term meta is stored in the `wpseo_taxonomy_meta` option (read-modify-write per call). Rank Math term meta uses `wp_termmeta`. Per-taxonomy `edit_terms` capability is enforced on every write.
    432 
    433 = 1.2.0 to 1.2.6 =
    434 * First releases: `/status`, `/bulk`, `/export` and `/import` for Yoast and Rank Math, with per-post permission checks and the bundled MCP server. Later 1.2.x builds added the length columns and UTF-8 BOM in `/export`, field aliases in `/bulk`, and empty CSV cells left alone by `/import`.
     360= 1.2.0 to 1.9.1 =
     361* Earlier releases: Yoast and Rank Math field mapping, bulk and CSV routes, term and archive SEO, image alt text, custom schema, post titles and sitemap flushing. Full notes are in the GitHub repository's release history.
    435362
    436363== Upgrade Notice ==
     364
     365= 2.5.0 =
     366The plugin is now an MCP server itself: Claude Code, Cursor and VS Code connect with one address and a key. Existing keys keep working.
    437367
    438368= 2.4.0 =
  • bulk-seo-meta-editor-for-ai-agents/trunk/uninstall.php

    r3767548 r3799490  
    1818        delete_option('bulkseme_api_keys_used');
    1919        delete_option('bulkseme_setup_pending');
     20        delete_option('bulkseme_mcp_seen');
    2021        delete_post_meta_by_key('_bulkseme_seo_history');
    2122        restore_current_blog();
    … …  
    2526    delete_option('bulkseme_api_keys_used');
    2627    delete_option('bulkseme_setup_pending');
     28    delete_option('bulkseme_mcp_seen');
    2729    delete_post_meta_by_key('_bulkseme_seo_history');
    2830}
Note: See TracChangeset for help on using the changeset viewer.