Skip to content

AI and MCP

Gaurav Tiwari edited this page Sep 28, 2026 · 2 revisions

AI and MCP

Two separate, optional features live on the AI & MCP tab. Both are off by default.

  • Assistant access (WordPress 6.9+). An AI assistant you connect yourself can read GT Performance's cache and health evidence and, with a separate permission, purge or preload URLs, regenerate CSS, retry jobs and propose settings for an administrator to approve. It works through the WordPress REST API or the official WordPress MCP Adapter plugin.
  • AI adviser (WordPress 7.0+). Inside wp-admin, an administrator can ask the AI provider configured in WordPress to explain diagnostics. The adviser shows exactly what it will send, and sends nothing until you press Send.

Nothing is sent to an AI service automatically, from visitors or from scheduled tasks, and assistant operations run only when an assistant you connected asks for them. GT Performance stores no AI keys, bundles no AI or MCP library, and never installs the MCP Adapter for you. Caching and every other feature work the same without any of this.

Requirements

Feature Needs
Abilities over REST WordPress 6.9 or later (the Abilities API), Agent access set to Read-only or Read and operate, an administrator account (an Application Password for remote clients)
MCP clients (Claude, Codex, Cursor, ...) All of the above plus the WordPress MCP Adapter plugin. GT Performance was qualified against adapter 0.6.1
AI adviser WordPress 7.0 or later (the AI Client), an AI provider configured in WordPress through a provider plugin, and Enable the AI adviser

On older WordPress versions the tab says what is missing ("Requires WordPress 6.9 or later, which provides the Abilities API." or "Requires WordPress 7.0 or later, which includes the AI Client.") and the rest of the plugin is unaffected.

The AI & MCP tab

Panel Contents
MCP and REST access The Agent access setting, the REST API endpoint, MCP Adapter status and endpoint, the list of abilities, and Last read (the last read ability called, by which user, how long ago)
AI adviser Enable the AI adviser and Provider
Ask the adviser Shown while the adviser is enabled: prepare, review and send requests; recent answers
Assistant proposals and operations Shown while access is not Off, or once any operation exists: open settings proposals with Apply and Reject, and the 10 most recent operations

Assistant access

Permission model

Agent access (setting agents.mode) has three values:

Value Effect
Off (default) GT Performance abilities are hidden from REST and MCP, and every call is denied, even from a client that listed them earlier
Read-only The nine read abilities are available; the five operations stay hidden and are denied
Read and operate All fourteen abilities are available

On top of the mode:

  • Every call requires an administrator account (manage_options). The permission check denies anyone else with gtperf_forbidden, denies every call while access is Off with gtperf_agents_disabled, and denies operations under Read-only with gtperf_agents_read_only.
  • The check runs on every call, for REST, MCP and direct PHP execution alike. Changing the mode takes effect on the next call.
  • Operations run later in the background queue. Before one starts, it checks again that access is still Read and operate and that the requesting user is still an administrator. If not, it is cancelled with permission_revoked.
  • Agent access is never exported, imported, restored from settings history, or proposable by an assistant.
  • There is no full-site or zone purge, no settings apply, no credential change and no database access through abilities.

Connect over HTTPS with a WordPress Application Password for a dedicated administrator account, and revoke it from that user's profile to disconnect. An Application Password carries the account's full WordPress privileges, and the MCP Adapter's shared server may list other plugins' abilities too; GT Performance controls only its own.

Source: Permissions.

Read abilities

Available with Read-only or Read and operate. They return saved or local evidence; none purges, warms, rewrites rules, refreshes a provider or contacts an AI service.

