@respira/wordpress-mcp-server 8.3.3 → 8.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAkBH,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAsHzE;;;;;;;;;;;;;;;;GAgBG;AACH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,MAAM,CAoBhF;AAiID,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAgC;IACnD,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,cAAc,CAAwB;IAC9C,OAAO,CAAC,YAAY,CAA4B;IAChD,8EAA8E;IAC9E,OAAO,CAAC,YAAY,CAA4B;IAChD,8EAA8E;IAC9E,OAAO,CAAC,mBAAmB,CAAS;IACpC,iFAAiF;IACjF,OAAO,CAAC,iBAAiB,CAAK;IAC9B,iFAAiF;IACjF,OAAO,CAAC,mBAAmB,CAAgC;IAE3D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAsB;IAEhE;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;gBA4Bb,WAAW,EAAE,mBAAmB,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE;IA6VvE,OAAO,CAAC,cAAc;IAItB;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAkB5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAiCrB,gEAAgE;IAChE,OAAO,CAAC,aAAa;IAUrB;;;;;;O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wBAAwB,CAAU;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAS;IAC1D;;mDAE+C;IAC/C,OAAO,CAAC,0BAA0B,CAAoC;IAEtE;;;;;;;;OAQG;YACW,0BAA0B;YAyC1B,oBAAoB;YA6CpB,2BAA2B;IAQzC;;;;OAIG;YACW,cAAc;IAQ5B,OAAO,CAAC,mBAAmB;IAw9C3B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAe3C;IAEF;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;YAmCpB,cAAc;IAuH5B,oEAAoE;IACpE,OAAO,CAAC,iBAAiB;IAoBzB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,eAAe;YAuCT,gBAAgB;IAg7C9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoazB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA+UxB,GAAG;CA+CV"}
package/dist/server.js CHANGED
@@ -18,7 +18,7 @@ import { getBricksTools, dispatchBricksTool } from './bricks-tools.js';
18
18
  import { getElementorTools, dispatchElementorTool } from './elementor-tools.js';
19
19
  import { getAcfTools, resolveAcfToolName } from './acf-tools.js';
20
20
  import { getUsageEmitter, deriveToolKind } from './usage-emitter.js';
21
- import { collapseLauncherProcesses, validateApiKeyShape, describeConfigOrigin } from './config.js';
21
+ import { collapseLauncherProcesses, validateApiKeyShape, describeConfigOrigin, configOriginKey } from './config.js';
22
22
  // Process-local secret keeps target hashes useful for same-session retry
23
23
  // detection without making low-entropy WordPress ids reversible centrally.
24
24
  const TELEMETRY_HASH_SECRET = randomUUID();
@@ -39,12 +39,70 @@ const TELEMETRY_HASH_SECRET = randomUUID();
39
39
  * single biggest day-to-day friction across sessions on 2026-05-23.
40
40
  *
41
41
  * State lives in `~/.respira/state.json`. Single small object so we can
42
- * extend it without a schema migration; only `last_active_site_id` is
43
- * read today. Best-effort: any IO failure logs to stderr and falls back
44
- * to the configured default site (the pre-v6.18.7 behaviour).
42
+ * extend it without a schema migration. Best-effort: any IO failure logs
43
+ * to stderr and falls back to the configured default site (the
44
+ * pre-v6.18.7 behaviour).
45
+ *
46
+ * Ticket 5004a473: that file is machine-global, and `last_active_site_id`
47
+ * was a single top-level key. So a switch_site made in one Respira MCP
48
+ * connection re-pointed a DIFFERENT connection on the same machine at its
49
+ * next start, silently, across accounts and clients. The active site is now
50
+ * stored per connection in `active_site_by_config`, keyed by
51
+ * configOriginKey(). `last_active_site_id` is still written, both so an
52
+ * older server version on the same machine keeps working and so the
53
+ * migration below can tell a pre-upgrade file (no owner recorded) from one
54
+ * written by another connection (owner recorded, and not us).
45
55
  */
46
56
  const STATE_DIR_PATH = join(homedir(), '.respira');
