fetchsandbox-mcp 0.4.6 → 0.4.8
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/tools/guide.d.ts +3 -0
- package/dist/tools/guide.js +35 -1
- package/dist/tools/guide.js.map +1 -1
- package/dist/tools/jobs.d.ts +13 -0
- package/dist/tools/jobs.js +16 -2
- package/dist/tools/jobs.js.map +1 -1
- package/dist/tools/pack.js +30 -0
- package/dist/tools/pack.js.map +1 -1
- package/dist/tools/verify_behavior.js +31 -2
- package/dist/tools/verify_behavior.js.map +1 -1
- package/package.json +1 -1
package/dist/tools/guide.d.ts
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
export interface GuideInput {
|
|
18
18
|
intent: string;
|
|
19
|
+
/** Repo signals. Filled in automatically from the project the MCP server is
|
|
20
|
+
* running in; a caller may override to force the disambiguation. */
|
|
21
|
+
context?: Record<string, unknown>;
|
|
19
22
|
hints?: {
|
|
20
23
|
spec?: string;
|
|
21
24
|
workflow?: string;
|
package/dist/tools/guide.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { postJson } from "../client.js";
|
|
2
|
+
import { scanRepoSignals } from "./repo_signals.js";
|
|
2
3
|
export const guideTool = {
|
|
3
4
|
name: "guide",
|
|
4
5
|
description: "ROUTE a symptom to the provider behaviour that explains it. Use this when " +
|
|
@@ -37,6 +38,39 @@ export const guideTool = {
|
|
|
37
38
|
},
|
|
38
39
|
};
|
|
39
40
|
export async function runGuide(input) {
|
|
40
|
-
|
|
41
|
+
// SEND WHAT THE REPO ACTUALLY INTEGRATES. The router has a `context` field
|
|
42
|
+
// for exactly this — "repo signals (dependencies / detected_specs / imports)
|
|
43
|
+
// so the router can disambiguate an ambiguous symptom by the provider the
|
|
44
|
+
// repo actually integrates — the funnel intersect, a fact rather than a
|
|
45
|
+
// guess" — and guide never sent it. coach did; guide, the tool an agent is
|
|
46
|
+
// told to start with, did not.
|
|
47
|
+
//
|
|
48
|
+
// Measured 2026-09-07 against a Paddle + Resend app, on a symptom naming
|
|
49
|
+
// neither provider: guide returned spec "stripe", workflow "accept_payment",
|
|
50
|
+
// confidence 0.95. A confident route to the wrong provider is worse than no
|
|
51
|
+
// route — everything downstream inherits it.
|
|
52
|
+
//
|
|
53
|
+
// The scan reads the manifest in the MCP server's own cwd, which IS the
|
|
54
|
+
// user's project. Best-effort: a repo it cannot read sends nothing and the
|
|
55
|
+
// router behaves exactly as before.
|
|
56
|
+
const body = { ...input };
|
|
57
|
+
try {
|
|
58
|
+
const sig = scanRepoSignals();
|
|
59
|
+
const ctx = {};
|
|
60
|
+
if (sig.detected_specs?.length)
|
|
61
|
+
ctx.detected_specs = sig.detected_specs;
|
|
62
|
+
// code_probe is the tie-breaker the scanner computes when several providers
|
|
63
|
+
// survive: whose handler the repo actually implements, not merely imports.
|
|
64
|
+
if (sig.code_probe)
|
|
65
|
+
ctx.code_probe = sig.code_probe;
|
|
66
|
+
if (Object.keys(ctx).length) {
|
|
67
|
+
// A caller-supplied context wins — an explicit hint is not a guess.
|
|
68
|
+
body.context = { ...ctx, ...(input.context ?? {}) };
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
/* a repo we cannot read is not an error; route without the signal */
|
|
73
|
+
}
|
|
74
|
+
return postJson("/api/mcp/route", body);
|
|
41
75
|
}
|
|
42
76
|
//# sourceMappingURL=guide.js.map
|
package/dist/tools/guide.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../src/tools/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../src/tools/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,E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;QAC9B,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM;YAAE,GAAG,CAAC,cAAc,GAAG,GAAG,CAAC,cAAc,CAAC;QACxE,4EAA4E;QAC5E,2EAA2E;QAC3E,IAAI,GAAG,CAAC,UAAU;YAAE,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;QACpD,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YAC5B,oEAAoE;YACpE,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,OAAiB,IAAI,EAAE,CAAC,EAAE,CAAC;QAChE,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,qEAAqE;IACvE,CAAC;IACD,OAAO,QAAQ,CAAgB,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/tools/jobs.d.ts
CHANGED
|
@@ -7,3 +7,16 @@ export declare function startAndPoll(startPath: string, body: unknown, opts?: {
|
|
|
7
7
|
maxMs?: number;
|
|
8
8
|
intervalMs?: number;
|
|
9
9
|
}): Promise<JobStatus>;
|
|
10
|
+
/** Poll one already-started job to completion.
|
|
11
|
+
*
|
|
12
|
+
* Split out of startAndPoll so a caller that must inspect the START response
|
|
13
|
+
* first can still share this loop. verify_behavior needs that: a backend
|
|
14
|
+
* without async support silently ignores the opt-in flag and answers the start
|
|
15
|
+
* call with the finished simulation, so the client has to look before it polls
|
|
16
|
+
* — otherwise publishing the client ahead of the deploy breaks every call.
|
|
17
|
+
*/
|
|
18
|
+
export declare function pollJob(jobId: string, opts?: {
|
|
19
|
+
maxMs?: number;
|
|
20
|
+
intervalMs?: number;
|
|
21
|
+
startPath?: string;
|
|
22
|
+
}): Promise<JobStatus>;
|
package/dist/tools/jobs.js
CHANGED
|
@@ -14,13 +14,27 @@ export async function startAndPoll(startPath, body, opts) {
|
|
|
14
14
|
if (!start.job_id) {
|
|
15
15
|
throw new ToolError(`Could not start job: ${start.error ?? "no job_id returned"}`);
|
|
16
16
|
}
|
|
17
|
+
return pollJob(start.job_id, { maxMs, intervalMs, startPath });
|
|
18
|
+
}
|
|
19
|
+
/** Poll one already-started job to completion.
|
|
20
|
+
*
|
|
21
|
+
* Split out of startAndPoll so a caller that must inspect the START response
|
|
22
|
+
* first can still share this loop. verify_behavior needs that: a backend
|
|
23
|
+
* without async support silently ignores the opt-in flag and answers the start
|
|
24
|
+
* call with the finished simulation, so the client has to look before it polls
|
|
25
|
+
* — otherwise publishing the client ahead of the deploy breaks every call.
|
|
26
|
+
*/
|
|
27
|
+
export async function pollJob(jobId, opts) {
|
|
28
|
+
const maxMs = opts?.maxMs ?? 15 * 60_000;
|
|
29
|
+
const intervalMs = opts?.intervalMs ?? 4000;
|
|
17
30
|
const deadline = Date.now() + maxMs;
|
|
18
31
|
while (Date.now() < deadline) {
|
|
19
32
|
await sleep(intervalMs);
|
|
20
|
-
const st = await getJson(`/api/mcp/jobs/${
|
|
33
|
+
const st = await getJson(`/api/mcp/jobs/${jobId}`);
|
|
21
34
|
if (st.status !== "running")
|
|
22
35
|
return st;
|
|
23
36
|
}
|
|
24
|
-
throw new ToolError(`Timed out after ${Math.round(maxMs / 60000)}min waiting on
|
|
37
|
+
throw new ToolError(`Timed out after ${Math.round(maxMs / 60000)}min waiting on ` +
|
|
38
|
+
`${opts?.startPath ?? "job " + jobId}.`);
|
|
25
39
|
}
|
|
26
40
|
//# sourceMappingURL=jobs.js.map
|
package/dist/tools/jobs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobs.js","sourceRoot":"","sources":["../../src/tools/jobs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAc5D,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,C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AC,KAAK,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,KAAa,EACb,IAAkE;IAElE,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,CAAC;IACzC,MAAM,UAAU,GAAG,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IACpC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;QAC7B,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;QACxB,MAAM,EAAE,GAAG,MAAM,OAAO,CAAY,iBAAiB,KAAK,EAAE,CAAC,CAAC;QAC9D,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;IACzC,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,mBAAmB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,iBAAiB;QAC3D,GAAG,IAAI,EAAE,SAAS,IAAI,MAAM,GAAG,KAAK,GAAG,CAC1C,CAAC;AACJ,CAAC"}
|
package/dist/tools/pack.js
CHANGED
|
@@ -25,6 +25,36 @@ const EXCLUDES = [
|
|
|
25
25
|
"build",
|
|
26
26
|
"coverage",
|
|
27
27
|
".DS_Store",
|
|
28
|
+
// AGENT INSTRUCTION FILES ARE NEVER SHIPPED.
|
|
29
|
+
//
|
|
30
|
+
// The analysis runtime runs its agent with cwd set to the unpacked
|
|
31
|
+
// workspace, and Claude Code auto-loads CLAUDE.md from cwd. Any instruction
|
|
32
|
+
// file in a repo therefore becomes instructions to an agent with a different
|
|
33
|
+
// toolset and a different job.
|
|
34
|
+
//
|
|
35
|
+
// Measured 2026-09-07: a CLAUDE.md reading "bug fixes go through
|
|
36
|
+
// FetchSandbox — guide → find_bugs → ..." made the find_bugs agent try to
|
|
37
|
+
// call tools it does not have, report them as denied, ask the USER to edit
|
|
38
|
+
// .claude/settings.local.json, and fall back to a static read; the fix_bug
|
|
39
|
+
// agent read "do not hand-write a fix" and produced no changes. Two tools
|
|
40
|
+
// down, from one file, and both looked like independent breakage.
|
|
41
|
+
//
|
|
42
|
+
// THIS LIST IS THE ONE THAT MATTERS for an agent-initiated call: the client
|
|
43
|
+
// builds the tar on the user's machine, so excluding it server-side would
|
|
44
|
+
// not have helped. A repo's instructions are not source under analysis.
|
|
45
|
+
"CLAUDE.md",
|
|
46
|
+
"CLAUDE.local.md",
|
|
47
|
+
"AGENTS.md",
|
|
48
|
+
"AGENT.md",
|
|
49
|
+
"GEMINI.md",
|
|
50
|
+
".cursorrules",
|
|
51
|
+
".windsurfrules",
|
|
52
|
+
".clinerules",
|
|
53
|
+
".aiderrules",
|
|
54
|
+
".claude",
|
|
55
|
+
".cursor",
|
|
56
|
+
".windsurf",
|
|
57
|
+
"copilot-instructions.md",
|
|
28
58
|
];
|
|
29
59
|
// nginx allows 50m on the probe endpoints; stay under with headroom.
|
|
30
60
|
const MAX_TAR_BYTES = 40 * 1024 * 1024;
|
package/dist/tools/pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.js","sourceRoot":"","sources":["../../src/tools/pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,cAA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,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IAC5D,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { postJson, ToolError } from "../client.js";
|
|
2
|
+
import { pollJob } from "./jobs.js";
|
|
2
3
|
export const verifyBehaviorTool = {
|
|
3
4
|
name: "verify_behavior",
|
|
4
5
|
description: "Prove a known fix survives a bug — the 'prove' half of reproduce→prove. " +
|
|
@@ -54,7 +55,35 @@ export async function runVerifyBehavior(input) {
|
|
|
54
55
|
// verify_behavior spawns buggy + fixed containers and fires probes at both —
|
|
55
56
|
// ~30-60s, past the default 30s HTTP timeout (tester finding: it timed out for
|
|
56
57
|
// real users). Give it a proper budget; each call is short-lived, no retry.
|
|
57
|
-
|
|
58
|
+
// JOB+POLL, like find_bugs / fix_bug / prove_fix. The work takes ~47-50s
|
|
59
|
+
// measured against a real order_fuzz pattern, and Cloudflare cuts an origin
|
|
60
|
+
// request at ~100s — a 2x margin, not 10x. When it is crossed the ORIGIN
|
|
61
|
+
// still logs 200 while the caller sees a failure it cannot attribute, which
|
|
62
|
+
// is the shape a real Cursor session reported on 2026-09-07.
|
|
63
|
+
//
|
|
64
|
+
// Every HTTP call here is short, so nothing is exposed to the edge timeout.
|
|
65
|
+
// Server-side the same flag moves the container work off the event loop,
|
|
66
|
+
// which it was blocking for the full duration of every simulation.
|
|
67
|
+
body.async_job = true;
|
|
68
|
+
//
|
|
69
|
+
// A published client must never require a deploy to have happened. A backend
|
|
70
|
+
// without async support IGNORES an unknown body field (pydantic drops extras
|
|
71
|
+
// silently — verified) and answers the START call with the finished
|
|
72
|
+
// simulation. startAndPoll would then look for a job_id, not find one, and
|
|
73
|
+
// throw "Could not start job" — so publishing this before the deploy would
|
|
74
|
+
// break every verify_behavior call in every installed IDE.
|
|
75
|
+
//
|
|
76
|
+
// So: start it by hand, and take whichever shape comes back. A job_id means
|
|
77
|
+
// the backend is new and we poll; a body that already carries the simulation
|
|
78
|
+
// means it is old and we are done.
|
|
79
|
+
const start = await postJson("/api/mcp/verify_behavior", body);
|
|
80
|
+
const raw = (start.job_id
|
|
81
|
+
? await pollJob(String(start.job_id), {
|
|
82
|
+
// Two sims (buggy + fixed) x every permutation and duplicate variant.
|
|
83
|
+
// Returns as soon as it is done; this is only the ceiling.
|
|
84
|
+
maxMs: 10 * 60_000,
|
|
85
|
+
})
|
|
86
|
+
: start);
|
|
58
87
|
const probes = (raw.probes ?? []).map((p) => {
|
|
59
88
|
const buggy_status = p.buggy_response?.status;
|
|
60
89
|
const fixed_status = p.fixed_response?.status;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify_behavior.js","sourceRoot":"","sources":["../../src/tools/verify_behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verify_behavior.js","sourceRoot":"","sources":["../../src/tools/verify_behavior.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0FpC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,0EAA0E;QAC1E,yEAAyE;QACzE,0EAA0E;QAC1E,yEAAyE;QACzE,wEAAwE;QACxE,uEAAuE;QACvE,kEAAkE;QAClE,wEAAwE;QACxE,wEAAwE;QACxE,4EAA4E;QAC5E,sEAAsE;IACxE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,cAAc,EAAE;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,iEAAiE;oBACjE,gE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3E,4EAA4E;QAC5E,yEAAyE;QACzE,2BAA2B;QAC3B,EAAE;QACF,wEAAwE;QACxE,uDAAuD;QACvD,uEAAuE;QACvE,4CAA4C;QAC5C,EAAE;QACF,2EAA2E;QAC3E,2EAA2E;QAC3E,kEAAkE;QAClE,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,SAAS;QACvC,uEAAuE;QACvE,qEAAqE;QACrE,qEAAqE;QACrE,sEAAsE;QACtE,iDAAiD;QACjD,SAAS,EAAE,GAAG,CAAC,UAAU;YACvB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,KAAK,IAAI;YACnC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;gBACjB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAmB,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACnC,mEAAmE;QACnE,0EAA0E;QAC1E,qBAAqB;QACrB,YAAY,EAAE,GAAG,CAAC,UAAU,EAAE,YAAY,IAAI,SAAS;QACvD,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,MAAM;QACN,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fetchsandbox-mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"mcpName": "io.github.fetchsandbox/mcp",
|
|
5
5
|
"description": "Turn any OpenAPI spec into a working sandbox your AI agent can use. MCP server for Claude Code, Cursor, and any other MCP-compatible LLM IDE.",
|
|
6
6
|
"license": "MIT",
|