Ability Input Returns
gt-performance/get-status none Plugin, WordPress and PHP versions; schema version and queue readiness; database engine (mysql or sqlite); which modules are on, including optimize_only for the cache mode; Abilities API, MCP Adapter and AI Client availability; the access mode; when the queue runner and the latest warm run last reported
gt-performance/explain-url url, optional variant (public or mobile) The Explain This Page report: cacheability and reason, cache key, stored page state and size, Cloudflare rule agreement. Does not request the URL
gt-performance/get-health none The redacted health report with its overall status
gt-performance/list-jobs optional status, type, cursor, limit (1-100, default 20) Background jobs, newest first, with status, attempts, timing and redacted errors. Payloads are omitted. Page with next_cursor
gt-performance/get-css-report url The stored unused CSS report for that URL in the current delivery mode: status (including stale), sizes and any error. No server paths. Does not generate CSS
gt-performance/get-settings optional section Current non-secret settings and their settings_hash. Credentials, account emails, Redis host and authentication, and hosting identifiers are never included
gt-performance/list-purge-receipts optional cursor, limit Saved purge verification receipts, newest first, redacted. Running a new verification is not part of it
gt-performance/preview-purge post_id, optional membership Which cached URLs an update to that post would purge under the current policy, and why. membership previews a publication, withdrawal or term change. Purges nothing. See Purging
gt-performance/get-operation operation_id The state and result of an operation or proposal. Changes nothing

Every result uses one envelope, so a client never infers success from the transport alone:

{
  "schema_version": 1,
  "site_id": 1,
  "observed_at": "2026-09-27T10:00:00+00:00",
  "data": { },
  "warnings": []
}

get-settings adds settings_hash. Warnings explain partial answers, for example that unused CSS is off or that the queue upgrade has not finished.

Source: ReadAbilities.

Operations

Available only with Read and operate.

Ability Input Does
gt-performance/purge-urls urls (1-20), request_id Purges the URLs from the page cache and the configured edge (Cloudflare or xCloud), then requests each one publicly and reports what visitors receive
gt-performance/preload-urls urls (1-20), request_id Queues preloads so the pages are rebuilt in the page cache. Preloads already waiting are reused; the result lists the job IDs
gt-performance/regenerate-css url, request_id Queues a fresh unused CSS build for one cacheable URL. Fails with unused_css_disabled while unused CSS is off
gt-performance/retry-job job_id, request_id Retries one failed preload, warming, unused CSS or image-variant job. Purge jobs and every other type cannot be retried by an assistant
gt-performance/propose-settings changes, expected_hash, request_id Records a settings proposal for an administrator to review. Changes nothing by itself. See below

How they behave:

  • URLs must be on this site: http or https, on a host the site answers to, without credentials in the URL. Anything else is rejected with gtperf_invalid_url.
  • request_id makes retries safe. It is a UUID you generate. Sending the same ID again returns the first result with replayed: true instead of doing the work twice. Reusing an ID with different arguments is refused (gtperf_request_conflict, HTTP 409).
  • Asynchronous. The call returns an operation_id and state at once. Poll get-operation for the result.
  • States: accepted, running, succeeded, partial, failed, cancelled, and for proposals proposed, applied, rejected, expired.
  • Purge results list, per URL, whether the origin entry was deleted or not_cached, the edge provider and its status (accepted, retrying, failed, unknown or not_configured), and one public request's HTTP status, CF-Cache-Status, X-GT-Cache and Age. The operation is partial when the edge purge failed, is still retrying or left no receipt, or when a public response was not a 200 that visitors may share. Edge requests already sent cannot be recalled.
  • Limits: 60 submissions per minute per user and 100 outstanding operations per site; both return HTTP 429. Retrying with the same request_id after waiting is safe.
  • Queue: operations run as agent_operation jobs in the background queue. While optional work is paused they wait, purges included.
  • Operation records are kept for 30 days (at most the newest 2,000 finished ones) in the {prefix}gtperf_operations table.

Sources: OperateAbilities, OperationService.

Settings proposals

An assistant can propose changes to a short allowlist of settings only:

Setting Allowed values
cache.preload true or false
cache.preload_max_urls 0 to 2000
javascript.defer true or false
javascript.delay true or false
javascript.delay_patterns List of up to 50 strings, 200 characters each
javascript.exclusions List of up to 50 strings, 200 characters each
media.critical_images 0 to 10
css.rollout_percent 0, 10, 25, 50 or 100
css.safelist List of up to 50 strings, 200 characters each

The flow:

  1. The assistant reads get-settings and sends its changes with that settings_hash as expected_hash. If settings changed since, the proposal is refused (gtperf_stale_settings, HTTP 409). Values that already match are refused too.
  2. The proposal is stored with its diff for 15 minutes. The response includes a review link to the AI & MCP tab.
  3. An administrator reviews it under Assistant proposals and operations and presses Apply or Reject, or uses WP-CLI:
    wp gt-performance operations proposals
    wp gt-performance operations apply 42
    wp gt-performance operations reject 42
  4. Apply re-checks the hash under the settings lock. If anything changed after the proposal, it expires instead of applying. An applied proposal is an ordinary settings save: the replaced values go to settings history with source proposal, and when Cloudflare is connected and page cache values changed, the notice asks you to sync Cloudflare.

