mcp

v0.2.0
@talktowp/mcp Checked 21 hours ago Published 2 months ago

MCP server for TalkToWP — WordPress health, incidents, plugin update risk, and guarded site updates for AI agents

@talktowp/mcp MCP server for TalkToWP. Gives an AI assistant read access to the WordPress fleet data TalkToWP already collects — site health, incidents, pending updates, performance, security posture, and anonymised plugin reliability data aggregated across every site TalkToWP monitors — plus tools to apply updates to a site. Setup 1. In TalkToWP, go to Settings → MCP and create an access token. It is shown once. Tick Allow site changes only if you want the assistant to be able to apply updates. 2.

Summary extracted from the README.

@talktowp/mcp

MCP server for TalkToWP. Gives an AI assistant read access to the WordPress fleet data TalkToWP already collects — site health, incidents, pending updates, performance, security posture, and anonymised plugin reliability data aggregated across every site TalkToWP monitors — plus tools to apply updates to a site.

Setup

  1. In TalkToWP, go to Settings → MCP and create an access token. It is shown once. Tick Allow site changes only if you want the assistant to be able to apply updates.
  2. Add the server to your MCP client:
{
  "mcpServers": {
    "talktowp": {
      "command": "npx",
      "args": ["-y", "@talktowp/mcp"],
      "env": { "TALKTOWP_TOKEN": "twp_live_..." }
    }
  }
}

For Claude Code:

claude mcp add talktowp --env TALKTOWP_TOKEN=twp_live_... -- npx -y @talktowp/mcp

Environment

Variable Required Default Purpose
TALKTOWP_TOKEN yes — Access token from Settings → MCP
TALKTOWP_API_URL no https://app.talktowp.com Override for self-hosted or local development
TALKTOWP_ACTION_WAIT_SECONDS no 45 How long a write tool waits for a job before returning it as still running. Clamped to 5–170. Raise it if your MCP client tolerates long tool calls and your host is slow.

Read tools

Fleet and sites

Tool What it returns
list_sites Every connected site with status, WP/PHP version, and pending update counts
get_site Full state of one site: versions, plugin inventory, caching, cron, SSL, hosting
get_performance Lighthouse scores, Core Web Vitals, page load and query timings, cache state
get_security_posture SSL, security headers, WAF, DNS email records, exposed PHP, last scan
get_site_history Recent uptime checks plus computed uptime and response-time summary
get_account_summary Fleet-wide totals and currently urgent incidents
refresh_site_data Asks the plugin to push current state now (changes nothing on the site)

Problems

Tool What it returns
list_incidents Detected problems, filterable by site, status, severity, and category
get_incident One incident in full, including any AI analysis already generated
list_activity Chronological log of observed changes — useful for "what changed before this broke"

Updates

Tool What it returns
list_pending_updates Pending core, plugin, and theme updates, per site or fleet-wide
assess_update_risk Fleet intelligence for one plugin, cross-checked against a specific site

assess_update_risk is the tool worth reaching for. It returns a plugin's reliability score, observed update success rate, common failure patterns, and known conflicting plugins — then, when given a site, reports which of those conflicting plugins are actually installed there. That cross-check is the difference between "this plugin sometimes conflicts with Wordfence" and "this plugin conflicts with Wordfence, which is running on this site right now."

Scores are Bayesian-smoothed toward 90, so read the confidenceTier before trusting the number: no_data (under 10 observations) means ignore the score entirely.

Site arguments accept anything that identifies one site — id, URL, hostname, or name. Ambiguous matches are reported rather than guessed.

Write tools

Tool What it does
update_plugins Update one or more plugins
update_theme Update a theme, defaulting to the active one
update_wordpress_core Update WordPress itself
activate_plugin Activate an already-installed plugin
deactivate_plugin Deactivate a plugin
clear_cache Clear object, page, and plugin caches
list_actions What changes are permitted right now, and recent attempts
get_action_status Outcome of a previously requested change

Three gates, all required

A write call succeeds only when all of these hold:

  1. The token carries the write scope.
  2. The site owner has enabled AI actions for that specific site.
  3. The specific action is on that site's allowed list.

None of this can be changed through this server, by design. Everything an assistant reads — plugin names, error messages, page content — is text someone else may control, so the decision to permit a change is kept with a human, out of band, from the TalkToWP dashboard. A refusal (action not allowed, AI actions are turned off) is information to relay, not an obstacle to route around.

Safety behaviour

  • Snapshot first. Plugin and theme updates archive the affected directory before touching it.
  • Verify after. TalkToWP loads the site and treats a 5xx or a WordPress critical-error page as broken — the latter can be served as a 200, which a status-code check would miss.
  • Automatic rollback. A site that fails verification is restored from the snapshot, and the job ends as rolled_back.
  • Core updates are the exception. WordPress core cannot be snapshotted or reverted from a plugin, so update_wordpress_core says so and cannot undo itself.
  • One change at a time per site, enforced in the database rather than by a check-then-act.
  • Idempotency. Pass idempotency_key when retrying after a timeout; the original job is returned instead of the action running twice.

Asynchronous by nature

A plugin update outlives a comfortable tool call. Write tools wait (TALKTOWP_ACTION_WAIT_SECONDS) and then return the job as still running, with finished: false. A change is only done at a terminal status:

Status Meaning
succeeded Applied, and the site responded normally afterwards
rolled_back Applied, broke the site, and was reverted from the snapshot
failed Did not complete
abandoned The worker stopped before reporting — the real outcome is unknown, so re-read the site

What does not exist

There are no tools for editing files, installing a plugin from an arbitrary source, deleting plugins or themes, changing users or roles, or running database queries. Those capabilities are absent from the platform and from the WordPress plugin, not merely withheld here.

Security model

  • Tokens are stored as SHA-256 hashes. The plaintext is returned once at creation and is unrecoverable afterwards.
  • Every request is scoped to the token owner's sites, server-side.
  • The backend enforces a route allowlist for token-authenticated requests. A leaked token cannot reach billing, account deletion, settings, site creation or deletion, AI chat endpoints, or the AI-actions enable/permission controls — regardless of its scopes.
  • Revoking a token in Settings → MCP cuts access within a minute.

Development

npm install
npm run check    # typecheck
npm run build    # emit dist/
npm run dev      # run from source over stdio

Point at a local backend with TALKTOWP_API_URL=http://localhost:5000.