@ateam-ai/mcp 0.4.73 → 0.4.74

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/tools.js +39 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ateam-ai/mcp",
3
- "version": "0.4.73",
3
+ "version": "0.4.74",
4
4
  "mcpName": "io.github.ariekogan/ateam-mcp",
5
5
  "description": "A-Team MCP Server — build, validate, and deploy multi-agent solutions from any AI environment",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "start:http": "node src/index.js --http",
14
14
  "dev": "node --watch src/index.js",
15
15
  "dev:http": "node --watch src/index.js --http",
16
- "test": "node test/session-isolation.test.mjs"
16
+ "test": "node test/session-isolation.test.mjs && node test/widget-protocol.test.mjs"
17
17
  },
18
18
  "keywords": [
19
19
  "mcp",
package/src/tools.js CHANGED
@@ -239,21 +239,53 @@ function _widgetHasRender(r) {
239
239
  //
240
240
  // Detected here rather than left to a person noticing an empty panel, and
241
241
  // reported with the repair attached — a signal the reasoning engine can act on.
242
- function _widgetProtocolProblems(html) {
242
+ export function _widgetProtocolProblems(html) {
243
243
  if (typeof html !== "string" || !html.includes("postMessage")) return [];
244
+
245
+ // STRUCTURE, NOT TOKENS. The first version matched /correlationId/ anywhere in
246
+ // the file, so a correct widget with an unrelated local named correlationId was
247
+ // reported broken — and `fix_with` would then steer an agent into editing
248
+ // working code. Reviewer was right to reject it. Each check below anchors to
249
+ // the actual send or receive shape.
244
250
  const problems = [];
245
- if (/["']tool\.call["']/.test(html)) {
246
- problems.push('sends type:"tool.call" the host has NEVER accepted it (silent 15s timeout, no error). Send message:{action:"mcp-call",payload:{requestId,connectorId,tool,args}}.');
251
+
252
+ // Only look at what is POSTED to the host: postMessage(...) argument objects.
253
+ const sends = [...html.matchAll(/postMessage\s*\(\s*\{[\s\S]{0,400}/g)].map((m) => m[0]);
254
+ const sendBlob = sends.join("\n");
255
+ const isPluginSend = /source\s*:\s*["']adas-plugin["']/.test(sendBlob);
256
+
257
+ if (isPluginSend) {
258
+ if (/type\s*:\s*["']tool\.call["']/.test(sendBlob)) {
259
+ problems.push('sends message.type:"tool.call" — the host has NEVER accepted it, at any version (silent timeout, no error). Send message:{action:"mcp-call",payload:{requestId,connectorId,tool,args}}.');
260
+ } else if (!/action\s*:\s*["']mcp-call["']/.test(sendBlob)) {
261
+ // type:"mcp-call" is the near-miss worth naming separately: right name,
262
+ // wrong key. The host matches on message.action and ignores message.type.
263
+ if (/type\s*:\s*["']mcp-call["']/.test(sendBlob)) {
264
+ problems.push('sends message.TYPE:"mcp-call" — the host matches on message.ACTION for sends, so this is ignored. Use message:{action:"mcp-call",payload:{...}}.');
265
+ } else {
266
+ problems.push('never sends action:"mcp-call" — the host ignores the message entirely.');
267
+ }
268
+ }
269
+ // correlationId only counts as a defect where it carries the request id.
270
+ if (/payload\s*:\s*\{[^}]*correlationId/.test(sendBlob) || /correlationId\s*:\s*correlationId/.test(sendBlob)) {
271
+ problems.push('sends the request id as correlationId — the host echoes payload.requestId, so responses never match the pending request and every call times out even when the host answered.');
272
+ }
247
273
  }
248
- if (/correlationId/.test(html)) {
249
- problems.push('keys responses on correlationId the host echoes payload.requestId, so the pending request is never matched and every call times out even when the host answered.');
274
+
275
+ // RECEIVE side: only flag reading correlationId OFF THE HOST PAYLOAD.
276
+ if (/payload\s*(\?\.|\.)\s*correlationId/.test(html) ||
277
+ /payload\s*&&\s*[\w$.]*payload\.correlationId/.test(html) ||
278
+ /\{\s*correlationId[^}]*\}\s*=\s*[\w$.]*payload/.test(html)) {
279
+ problems.push('reads payload.correlationId from the host response — the host sends payload.requestId, so the pending request is never matched.');
250
280
  }
251
- if (/postMessage/.test(html) && !/["']mcp-call["']/.test(html)) {
252
- problems.push('never sends action:"mcp-call" — the host ignores the message entirely.');
281
+ if (/type\s*===?\s*["']tool\.response["']/.test(html)) {
282
+ problems.push('listens for message.type:"tool.response" — the host replies with "mcp-result".');
253
283
  }
284
+
254
285
  return problems;
255
286
  }
256
287
 
288
+
257
289
  async function verifyWidgetHealth(solution_id, sid) {
258
290
  // 1. Declared plugins — solution.ui_plugins[]
259
291
  let declared = [];