A "confirmed" flag from a model authorizes nothing, and there is no remote apply.

Source: ProposalService.

Using the REST API

No extra plugin is needed. Scripts, automation tools and assistants that call HTTP APIs run abilities through the core Abilities API:

GET  /wp-json/wp-abilities/v1/abilities                                 list abilities you can see
GET  /wp-json/wp-abilities/v1/abilities/gt-performance/<name>/run       read abilities
POST /wp-json/wp-abilities/v1/abilities/gt-performance/<name>/run       operations

Read abilities are marked read-only, so WordPress requires GET with the input in the input query parameter. Operations require POST with a JSON body {"input": {…}}. Authenticate with an Application Password:

# Health report
curl -u 'agent-admin:xxxx xxxx xxxx xxxx xxxx xxxx' \
  'https://example.com/wp-json/wp-abilities/v1/abilities/gt-performance/get-health/run'

# Explain one URL
curl -G -u 'agent-admin:xxxx xxxx xxxx xxxx xxxx xxxx' \
  --data-urlencode 'input[url]=https://example.com/pricing/' \
  'https://example.com/wp-json/wp-abilities/v1/abilities/gt-performance/explain-url/run'

# Purge two URLs (Read and operate)
curl -X POST -u 'agent-admin:xxxx xxxx xxxx xxxx xxxx xxxx' \
  -H 'Content-Type: application/json' \
  -d '{"input":{"urls":["https://example.com/","https://example.com/pricing/"],"request_id":"0f8c7a52-3c1e-4b7e-9a51-2d3f4c5b6a70"}}' \
  'https://example.com/wp-json/wp-abilities/v1/abilities/gt-performance/purge-urls/run'

While access is Off, the GT Performance abilities are not listed and their run routes are refused.

Connecting an MCP client

MCP clients such as Claude, Codex and Cursor need the official WordPress MCP Adapter plugin, which turns abilities into MCP tools.

  1. Run WordPress 6.9 or later.
  2. Install and activate the WordPress MCP Adapter plugin.
  3. On AI & MCP > MCP and REST access, set Agent access to Read-only (or Read and operate) and save.
  4. Create a dedicated administrator account and, in its profile, an Application Password. Use HTTPS.
  5. Copy the endpoint from the MCP row on the tab, or from wp gt-performance abilities status. With the adapter's defaults it is https://example.com/wp-json/mcp/mcp-adapter-default-server; GT Performance asks the adapter for the route it actually registered, so a customized route is shown correctly.
  6. Configure the client. Over HTTP, the adapter's documentation uses the @automattic/mcp-wordpress-remote proxy:
    {
      "mcpServers": {
        "wordpress": {
          "command": "npx",
          "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
          "env": {
            "WP_API_URL": "https://example.com/wp-json/mcp/mcp-adapter-default-server",
            "WP_API_USERNAME": "agent-admin",
            "WP_API_PASSWORD": "xxxx xxxx xxxx xxxx xxxx xxxx"
          }
        }
      }
    }
    On the server itself, the adapter's WP-CLI transport runs as the user you name:
    {
      "mcpServers": {
        "wordpress": {
          "command": "wp",
          "args": ["--path=/path/to/wordpress", "mcp-adapter", "serve", "--server=mcp-adapter-default-server", "--user=agent-admin"]
        }
      }
    }
  7. The adapter's default server exposes three tools (discover abilities, get ability info, execute ability). The client finds the GT Performance abilities through them rather than as separate top-level tools.

The adapter's own options may change between its releases; its repository is the reference for client configuration.

Checking from WP-CLI

wp gt-performance abilities status
Row Shows
Abilities API available, or unavailable (WordPress 6.9+ required)
Agent access off, read or operate
MCP Adapter The active adapter version (with the qualified version when it differs), or not active
MCP endpoint The registered MCP route, or -
Abilities Every GT Performance ability name
wp gt-performance operations              # the 50 most recent operations: id, operation, state, target, user, created
wp gt-performance operations proposals    # open proposals, with each change as path: old -> new

