@respira/wordpress-mcp-server 6.18.1 → 6.18.3
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.
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +81 -5
- package/dist/server.js.map +1 -1
- package/dist/wordpress-client.d.ts +1 -1
- package/dist/wordpress-client.d.ts.map +1 -1
- package/dist/wordpress-client.js +16 -1
- package/dist/wordpress-client.js.map +1 -1
- package/package.json +1 -1
package/dist/server.d.ts
CHANGED
|
@@ -129,6 +129,27 @@ export declare class RespiraWordPressServer {
|
|
|
129
129
|
*/
|
|
130
130
|
private normalizeArgsForBackCompat;
|
|
131
131
|
private handleToolCall;
|
|
132
|
+
/**
|
|
133
|
+
* v6.18.2: enforce a response-size cap on tool results.
|
|
134
|
+
*
|
|
135
|
+
* Customers were hitting silent session deaths after 3-4 tool calls in a
|
|
136
|
+
* row (telemetry confirmed across multiple users on 2026-05-21). Root cause
|
|
137
|
+
* is most likely the Claude Desktop / Cursor MCP supervisor reaping the
|
|
138
|
+
* subprocess when a STDIO write stalls. macOS pipe buffer is 64 KB; a
|
|
139
|
+
* single 600+ KB tool result (e.g. list_options dumping every wp_options
|
|
140
|
+
* row) fragments across many pipe writes and can starve the host's drain
|
|
141
|
+
* loop. Even at the SDK layer some MCP hosts apply a hard per-result cap.
|
|
142
|
+
*
|
|
143
|
+
* Strategy: serialize the result, measure the JSON byte length, and if it
|
|
144
|
+
* exceeds RESPIRA_MAX_TOOL_RESULT_BYTES (default 100 KiB), return a
|
|
145
|
+
* structured truncation envelope instead. Includes the original size,
|
|
146
|
+
* a per-tool pagination hint, and a small preview so the agent can
|
|
147
|
+
* recover without guessing.
|
|
148
|
+
*
|
|
149
|
+
* Opt-out: set RESPIRA_MAX_TOOL_RESULT_BYTES=0 to disable. Set to a
|
|
150
|
+
* larger value for hosts known to tolerate big payloads.
|
|
151
|
+
*/
|
|
152
|
+
private capResponseSize;
|
|
132
153
|
private dispatchToolCall;
|
|
133
154
|
/**
|
|
134
155
|
* v5.2.0 Elemental tool definitions.
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,OAAO,KAAK,EAAE,mBAAmB,EAAe,MAAM,kBAAkB,CAAC;AAgIzE,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;IAEpC,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;IAuTvE,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,aAAa;IAmBrB,gEAAgE;IAChE,OAAO,CAAC,aAAa;IAUrB;;;;;;OAMG;YACW,UAAU;IA2CxB;;;;;;;;;;;;;;OAcG;YACW,WAAW;IAyIzB;;;;;;;;;OASG;YACW,kBAAkB;IA6FhC,OAAO,CAAC,eAAe;IAmBvB,OAAO,CAAC,aAAa;YA4MP,kBAAkB;YA6BlB,yBAAyB;IASvC;;;OAGG;IACH,OAAO,CAAC,oBAAoB;YAyBd,QAAQ;IAoxEtB;;;;;;OAMG;IACH,yEAAyE;IACzE,OAAO,CAAC,mBAAmB,CAAoD;IAC/E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAU;YAEpC,oBAAoB;YAqDpB,2BAA2B;IAazC;;;;OAIG;YACW,cAAc;IAY5B,OAAO,CAAC,mBAAmB;IAwT3B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAe3C;IAEF;;;;OAIG;IACH,OAAO,CAAC,0BAA0B;YAmCpB,cAAc;IA+D5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CAAC,eAAe;YAuCT,gBAAgB;IAqpB9B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoRzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA6UxB,GAAG;CAyCV"}
|
package/dist/server.js
CHANGED
|
@@ -116,6 +116,23 @@ const SITE_ID_PROPERTY = {
|
|
|
116
116
|
type: 'string',
|
|
117
117
|
description: 'Optional. Override the active site for this single call without changing the global current site. Use this when running multiple Cowork chats against different WordPress sites in parallel so each chat can pin its own target site per tool call.',
|
|
118
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* v6.18.2: per-tool pagination hint, surfaced inside the truncation envelope
|
|
121
|
+
* when a tool result exceeds the response-size cap. Tells the agent the
|
|
122
|
+
* specific argument shape to retry with so it can recover without guessing.
|
|
123
|
+
*/
|
|
124
|
+
const TOOLS_WITH_PAGINATION_HINT = {
|
|
125
|
+
respira_list_options: 'Pass per_page (default unlimited, recommend 25) and page args. Or use respira_get_option with a single option_name when you already know which key you need.',
|
|
126
|
+
wordpress_list_options: 'Pass per_page (default unlimited, recommend 25) and page args. Or use wordpress_get_option with a single option_name when you already know which key you need.',
|
|
127
|
+
respira_get_builder_info: 'Filter to one builder at a time via builder_name arg if available, or call respira_get_active_site first and only ask for the active builder.',
|
|
128
|
+
wordpress_get_builder_info: 'Filter to one builder at a time via builder_name arg if available, or call wordpress_get_active_site first and only ask for the active builder.',
|
|
129
|
+
respira_list_pages: 'Pass per_page (default 100, recommend 25) and page args plus a search filter to narrow results.',
|
|
130
|
+
respira_list_posts: 'Pass per_page (default 100, recommend 25) and page args plus a search filter to narrow results.',
|
|
131
|
+
respira_list_users: 'Pass per_page (default 100, recommend 25) and page args plus a search filter to narrow results.',
|
|
132
|
+
respira_list_media: 'Pass per_page (default 100, recommend 25) and page args plus a mime_type filter to narrow results.',
|
|
133
|
+
respira_extract_builder_content: 'Use respira_get_page_outline first for a row-level summary, or pass node_id to extract just the subtree you care about.',
|
|
134
|
+
respira_list_plugins: 'No pagination arg today. The full plugin list is usually small; consider filing a feature request if your site hits the cap here.',
|
|
135
|
+
};
|
|
119
136
|
export class RespiraWordPressServer {
|
|
120
137
|
server;
|
|
121
138
|
currentSite = null;
|
|
@@ -2177,12 +2194,13 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
|
|
|
2177
2194
|
},
|
|
2178
2195
|
{
|
|
2179
2196
|
name: 'wordpress_scan_page_accessibility',
|
|
2180
|
-
description: 'Run a WCAG accessibility scan on a page. Returns violations grouped by severity (critical, serious, moderate, minor) with auto-fix suggestions. Supports standards: wcag2a, wcag2aa, wcag21a, wcag21aa, wcag22aa, section508.',
|
|
2197
|
+
description: 'Run a WCAG accessibility scan on a page. The scanner runs an axe sweep against the page\'s public URL — `page_id` is resolved to the permalink server-side before the scan. Returns violations grouped by severity (critical, serious, moderate, minor) with auto-fix suggestions. Supports standards: wcag2a, wcag2aa, wcag21a, wcag21aa, wcag22aa, section508.',
|
|
2181
2198
|
inputSchema: {
|
|
2182
2199
|
type: 'object',
|
|
2183
2200
|
properties: {
|
|
2184
|
-
page_id: { type: 'number', description: 'Page ID to scan' },
|
|
2201
|
+
page_id: { type: 'number', description: 'Page ID to scan. Resolved to the page\'s public permalink before calling the scanner.' },
|
|
2185
2202
|
standard: { type: 'string', description: 'WCAG standard to test against (default: wcag2aa)' },
|
|
2203
|
+
url: { type: 'string', description: 'Optional explicit URL override. When provided, skips the page_id → permalink resolution. Use for previewing or staging URLs that don\'t map to a Respira page_id.' },
|
|
2186
2204
|
},
|
|
2187
2205
|
required: ['page_id'],
|
|
2188
2206
|
},
|
|
@@ -3908,13 +3926,71 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
|
|
|
3908
3926
|
}
|
|
3909
3927
|
}
|
|
3910
3928
|
if (deprecated && result && typeof result === 'object' && !Array.isArray(result)) {
|
|
3911
|
-
|
|
3929
|
+
result = {
|
|
3912
3930
|
...result,
|
|
3913
3931
|
_deprecation_notice: `Tool name "${name}" is deprecated. Use "respira_${name.slice('wordpress_'.length)}" instead. ` +
|
|
3914
3932
|
'wordpress_* names will be removed in v6.0.',
|
|
3915
3933
|
};
|
|
3916
3934
|
}
|
|
3917
|
-
return result;
|
|
3935
|
+
return this.capResponseSize(canonical, result);
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* v6.18.2: enforce a response-size cap on tool results.
|
|
3939
|
+
*
|
|
3940
|
+
* Customers were hitting silent session deaths after 3-4 tool calls in a
|
|
3941
|
+
* row (telemetry confirmed across multiple users on 2026-05-21). Root cause
|
|
3942
|
+
* is most likely the Claude Desktop / Cursor MCP supervisor reaping the
|
|
3943
|
+
* subprocess when a STDIO write stalls. macOS pipe buffer is 64 KB; a
|
|
3944
|
+
* single 600+ KB tool result (e.g. list_options dumping every wp_options
|
|
3945
|
+
* row) fragments across many pipe writes and can starve the host's drain
|
|
3946
|
+
* loop. Even at the SDK layer some MCP hosts apply a hard per-result cap.
|
|
3947
|
+
*
|
|
3948
|
+
* Strategy: serialize the result, measure the JSON byte length, and if it
|
|
3949
|
+
* exceeds RESPIRA_MAX_TOOL_RESULT_BYTES (default 100 KiB), return a
|
|
3950
|
+
* structured truncation envelope instead. Includes the original size,
|
|
3951
|
+
* a per-tool pagination hint, and a small preview so the agent can
|
|
3952
|
+
* recover without guessing.
|
|
3953
|
+
*
|
|
3954
|
+
* Opt-out: set RESPIRA_MAX_TOOL_RESULT_BYTES=0 to disable. Set to a
|
|
3955
|
+
* larger value for hosts known to tolerate big payloads.
|
|
3956
|
+
*/
|
|
3957
|
+
capResponseSize(toolName, result) {
|
|
3958
|
+
const envOverride = parseInt(process.env.RESPIRA_MAX_TOOL_RESULT_BYTES || '', 10);
|
|
3959
|
+
const cap = Number.isFinite(envOverride) && envOverride >= 0
|
|
3960
|
+
? envOverride
|
|
3961
|
+
: 100 * 1024;
|
|
3962
|
+
if (cap === 0 || result == null)
|
|
3963
|
+
return result;
|
|
3964
|
+
let serialized;
|
|
3965
|
+
try {
|
|
3966
|
+
serialized = JSON.stringify(result);
|
|
3967
|
+
}
|
|
3968
|
+
catch {
|
|
3969
|
+
return result;
|
|
3970
|
+
}
|
|
3971
|
+
if (serialized.length <= cap)
|
|
3972
|
+
return result;
|
|
3973
|
+
// Build a truncated envelope. Preserve the top-level shape best-effort
|
|
3974
|
+
// so callers reading `result.site` etc. still get something useful.
|
|
3975
|
+
const preview = serialized.slice(0, Math.min(2000, cap / 2));
|
|
3976
|
+
const paginationHint = TOOLS_WITH_PAGINATION_HINT[toolName] ||
|
|
3977
|
+
'Try re-calling this tool with pagination args (per_page, page, search filter) to limit the result size.';
|
|
3978
|
+
const envelope = {
|
|
3979
|
+
_truncated: true,
|
|
3980
|
+
_original_size_bytes: serialized.length,
|
|
3981
|
+
_cap_bytes: cap,
|
|
3982
|
+
_tool_name: toolName,
|
|
3983
|
+
_preview_json: preview,
|
|
3984
|
+
_hint: paginationHint,
|
|
3985
|
+
_why: 'Response exceeded the MCP server response-size cap. ' +
|
|
3986
|
+
'Most MCP hosts (Claude Desktop, Cursor) silently kill the subprocess ' +
|
|
3987
|
+
'when a STDIO write stalls; this cap prevents that. ' +
|
|
3988
|
+
'Set RESPIRA_MAX_TOOL_RESULT_BYTES env var to change the cap.',
|
|
3989
|
+
};
|
|
3990
|
+
if (result && typeof result === 'object' && !Array.isArray(result) && result.site) {
|
|
3991
|
+
envelope.site = result.site;
|
|
3992
|
+
}
|
|
3993
|
+
return envelope;
|
|
3918
3994
|
}
|
|
3919
3995
|
async dispatchToolCall(name, args) {
|
|
3920
3996
|
// v6.12.0: per-call site resolution. Agnostic tools work without a
|
|
@@ -4143,7 +4219,7 @@ Allowlist: css, scss, less, json. PHP / JS theme writes are intentionally out of
|
|
|
4143
4219
|
case 'wordpress_get_accessibility_scan':
|
|
4144
4220
|
return await client.getAccessibilityScan(args.scan_id);
|
|
4145
4221
|
case 'wordpress_scan_page_accessibility':
|
|
4146
|
-
return await client.scanPageAccessibility(args.page_id, args.standard);
|
|
4222
|
+
return await client.scanPageAccessibility(args.page_id, args.standard, args.url);
|
|
4147
4223
|
case 'wordpress_apply_accessibility_fixes':
|
|
4148
4224
|
return await client.applyAccessibilityFixes(args.scan_id, args.rule_ids);
|
|
4149
4225
|
// Plugin Management (EXPERIMENTAL)
|