@ateam-ai/mcp 0.3.37 → 0.3.39

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 +1 -1
  2. package/src/tools.js +33 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ateam-ai/mcp",
3
- "version": "0.3.37",
3
+ "version": "0.3.39",
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",
package/src/tools.js CHANGED
@@ -32,10 +32,17 @@ import { renderAgentDocHeader, mergeAgentDoc, AGENT_DOC_SENTINEL } from "./agent
32
32
  async function pollDeployJob(jobId, sid, { label = 'deploy', maxMs = 15 * 60_000, intervalMs = 2000 } = {}) {
33
33
  const start = Date.now();
34
34
  let lastStatus = null;
35
+ // URL-encode jobId — older skill-validators returned composite job IDs
36
+ // with literal `/` (e.g. `redeploy-skill-personal-adas/pa-orchestrator-...`)
37
+ // which broke the Express route /deploy/jobs/:jobId. Polling silently
38
+ // 404'd every iteration until the MCP host's stdio idle timeout fired
39
+ // (~30s) and dropped the connection. Encoding here is defense-in-depth
40
+ // even after the server-side fix that replaced `/` with `--`.
41
+ const encodedJobId = encodeURIComponent(jobId);
35
42
  while (Date.now() - start < maxMs) {
36
43
  await new Promise(r => setTimeout(r, intervalMs));
37
44
  try {
38
- const job = await get(`/deploy/jobs/${jobId}`, sid);
45
+ const job = await get(`/deploy/jobs/${encodedJobId}`, sid);
39
46
  lastStatus = job?.status;
40
47
  if (job?.status === 'done' || job?.status === 'failed') {
41
48
  return job; // job entry has the full result merged in
@@ -1939,7 +1946,25 @@ const handlers = {
1939
1946
  }
1940
1947
  const field = key.replace(/_delete$/, "");
1941
1948
  const { parent, leaf } = _resolveDottedField(patched, field);
1942
- parent[leaf] = (Array.isArray(parent[leaf]) ? parent[leaf] : []).filter(item => !value.includes(item?.name || item?.id || item));
1949
+ const arr = Array.isArray(parent[leaf]) ? parent[leaf] : [];
1950
+ // Match by EITHER id OR name OR primitive value. Old logic short-
1951
+ // circuited on item.name first ("name || id || self"), which silently
1952
+ // failed when an item had both name and id and the caller passed the
1953
+ // id. Now we check both keys + the primitive case.
1954
+ const matchValues = new Set(value.map(v => (v && typeof v === 'object') ? (v.id ?? v.name) : v));
1955
+ const before = arr.length;
1956
+ parent[leaf] = arr.filter(item => {
1957
+ if (item == null) return true;
1958
+ if (typeof item !== 'object') return !matchValues.has(item);
1959
+ if (item.id !== undefined && matchValues.has(item.id)) return false;
1960
+ if (item.name !== undefined && matchValues.has(item.name)) return false;
1961
+ return true;
1962
+ });
1963
+ if (parent[leaf].length === before && value.length > 0) {
1964
+ // Surface a "not found" hint instead of silent ok:true. Helps
1965
+ // agents catch typos and the "wrong key" class of bugs.
1966
+ phases.push({ phase: 'patch', warning: `${key}: nothing matched [${value.join(', ')}] — array unchanged` });
1967
+ }
1943
1968
  } else if (key.endsWith("_update")) {
1944
1969
  if (!Array.isArray(value)) {
1945
1970
  return { ok: false, phase: "patch", error: `${key} requires an array of update objects (got ${typeof value}). Pass {"${key}": [{name: "x", description: "..."}]}.` };
@@ -1947,8 +1972,13 @@ const handlers = {
1947
1972
  const field = key.replace(/_update$/, "");
1948
1973
  const { parent, leaf } = _resolveDottedField(patched, field);
1949
1974
  const arr = Array.isArray(parent[leaf]) ? parent[leaf] : [];
1975
+ // Same fix as _delete — match upd → existing by EITHER id OR name.
1950
1976
  for (const upd of value) {
1951
- const idx = arr.findIndex(item => (item.name || item.id) === (upd.name || upd.id));
1977
+ const updKey = (upd && typeof upd === 'object') ? (upd.id ?? upd.name) : upd;
1978
+ const idx = arr.findIndex(item => {
1979
+ if (!item || typeof item !== 'object') return item === updKey;
1980
+ return item.id === updKey || item.name === updKey;
1981
+ });
1952
1982
  if (idx >= 0) arr[idx] = { ...arr[idx], ...upd };
1953
1983
  else arr.push(upd);
1954
1984
  }