Source: Integration.

AI adviser

The adviser explains GT Performance's own diagnostics in plain language, using the AI provider and credentials configured in WordPress. It needs WordPress 7.0 or later, which includes the AI Client, and a provider added through a provider plugin.

Settings

Under AI & MCP > AI adviser:

Setting Key What it does
Enable the AI adviser advisor.enabled Off by default. Lets administrators send a redacted diagnostic report to your AI provider from this tab
Provider advisor.provider Automatic (first configured provider), or one of the providers configured in WordPress. When none is configured the field says so

Neither setting is exported, imported or restored from history.

Asking

With the adviser enabled, Ask the adviser offers four questions under Ask about:

Question What the report contains
Explain how this page is cached and optimized The Explain This Page result for the URL you enter (relative path only), its unused CSS report if one exists, and the cache, css, javascript and media settings
Diagnose background queue and cache warming problems Queue counts and the oldest due job's wait, the 15 newest failed jobs (type, attempts, last error, time), the latest warm run, and the queue, queue runner, WP-Cron and warming health checks
Review the current optimization settings The cache, css, javascript, media, fonts and speculation settings and the full health report
Explain what a purge did or would do The 5 newest purge verification receipts, the latest Cloudflare purge result, and, if you enter a post ID, the purge preview for that post (up to 40 URLs)

It takes two explicit steps:

  1. Prepare request builds the report and shows "Ready to send N bytes to: provider" with Exactly what will be sent as JSON. The preview is held for 15 minutes for your user only.
  2. Send makes one request with exactly that report. Discard sends nothing.

URLs appear as relative paths, without scheme or host. The report holds no HTML bodies, cookies, orders, customer data, credentials or absolute server paths. Secrets are redacted, each string is capped at 600 characters, and the whole report at 24 KB (the largest lists are halved until it fits). Each item gets an evidence ID (E1, E2, ...) that the answer must cite.

The request

  • One request through the WordPress AI Client, with at most 2,000 output tokens, temperature 0.2 and a 30-second timeout. GT Performance names no model.
  • No tool loop and no automatic retry, including after an ambiguous failure.
  • One adviser request at a time per site, and at most 20 per site per UTC day. Failed requests count. The panel shows how many have been used today.
  • Provider problems are reported as such: rejected credentials, rate limiting, AI requests disabled or blocked by another plugin, or no configured provider that supports the request.

The answer

Model output is treated as untrusted text and checked against the report before it is shown:

  • Up to 8 findings, each with a title, explanation, confidence (low, medium, high) and the evidence IDs it relies on. A finding that cites nothing from the report is discarded.
  • Measurements a finding states (a number with a unit) that do not appear in the report are flagged under "Not in the report".
  • Up to 5 settings suggestions, only for the same allowlist as settings proposals, with valid values that differ from the current ones and cite evidence. Anything else is discarded, and suggestions that would turn on delay with no delay patterns are dropped.
  • Everything is shown as plain text; model output is never rendered as HTML or followed.
  • A response over 16 KB, or one that is not the expected structured answer, is discarded.

Suggestions have no authority. Create a proposal from these suggestions turns them into a settings proposal, which an administrator then applies under Assistant proposals and operations within 15 minutes, exactly like a proposal from an assistant. If settings changed after the request was prepared, the proposal is refused; ask again.

The last 20 answers are kept for seven days, and the panel shows the 5 newest with provider, model and token count.

Sources: Advisor, EvidenceBuilder, RecommendationValidator.

What is stored

Where What
gt_performance_agent_activity option The last read ability called, the user ID and the time
{prefix}gtperf_operations table Operations and proposals: requester, request ID, arguments, state and result. Kept 30 days
gt_performance_advisor_history option Up to 20 adviser answers for seven days: question, provider, model, token count, evidence IDs and the validated answer (not the report text)
gt_performance_advisor_quota option Today's adviser request count
Transient per user A prepared adviser request, for 15 minutes

With Remove all data when the plugin is deleted on, uninstalling removes these options and drops the operations table.

Related

Diagnostics · Tools · Purging · WP-CLI · External Services · Settings Reference

Clone this wiki locally