47
57
  const STATE_FILE_PATH = join(STATE_DIR_PATH, 'state.json');
58
+ /**
59
+ * Which site should this connection restore, given the state file contents?
60
+ *
61
+ * Pure so it can be tested without touching the real ~/.respira/state.json.
62
+ *
63
+ * 1. This connection's own namespaced entry always wins.
64
+ * 2. Otherwise fall back to the legacy top-level key ONLY when no other
65
+ * connection has claimed it. A file written before this change has no
66
+ * `last_active_config`, so a single-connection customer upgrading keeps
67
+ * the site they had picked. A file written by another connection is
68
+ * ignored, which is the whole point of the fix.
69
+ * 3. Returning an id is not the same as using it: the caller still requires
70
+ * that the id exists in ITS OWN site map and passes the RESPIRA_SITES
71
+ * filter before restoring, so a stale or foreign id degrades to the
72
+ * configured default rather than routing anywhere unexpected.
73
+ */
74
+ export function pickActiveSiteIdForConfig(state, namespace) {
75
+ const scoped = state?.active_site_by_config;
76
+ if (scoped && typeof scoped === 'object' && !Array.isArray(scoped)) {
77
+ const owned = scoped[namespace];
78
+ if (typeof owned === 'string' && owned.length > 0) {
79
+ return owned;
80
+ }
81
+ }
82
+ const legacy = state?.last_active_site_id;
83
+ if (typeof legacy === 'string' && legacy.length > 0) {
84
+ const owner = state?.last_active_config;
85
+ if (typeof owner !== 'string' || owner.length === 0 || owner === namespace) {
86
+ return legacy;
87
+ }
88
+ }
89
+ return null;
90
+ }
91
+ /**
92
+ * The write half of the namespacing. Returns the patch to persist: the
93
+ * connection's own entry, plus the legacy pair kept in sync so older server
94
+ * versions and the migration path above both stay correct.
95
+ */
96
+ export function applyActiveSiteIdForConfig(state, namespace, siteId) {
97
+ const existing = state?.active_site_by_config;
98
+ const scoped = existing && typeof existing === 'object' && !Array.isArray(existing) ? { ...existing } : {};
99
+ scoped[namespace] = siteId;
100
+ return {
101
+ active_site_by_config: scoped,
102
+ last_active_site_id: siteId,
103
+ last_active_config: namespace,
104
+ };
105
+ }
48
106
  function loadRespiraMcpState() {
49
107
  try {
50
108
  if (!existsSync(STATE_FILE_PATH)) {
@@ -254,6 +312,29 @@ const SITE_AGNOSTIC_TOOLS = new Set([
254
312
  'respira_switch_site',
255
313
  'respira_redeem_token',
256
314
  ]);
315
+ /**
316
+ * Read tools that report site IDENTITY or list a site's own content, and are
317
+ * therefore the calls where routing to the wrong site is invisible but total.
318
+ *
319
+ * Ticket 5004a473 (D.B., agency, 2026-07): a connection the customer had named
320
+ * "DB-Services staging" answered get_site_context and list_pages for a
321
+ * completely different site. The connection NAME is cosmetic — nothing in this
322
+ * server reads it — so a connection carrying the whole account silently answers
323
+ * as the account's default site, and the default is just whichever site was
324
+ * activated first. Both of his calls were reads, and the routing notice below
325
+ * only fired for writes, so he got zero signal and reasonably concluded Respira
326
+ * had mixed two customers' sites together.
327
+ *
328
+ * Deliberately short. This is not "every read tool": a notice on all 300+ reads
329
+ * would be noise that teaches agents to ignore it. These four are the ones whose
330
+ * whole purpose is to tell you what you are looking at.
331
+ */
332
+ const DEFAULT_SITE_NOTICE_READ_TOOLS = new Set([
333
+ 'wordpress_get_site_context',
334
+ 'wordpress_get_active_site',
335
+ 'wordpress_list_pages',
336
+ 'wordpress_list_posts',
337
+ ]);
257
338
  /**
258
339
  * v6.12.0: Schema fragment auto-injected into every non-agnostic tool's
259
340
  * inputSchema.properties. Lets callers override the active site on a single
@@ -301,6 +382,12 @@ export class RespiraWordPressServer {
301
382
  lastSiteRefreshAt = 0;
302
383
  /** Dedupe concurrent self-heals so parallel list_sites calls share one fetch. */
303
384
  siteRefreshInFlight = null;
385
+ /**
386
+ * 5004a473: key under which this connection's active site is persisted in
387
+ * the machine-global ~/.respira/state.json. Derived from the config origin,
388
+ * so a switch_site in another connection can never re-point this one.
389
+ */
390
+ stateNamespace = configOriginKey();
304
391
  static MCP_SERVER_VERSION = MCP_SERVER_VERSION;
305
392
  /**
306
393
  * Normalize a tool name: respira_* → wordpress_* for switch dispatch.
@@ -671,13 +758,16 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
671
758
  }
672
759
  }
673
760
  });
674
- // B-19 (v6.18.7): restore the persisted last_active_site_id if present
675
- // and the site is still known + allowed. Falls back silently to the
676
- // default site picked above when the persisted id is stale (the
677
- // customer renamed sites between client versions, hit by A.D.).
678
- const persisted = loadRespiraMcpState();
679
- if (persisted.last_active_site_id) {
680
- const restored = this.sites.get(persisted.last_active_site_id);
761
+ // B-19 (v6.18.7): restore the persisted active site if present and the
762
+ // site is still known + allowed. Falls back silently to the default site
763
+ // picked above when the persisted id is stale (the customer renamed sites
764
+ // between client versions, hit by A.D.).
765
+ //
766
+ // 5004a473: the lookup is now scoped to THIS connection, so another
767
+ // connection's switch_site on the same machine cannot re-point this one.
768
+ const persistedSiteId = pickActiveSiteIdForConfig(loadRespiraMcpState(), this.stateNamespace);
769
+ if (persistedSiteId) {
770
+ const restored = this.sites.get(persistedSiteId);
681
771
  if (restored && this.isSiteAllowed(restored)) {
682
772
  this.currentSite = restored;
683
773
  }
@@ -1434,8 +1524,11 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
1434
1524
  * after the user notices the wrong page changed. C.J. 2026-05-29 reported
1435
1525
  * exactly this ("the token for the new site is resolving to the first one").
1436
1526
  *
1437
- * Read tools and explicit-site_id calls get no notice only the silent
1438
- * default-routing case on a multi-site account is worth flagging.
1527
+ * Explicit-site_id calls get no notice. Writes always get one. Reads get one
1528
+ * only for the small DEFAULT_SITE_NOTICE_READ_TOOLS allowlist the calls that
1529
+ * report site identity or list a site's content, where answering from the
1530
+ * wrong site is invisible (ticket 5004a473). Every other read stays silent so
1531
+ * the notice keeps its signal.
1439
1532
  */
1440
1533
  buildDefaultSiteRoutingNotice(name, args) {
1441
1534
  if (this.sites.size <= 1 || !this.currentSite) {
@@ -1445,7 +1538,9 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
1445
1538
  if (hasExplicitSiteId) {
1446
1539
  return null;
1447
1540
  }
1448
- if (deriveToolKind(this.normalizeToolName(name).canonical) !== 'write') {
1541
+ const canonical = this.normalizeToolName(name).canonical;
1542
+ const isWrite = deriveToolKind(canonical) === 'write';
1543
+ if (!isWrite && !DEFAULT_SITE_NOTICE_READ_TOOLS.has(canonical)) {
1449
1544
  return null;
1450
1545
  }
1451
1546
  const site = this.currentSite;
@@ -1456,9 +1551,24 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
1456
1551
  catch {
1457
1552
  // fall back to the site id
1458
1553
  }
1459
- return (`Wrote to ${site.getSiteName()} (${host}) — your default site, because no site_id was given. ` +
1460
- `${this.sites.size} sites are connected. To target a different site, pass site_id on the tool call ` +
1461
- `or call respira_switch_site first.`);
1554
+ if (isWrite) {
1555
+ return (`Wrote to ${site.getSiteName()} (${host}) your default site, because no site_id was given. ` +
1556
+ `${this.sites.size} sites are connected. To target a different site, pass site_id on the tool call ` +
1557
+ `or call respira_switch_site first.`);
1558
+ }
1559
+ // Read wording is deliberately different: nothing was changed, but what you
1560
+ // are reading may not be the site you think you asked about. Says the site
1561
+ // that actually answered, and why it was picked.
1562
+ //
1563
+ // get_active_site is site-agnostic and has no site_id parameter, so don't
1564
+ // send an agent off to retry it with an argument the tool doesn't take.
1565
+ const howToTarget = SITE_AGNOSTIC_TOOLS.has(canonical)
1566
+ ? `If you meant a different site, call respira_switch_site first.`
1567
+ : `If you meant a different site, pass site_id on the tool call or call respira_switch_site first.`;
1568
+ return (`Answered from ${site.getSiteName()} (${host}), the active site for this connection, ` +
1569
+ `because this call passed no site_id. ${this.sites.size} sites are connected here, and the name ` +
1570
+ `of your MCP connection does not select one of them. ${howToTarget} ` +
1571
+ `respira_list_sites shows every site_id.`);
1462
1572
  }
1463
1573
  /**
1464
1574
  * Opt-in strict scoping for write tools. When RESPIRA_REQUIRE_SITE_ID is
@@ -3205,6 +3315,27 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
3205
3315
  },
3206
3316
  idempotentHint: true,
3207
3317
  },
3318
+ {
3319
+ name: 'wordpress_deactivate_design_direction',
3320
+ description: 'Stop resolving builds against the ACTIVE design direction. Clears the site pointer and nothing else: the document keeps every token, its guidance and its whole history, so reactivating later is a single call with nothing to restore. Until this existed the only ways out of active were activating a different direction or trashing this one, so the only offered path to "stop using this" was destructive. Returns 409 respira_no_active_direction when nothing is active. Pass `id` to assert WHICH direction you meant: it must be the active one, so a stale view cannot clear a pointer that has since moved.\n\nApproval flow: the first call may return `code: respira_approval_required` with `data.approval_request.approval_token`. Pass that token back via the `approval_token` param on the next call to confirm. The pointer is snapshotted first, so the flip is one wordpress_restore_snapshot away.',
3321
+ inputSchema: {
3322
+ type: 'object',
3323
+ properties: {
3324
+ id: {
3325
+ type: 'number',
3326
+ description: 'Optional. When given it must be the currently active direction; mismatch returns 409 respira_direction_not_active.',
3327
+ },
3328
+ approval_token: {
3329
+ type: 'string',
3330
+ description: 'One-time token from a prior respira_approval_required response. Omit on the first call.',
3331
+ },
3332
+ dry_run: { type: 'boolean' },
3333
+ edit_target: { type: 'string', enum: ['approval', 'live'] },
3334
+ },
3335
+ required: [],
3336
+ },
3337
+ idempotentHint: false,
3338
+ },
3208
3339
  {
3209
3340
  name: 'wordpress_delete_design_direction',
3210
3341
  description: 'Trash a saved design direction through approval. The document stays recoverable in the WordPress trash; deleting the ACTIVE direction also clears the active pointer (snapshotted first).\n\nApproval flow: destructive — the first call may return `code: respira_approval_required` with `data.approval_request.approval_token`. Pass that token back via the `approval_token` param on the next call to complete the delete.',
@@ -7539,7 +7670,9 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
7539
7670
  this.cachedFilterContext = null; // Invalidate tool filter cache on site switch.
7540
7671
  // B-19 (v6.18.7): persist so the next process restart restores
7541
7672
  // this site instead of falling back to the configured default.
7542
- saveRespiraMcpState({ last_active_site_id: String(args.site_id) });
7673
+ // 5004a473: scoped to this connection, so the choice does not leak
7674
+ // into every other Respira connection on the machine.
7675
+ saveRespiraMcpState(applyActiveSiteIdForConfig(loadRespiraMcpState(), this.stateNamespace, String(args.site_id)));
7543
7676
  return {
7544
7677
  success: true,
7545
7678
  message: `Switched to site: ${newSite.getSiteName()}`,
@@ -7921,6 +8054,8 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
7921
8054
  return await client.callRestV2('POST', '/design-direction', args);
7922
8055
  case 'wordpress_activate_design_direction':
7923
8056
  return await client.callRestV2('POST', '/design-direction/activate', args);
8057
+ case 'wordpress_deactivate_design_direction':
8058
+ return await client.callRestV2('POST', '/design-direction/deactivate', args);
7924
8059
  case 'wordpress_delete_design_direction': {
7925
8060
  const { id, ...rest } = args;
7926
8061
  return await client.callRestV2('DELETE', `/design-direction/${encodeURIComponent(id)}`, rest);
@@ -8457,6 +8592,11 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
8457
8592
  type: 'boolean',
8458
8593
  description: 'Required when responding to a `confirmation_required` reply on the live path. Pass `true` alongside `edit_target: "live"` to acknowledge the published-original write. Has no effect when `edit_target` is `duplicate` or omitted.',
8459
8594
  },
8595
+ on_ambiguous_match: {
8596
+ type: 'string',
8597
+ enum: ['reject', 'first'],
8598
+ description: 'What to do when identifier_type/identifier_value match more than one element and match_content does not narrow it to exactly one. Default "reject" refuses the write with a 422 respira_ambiguous_target error and a candidate list, because guessing has silently edited the wrong element before. Pass "first" only when that is genuinely what you want: it means accepting whichever matching element comes first in document order, with no further confirmation.',
8599
+ },
8460
8600
  },
8461
8601
  required: ['post_id', 'identifier_type', 'identifier_value', 'updates'],
8462
8602
  },
@@ -8571,6 +8711,11 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
8571
8711
  type: 'boolean',
8572
8712
  description: 'Pass `true` alongside `edit_target: "live"` to acknowledge a published-original write when the first call returned `confirmation_required`.',
8573
8713
  },
8714
+ on_ambiguous_match: {
8715
+ type: 'string',
8716
+ enum: ['reject', 'first'],
8717
+ description: 'What to do when identifier_type/identifier_value match more than one element and match_content does not narrow it to exactly one. Default "reject" refuses the removal with a 422 respira_ambiguous_target error and a candidate list, because guessing has silently deleted the wrong element before. Pass "first" only when that is genuinely what you want: it means removing whichever matching element comes first in document order, with no further confirmation.',
8718
+ },
8574
8719
  },
8575
8720
  required: ['post_id', 'identifier_type', 'identifier_value'],
8576
8721
  },
@@ -8823,7 +8968,8 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
8823
8968
  widget: 'image',
8824
8969
  description: 'Add an image widget to a page.',
8825
8970
  properties: {
8826
- src: { type: 'string', description: 'Image URL or media library attachment URL' },
8971
+ src: { type: 'string', description: 'Image URL (remote or local). Either src or image_id is required.' },
8972
+ image_id: { type: 'integer', description: 'WordPress attachment ID. Resolves to image URL if src is not provided.' },
8827
8973
  alt: { type: 'string', description: 'Alt text' },
8828
8974
  width: { type: 'string', description: 'Image width' },
8829
8975
  height: { type: 'string', description: 'Image height' },
@@ -8961,7 +9107,8 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
8961
9107
  content: { type: 'string', description: 'Testimonial text' },
8962
9108
  name: { type: 'string', description: 'Author name' },
8963
9109
  title: { type: 'string', description: 'Author title/role' },
8964
- image: { type: 'string', description: 'Author photo URL' },
9110
+ image: { type: 'string', description: 'Author photo URL. Either image or image_id can be provided.' },
9111
+ image_id: { type: 'integer', description: 'WordPress attachment ID for author photo. Resolves to image URL if image is not provided.' },
8965
9112
  },
8966
9113
  required: ['content', 'name'],
8967
9114
  },