@ateam-ai/mcp 0.3.31 → 0.3.33
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/package.json +1 -1
- package/src/http.js +16 -1
- package/src/tools.js +24 -5
package/package.json
CHANGED
package/src/http.js
CHANGED
|
@@ -182,9 +182,24 @@ export function startHttpServer(port = 3100) {
|
|
|
182
182
|
const mcpAuthOptional = [autoInjectToken, optionalBearerAuth];
|
|
183
183
|
|
|
184
184
|
// ─── CORS — required for browser-based MCP clients ──────────────
|
|
185
|
+
// Origin allowlist (round 014 security hardening).
|
|
186
|
+
// ATEAM_CORS_ALLOWED_ORIGINS env = comma-separated list, or "*" / unset for
|
|
187
|
+
// wildcard (default — preserves compat with third-party MCP clients).
|
|
188
|
+
// When set, Origin must match exactly; otherwise no ACAO header is sent.
|
|
189
|
+
const CORS_ALLOWED_LIST = String(process.env.ATEAM_CORS_ALLOWED_ORIGINS || "*")
|
|
190
|
+
.split(",").map((s) => s.trim()).filter(Boolean);
|
|
191
|
+
const CORS_ALLOW_ANY = CORS_ALLOWED_LIST.includes("*");
|
|
192
|
+
function resolveOrigin(req) {
|
|
193
|
+
const o = req.headers?.origin;
|
|
194
|
+
if (CORS_ALLOW_ANY) return o || "*";
|
|
195
|
+
if (o && CORS_ALLOWED_LIST.includes(o)) return o;
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
185
198
|
for (const path of MCP_PATHS) {
|
|
186
199
|
app.use(path, (req, res, next) => {
|
|
187
|
-
|
|
200
|
+
const origin = resolveOrigin(req);
|
|
201
|
+
if (origin) res.setHeader("Access-Control-Allow-Origin", origin);
|
|
202
|
+
if (!CORS_ALLOW_ANY) res.setHeader("Vary", "Origin");
|
|
188
203
|
res.setHeader("Access-Control-Allow-Methods", "POST, GET, DELETE, OPTIONS");
|
|
189
204
|
res.setHeader("Access-Control-Allow-Headers", "content-type, mcp-session-id, authorization");
|
|
190
205
|
res.setHeader("Access-Control-Expose-Headers", "Mcp-Session-Id");
|
package/src/tools.js
CHANGED
|
@@ -2288,19 +2288,38 @@ const handlers = {
|
|
|
2288
2288
|
}),
|
|
2289
2289
|
};
|
|
2290
2290
|
}
|
|
2291
|
+
// Pull through the underlying error/message instead of fabricating "0/0/0
|
|
2292
|
+
// success-shaped" output. Old wrapper hid backend errors (e.g. validator
|
|
2293
|
+
// failures from sentinel files in user repos) and reported `total: 0` with
|
|
2294
|
+
// no clue why — the agent was left thinking redeploy was a no-op when in
|
|
2295
|
+
// fact it was a hard failure.
|
|
2296
|
+
const failedCount = !result.ok
|
|
2297
|
+
? (result.failed ?? (result.skills?.length ? result.skills.filter(s => s.ok === false).length : 1))
|
|
2298
|
+
: (result.failed || 0);
|
|
2299
|
+
const deployedCount = result.deployed ?? (result.ok ? (skill_id ? 1 : (result.skills?.filter(s => s.ok !== false).length || 0)) : 0);
|
|
2300
|
+
const totalCount = result.total ?? (deployedCount + failedCount);
|
|
2301
|
+
|
|
2291
2302
|
return {
|
|
2292
2303
|
ok: result.ok,
|
|
2293
2304
|
solution_id,
|
|
2294
2305
|
...(skill_id && { skill_id }),
|
|
2295
|
-
deployed:
|
|
2296
|
-
failed:
|
|
2297
|
-
total:
|
|
2306
|
+
deployed: deployedCount,
|
|
2307
|
+
failed: failedCount,
|
|
2308
|
+
total: totalCount,
|
|
2298
2309
|
skills: result.skills || [],
|
|
2310
|
+
// Surface the underlying error when the request failed — the most
|
|
2311
|
+
// common cause is a validator failure (e.g. broken connector source
|
|
2312
|
+
// in the GitHub repo), and hiding it makes diagnosis impossible.
|
|
2313
|
+
...(!result.ok && result.error && { error: result.error }),
|
|
2314
|
+
...(!result.ok && result.details && { details: result.details }),
|
|
2315
|
+
...(!result.ok && result.hint && { hint: result.hint }),
|
|
2299
2316
|
message: result.ok
|
|
2300
2317
|
? skill_id
|
|
2301
2318
|
? `Re-deployed skill "${skill_id}" successfully.`
|
|
2302
|
-
: `Re-deployed ${
|
|
2303
|
-
:
|
|
2319
|
+
: `Re-deployed ${deployedCount} skill(s) successfully.`
|
|
2320
|
+
: (result.error
|
|
2321
|
+
? `Re-deploy failed: ${result.error}${result.hint ? ` — ${result.hint}` : ''}`
|
|
2322
|
+
: `Re-deploy had ${failedCount} failure(s). Check skills array or call the underlying endpoint with verbose:true.`),
|
|
2304
2323
|
};
|
|
2305
2324
|
},
|
|
2306
2325
|
|