fetchsandbox-mcp 0.4.9 → 0.4.11

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/README.md CHANGED
@@ -2,58 +2,20 @@
2
2
 
3
3
  <a href="https://www.producthunt.com/products/fetchsandbox?embed=true&utm_source=badge-featured&utm_medium=badge&utm_campaign=badge-fetchsandbox-mcp" target="_blank" rel="noopener noreferrer"><img alt="FetchSandbox MCP - The MCP that proves your AI's integration fixes work | Product Hunt" width="250" height="54" src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=1223147&theme=light"></a>
4
4
 
5
+ MCP server for [FetchSandbox](https://fetchsandbox.com).
5
6
 
6
- Turn any OpenAPI spec into a working sandbox your AI agent can use, right from your IDE.
7
+ Your agent writes an integration. This checks whether it actually works — against
8
+ a sandbox that behaves like the real provider, including the failures: retried
9
+ webhooks, declined cards, rate limits, auth errors.
7
10
 
8
- This is the Model Context Protocol (MCP) server for [FetchSandbox](https://fetchsandbox.com). It lets any MCP-compatible agent **find production bugs in your code, fix them, and prove the fix** — FetchSandbox reproduces the failure on your real code, verifies the fix flips it, and hands back a shareable receipt. It also ingests any OpenAPI spec into a stateful sandbox with realistic, schema-validated responses for every endpoint.
11
+ When it finds a bug, it can propose a fix and then prove it: the same failure is
12
+ run against your code before and after the diff. Green only if it reproduced
13
+ first and stopped after. You get a receipt URL either way.
9
14
 
10
- ## Why
15
+ ## Install
11
16
 
12
- Agents read raw OpenAPI specs and hallucinate. They guess field names, invent IDs that won't exist, and produce broken curl commands. FetchSandbox turns the spec into a stateful, AJV-validated sandbox so the agent can actually call the API and see real-shaped responses.
13
-
14
- Plug it into your IDE once, and any time you ask your agent "let me try the Stripe API" or "show me the GitHub issue lifecycle," it can do that — for real, end-to-end.
15
-
16
- ## Install — by agent
17
-
18
- The MCP runs as a stdio process spawned by your IDE. There's nothing to install globally — `npx` runs the latest published version on demand. Pick your tool below, paste the snippet, restart.
19
-
20
- ### Claude Desktop
21
-
22
- File: `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows)
23
-
24
- ```json
25
- {
26
- "mcpServers": {
27
- "fetchsandbox": {
28
- "command": "npx",
29
- "args": ["-y", "fetchsandbox-mcp@latest"]
30
- }
31
- }
32
- }
33
- ```
34
-
35
- Quit and reopen Claude Desktop (Cmd+Q, then reopen — not just close window).
36
-
37
- ### Claude Code
38
-
39
- User-level (all projects): `~/.claude/settings.json`. Or project-level: `.mcp.json` in the repo root.
40
-
41
- ```json
42
- {
43
- "mcpServers": {
44
- "fetchsandbox": {
45
- "command": "npx",
46
- "args": ["-y", "fetchsandbox-mcp@latest"]
47
- }
48
- }
49
- }
50
- ```
51
-
52
- Restart the Claude Code session.
53
-
54
- ### Cursor
55
-
56
- File: `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project)
17
+ Same stdio command everywhere. `npx` fetches the current version, so there's
18
+ nothing to install.
57
19
 
58
20
  ```json
59
21
  {
@@ -66,216 +28,83 @@ File: `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project)
66
28
  }
67
29
  ```
68
30
 
69
- Restart Cursor.
70
-
71
- ### Cline (VS Code extension)
72
-
73
- Open the Cline panel → settings cog → MCP Servers → add a new server with:
74
-
75
- - Command: `npx`
76
- - Args: `-y fetchsandbox-mcp@latest`
77
-
78
- Reload the VS Code window.
79
-
80
- ### Continue.dev
81
-
82
- File: `~/.continue/config.yaml`
83
-
84
- ```yaml
85
- mcpServers:
86
- - name: fetchsandbox
87
- command: npx
88
- args:
89
- - -y
90
- - fetchsandbox-mcp@latest
91
- ```
92
-
93
- Restart your IDE.
94
-
95
- ### Codex CLI (OpenAI)
96
-
97
- File: `~/.codex/config.toml`
98
-
99
- ```toml
100
- [mcp_servers.fetchsandbox]
101
- command = "npx"
102
- args = ["-y", "fetchsandbox-mcp@latest"]
103
- ```
104
-
105
- Restart Codex.
106
-
107
- ### Zed
108
-
109
- File: `~/.config/zed/settings.json`
110
-
111
- ```json
112
- {
113
- "context_servers": {
114
- "fetchsandbox": {
115
- "command": {
116
- "path": "npx",
117
- "args": ["-y", "fetchsandbox-mcp@latest"]
118
- }
119
- }
120
- }
121
- }
122
- ```
123
-
124
- ### GitHub Copilot
125
-
126
- GitHub Copilot doesn't currently support the Model Context Protocol. Track [github/copilot#feedback](https://github.com/orgs/community/discussions) for updates. In the meantime, run any MCP-compatible chat (Claude Code, Cursor, Cline) alongside Copilot.
127
-
128
- ### Anything else (Roo, Goose, etc.)
129
-
130
- If your agent speaks MCP, it accepts a stdio command. Use:
131
-
132
- - Command: `npx`
133
- - Args: `["-y", "fetchsandbox-mcp@latest"]`
134
-
135
- ## Try it now
136
-
137
- After restarting your agent, paste any of these prompts. Every prompt
138
- starts with the `./fetchsandbox` dispatch prefix — that's the routing
139
- signal. The brain matches your symptom to a workflow + scenario,
140
- reproduces it deterministically, and returns a public receipt URL as
141
- proof. **Variant prefixes also accepted:** `/fetchsandbox`,
142
- `@fetchsandbox`, `fs:`.
143
-
144
- ### Stripe — investigate a webhook bug
31
+ | Client | File |
32
+ |---|---|
33
+ | Claude Code | `~/.claude/settings.json`, or `.mcp.json` in the repo |
34
+ | Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` |
35
+ | Cursor | `~/.cursor/mcp.json`, or `.cursor/mcp.json` in the repo |
36
+ | Zed | `~/.config/zed/settings.json`, under `context_servers` |
37
+ | Codex | `~/.codex/config.toml`, as `[mcp_servers.fetchsandbox]` |
145
38
 
146
- > `./fetchsandbox stripe webhook bug in prod — payments getting marked paid 2-3 times. fix it with proof.`
39
+ Restart the client afterwards. Anything else that speaks MCP takes the same
40
+ command and args.
147
41
 
148
- The brain matches the `webhook_duplicate_side_effect` pattern. The
149
- agent reproduces the bug via `accept_payment` + `webhook_retries`
150
- scenario, applies the fix from the brain's `fix_pattern`, re-runs to
151
- confirm, and surfaces the brain's `check_for` items as the audit list.
152
- Receipt URL is the proof artifact.
42
+ ## Using it
153
43
 
154
- ### Stripe — silent card decline
44
+ Describe the problem the way you'd describe it to a colleague. You don't need to
45
+ name a tool.
155
46
 
156
- > `./fetchsandbox stripe checkout fails silently when cards are declined — investigate and fix.`
47
+ > Customers are reporting more seats than they bought after a Paddle payment.
48
+ > Can you find out why?
157
49
 
158
- Brain matches `card_decline_not_handled` → reproduces via
159
- `payment_declined` scenario → recommends the wrap-in-try/except fix
160
- pattern with `decline_code` surfacing.
50
+ The agent works through: route the symptom, reproduce it against the provider
51
+ sandbox, read your code, get a fix, prove the fix on your code. Each step hands
52
+ back what the next one needs.
161
53
 
162
- ### Stripe — webhook signature security
163
-
164
- > `./fetchsandbox stripe webhook security audit failed — anyone can post to the endpoint. fix it.`
165
-
166
- Brain matches `webhook_signature_unverified` → reproduces via
167
- `auth_failure` scenario → recommends the `stripe.Webhook.construct_event`
168
- fix with `STRIPE_WEBHOOK_SECRET` env sourcing.
169
-
170
- ### Build a new integration
171
-
172
- > `./fetchsandbox help me integrate resend for transactional email`
173
-
174
- Brain surfaces Resend's discovery questions (SPF/DKIM, bounce
175
- handling, etc.), routes to the right send-email workflow, and walks
176
- the implementation against a curated Resend sandbox.
177
-
178
- ### Any other API
179
-
180
- > `./fetchsandbox <your question or bug report about any API>`
181
-
182
- For Stripe, Resend, Clerk, Privy, Surge, AgentMail, Twilio, PayPal,
183
- Paddle, GitHub, OpenAI, Pinecone, Datadog, and 19 others, the brain
184
- routes via curated knowledge. For specs we don't have curated configs
185
- for, the engine auto-enumerates `create + verify` workflows for every
186
- detected resource. Honest about what it shows: UUIDs instead of
187
- vendor-style IDs, generic enum values instead of API-specific ones —
188
- but the request/response shape and template substitution between steps
189
- still work.
54
+ One thing worth knowing, because it's easy to get backwards: `prove_fix` needs
55
+ the **unfixed** tree. Run it before you write the diff to disk, or there's no
56
+ bug left to reproduce and no proof to be had.
190
57
 
191
58
  ## Tools
192
59
 
193
- ### `find_bugs`
194
-
195
- Find production bugs in **your own code**. Packages the current project (local,
196
- uncommitted, or private — no public git URL needed) and ships it to FetchSandbox,
197
- which audits it against known API-integration failure classes (auth, webhooks,
198
- payments, idempotency, data handling, validation) and returns the bugs it finds.
199
-
200
- ```
201
- path: "OPTIONAL absolute project path (defaults to cwd)"
202
- spec: "OPTIONAL integration hint, e.g. 'stripe'"
203
- ```
204
-
205
- ### `fix_bug`
60
+ Start with `guide`. It picks the right ones for what you asked.
206
61
 
207
- Get a proposed fix for a specific bug. Returns a `git diff` grounded in the
208
- known remediation for that failure class — it does **not** modify your files, so
209
- review and apply it yourself.
62
+ **Finding and fixing**
210
63
 
211
- ```
212
- bug: "the finding to fix (from find_bugs)"
213
- ```
214
-
215
- ### `prove_fix`
216
-
217
- Prove a fix on your real code — the gate. Ships the still-buggy project plus the
218
- diff; FetchSandbox runs its failure scenario against the buggy **and** fixed code
219
- in a sandbox and returns green **only** on a measured buggy→fixed flip (never a
220
- self-report), with a shareable receipt URL.
221
-
222
- ```
223
- diff: "the diff from fix_bug"
224
- bug: "the finding being fixed"
225
- ```
226
-
227
- ### `import_spec`
228
-
229
- Ingest an OpenAPI 3.x spec and get a sandbox you can call. Pass either a public URL or pasted content.
230
-
231
- ```
232
- url: "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json"
233
- content: "<paste OpenAPI JSON or YAML here>"
234
- name: "Optional friendly name"
235
- ```
236
-
237
- Returns `spec_id`, `sandbox_id`, `base_url` (proxy that serves real-shaped responses), `workflows_preview` (first 10), `matched_bundled` (true if we matched a curated config), and a `dashboard_url` to view everything in the browser.
64
+ | Tool | What it does | Arguments |
65
+ |---|---|---|
66
+ | `guide` | Routes a symptom to a spec, workflow and known failure class | `intent*`, `hints` |
67
+ | `find_bugs` | Audits your project against known integration failure classes. Local and private code is fine — nothing needs to be pushed | `path`, `spec`, `timeout_s` |
68
+ | `fix_bug` | Returns a `git diff` for one finding. Doesn't touch your files | `bug*`, `fix_pattern`, `path`, `spec`, `timeout_s` |
69
+ | `prove_fix` | Runs the failure against your code before and after the diff. Green only on a measured flip | `diff*`, `bug`, `scenario`, `sandbox_id`, `path`, `timeout_s` |
238
70
 
239
- ### `list_workflows`
71
+ **Running the sandbox**
240
72
 
241
- List the named, runnable workflows the engine inferred or curated for an imported spec.
73
+ | Tool | What it does | Arguments |
74
+ |---|---|---|
75
+ | `quickrun` | Runs a workflow against a bundled spec in one call. Returns `sandbox_id` and `flow_run_id` | `spec_slug*`, `workflow_name*`, `scenario` |
76
+ | `verify_behavior` | Shows a failure class on reference handlers — buggy vs fixed | `bug_pattern_id*`, `prompt`, `sandbox_id`, `flow_run_id` |
77
+ | `run_workflow` | Runs one workflow on a sandbox you already have | `sandbox_id*`, `workflow_name*`, `scenario` |
78
+ | `run_all_workflows` | Runs several in one call | `sandbox_id*`, `workflow_names` |
79
+ | `list_workflows` | Workflows available for a spec | `spec_id*` |
80
+ | `list_runs` | Past runs for a sandbox | `sandbox_id*`, `limit` |
242
81
 
243
- ```
244
- spec_id: "<id from import_spec>"
245
- ```
82
+ **Bringing your own spec**
246
83
 
247
- ### `run_workflow`
84
+ | Tool | What it does | Arguments |
85
+ |---|---|---|
86
+ | `list_specs` | Specs already available | `filter` |
87
+ | `import_spec` | Ingests an OpenAPI 3.x spec by URL or pasted content. Returns a callable sandbox | `url`, `content`, `name` |
88
+ | `submit_proof` | Publishes a receipt for a run | `sandbox_id`, `flow_run_id`, `bug_pattern_id`, `summary`, `proofs` |
89
+ | `coach` | Multi-turn help building an integration | `intent`, `session_id`, `user_response`, `context` |
248
90
 
249
- Execute one workflow and return the step-by-step request/response trace. Template variables (`{{step1.id}}`) are resolved automatically between steps.
250
-
251
- ```
252
- sandbox_id: "<id from import_spec>"
253
- workflow_name: "<id or name from list_workflows>"
254
- ```
91
+ `*` = required.
255
92
 
256
93
  ## Configuration
257
94
 
258
95
  | Env var | Default | Purpose |
259
96
  |---|---|---|
260
- | `FETCHSANDBOX_BASE_URL` | `https://fetchsandbox.com` | Override for stage testing or self-hosted backends. |
261
- | `FETCHSANDBOX_TELEMETRY` | (on) | Set to `0` to disable anonymous usage telemetry. |
262
-
263
- ### What we record
264
-
265
- When telemetry is on, each tool call records: an opaque per-machine session id (random UUID stored at `~/.fetchsandbox/session.json`), the tool name, latency, success/failure, and the spec URL or `"pasted"`. We do **not** record spec content, request bodies, or credentials. We use this to count daily-active sessions and learn which APIs people are bringing to the platform.
97
+ | `FETCHSANDBOX_BASE_URL` | `https://fetchsandbox.com` | Point at a different backend |
98
+ | `FETCHSANDBOX_TELEMETRY` | on | Set to `0` to turn off |
266
99
 
267
- To opt out:
268
-
269
- ```bash
270
- export FETCHSANDBOX_TELEMETRY=0
271
- ```
100
+ Telemetry records an opaque per-machine id (a random UUID in
101
+ `~/.fetchsandbox/session.json`), the tool name, latency, and whether the call
102
+ succeeded. Not spec content, not request bodies, not credentials. It's how we
103
+ count sessions and see which APIs people bring.
272
104
 
273
105
  ## License
274
106
 
275
107
  MIT — see [LICENSE](LICENSE).
276
108
 
277
- ## Links
278
-
279
- - [FetchSandbox](https://fetchsandbox.com)
280
- - [Source code](https://github.com/fetchsandbox/mcp)
281
- - [Issues](https://github.com/fetchsandbox/mcp/issues)
109
+ - [fetchsandbox.com](https://fetchsandbox.com)
110
+ - [Source](https://github.com/fetchsandbox/mcp) · [Issues](https://github.com/fetchsandbox/mcp/issues)
@@ -28,6 +28,8 @@ export declare const findBugsTool: {
28
28
  export declare function runFindBugs(input: FindBugsInput): Promise<{
29
29
  available: boolean;
30
30
  bugs: string | null;
31
+ next_actions?: unknown;
32
+ prove_instructions?: unknown;
31
33
  engine: string;
32
34
  packed_bytes: number;
33
35
  }>;
@@ -52,6 +52,10 @@ export const findBugsTool = {
52
52
  additionalProperties: false,
53
53
  },
54
54
  };
55
+ // THE RETURN TYPE IS THE WHITELIST. Every field the agent will ever see has to
56
+ // be named here, so a field added anywhere upstream is dropped by omission and
57
+ // the compiler calls the addition an error rather than the loss. That is how
58
+ // next_actions survived three hops and died at the fourth.
55
59
  export async function runFindBugs(input) {
56
60
  const dir = input.path && input.path.trim() ? input.path.trim() : process.cwd();
57
61
  const { b64, bytes } = packDirToBase64(dir);
@@ -75,6 +79,19 @@ export async function runFindBugs(input) {
75
79
  return {
76
80
  available: true,
77
81
  bugs: raw.bugs ?? null,
82
+ // THE FOURTH WHITELIST, and the one that undid the other three. Phalanx ->
83
+ // backend -> /jobs -> HERE -> the agent. The backend comment at hop three
84
+ // reads "Adding next_actions in _work() and forwarding it in the client was
85
+ // not enough" -- someone traced three hops and fixed them, and this return
86
+ // silently discarded the result. This tool's own description twelve lines
87
+ // above promises "the response carries next_actions telling you exactly
88
+ // what" and then did not carry them.
89
+ //
90
+ // Measured 2026-09-09: five personas, next_actions absent from every
91
+ // find_bugs result, quickrun called zero times. The routing existed at every
92
+ // layer except the one the agent reads.
93
+ next_actions: raw.next_actions ?? undefined,
94
+ prove_instructions: raw.prove_instructions ?? undefined,
78
95
  engine: raw.engine ?? "fetchsandbox",
79
96
  packed_bytes: bytes,
80
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"find_bugs.js","sourceRoot":"","sources":["../../src/tools/find_bugs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAe5C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,4EAA4E;QAC5E,4EAA4E;QAC5E,2EAA2E;QAC3E,4EAA4E;QAC5E,yDAAyD;QACzD,yEAAyE;QACzE,6EAA6E;QAC7E,6EAA6E;QAC7E,4EAA4E;QAC5E,4EAA4E;QAC5E,yEAAyE;QACzE,4EAA4E;QAC5E,2EAA2E;QAC3E,wDAAwD;IAC1D,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,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,oDAAqD,GAAG,CAAC,KAAgB,IAAI,eAAe,EAAE,CAC/F,CAAC;IACJ,CAAC;IACD,OAAO;QACL,SAAS,EAAE,IAAI;QACf,IAAI,EAAG,GAAG,CAAC,IAAsB,IAAI,IAAI;QACzC,2EAA2E;QAC3E,0EAA0E;QAC1E,4EAA4E;QAC5E,2EAA2E;QAC3E,0EAA0E;QAC1E,wEAAwE;QACxE,qCAAqC;QACrC,EAAE;QACF,qEAAqE;QACrE,6EAA6E;QAC7E,wCAAwC;QACxC,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,SAAS;QAC3C,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,IAAI,SAAS;QACvD,MAAM,EAAG,GAAG,CAAC,MAAiB,IAAI,cAAc;QAChD,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC"}
@@ -2,6 +2,7 @@ export interface ProveFixInput {
2
2
  diff: string;
3
3
  bug?: string;
4
4
  scenario?: string;
5
+ sandbox_id?: string;
5
6
  path?: string;
6
7
  timeout_s?: number;
7
8
  }
@@ -23,6 +24,10 @@ export declare const proveFixTool: {
23
24
  readonly type: "string";
24
25
  readonly description: "OPTIONAL. Explicit scenario id, if known.";
25
26
  };
27
+ readonly sandbox_id: {
28
+ readonly type: "string";
29
+ readonly description: string;
30
+ };
26
31
  readonly path: {
27
32
  readonly type: "string";
28
33
  readonly description: "OPTIONAL. Project dir. Defaults to cwd.";
@@ -12,6 +12,7 @@
12
12
  * the diff to your tree — it needs the buggy state to reproduce against.
13
13
  */
14
14
  import { ToolError } from "../client.js";
15
+ import { lastTwin } from "../twin.js";
15
16
  import { startAndPoll } from "./jobs.js";
16
17
  import { packDirToBase64 } from "./pack.js";
17
18
  export const proveFixTool = {
@@ -43,6 +44,11 @@ export const proveFixTool = {
43
44
  type: "string",
44
45
  description: "OPTIONAL. Explicit scenario id, if known.",
45
46
  },
47
+ sandbox_id: {
48
+ type: "string",
49
+ description: "OPTIONAL. A twin from quickrun/run_workflow. Usually omit — the last " +
50
+ "twin this session used is attached automatically.",
51
+ },
46
52
  path: { type: "string", description: "OPTIONAL. Project dir. Defaults to cwd." },
47
53
  timeout_s: { type: "number", description: "OPTIONAL. Budget in seconds (default 300)." },
48
54
  },
@@ -66,6 +72,20 @@ export async function runProveFix(input) {
66
72
  body.bug = input.bug.trim();
67
73
  if (input.scenario && input.scenario.trim())
68
74
  body.scenario = input.scenario.trim();
75
+ // THE TWIN, CARRIED FORWARD. quickrun/run_workflow returned a sandbox_id and
76
+ // nothing passed it on, so prove_fix's declared tier -- the reviewed
77
+ // invariant_check from brain.yaml -- had no twin to read back from and
78
+ // declined every run. Measured on prod 2026-09-08: 11 of 12 declined for
79
+ // "no twin supplied".
80
+ //
81
+ // Additive in both directions. No twin remembered -> the field is omitted and
82
+ // the run takes exactly the path it takes today. A twin remembered but for
83
+ // the WRONG provider -> the server declines it (it derives the provider from
84
+ // the bug text) and the run is again unchanged. So this can make the declared
85
+ // tier reachable; it cannot take anything away.
86
+ const twin = (input.sandbox_id && input.sandbox_id.trim()) || lastTwin();
87
+ if (twin)
88
+ body.sandbox_id = twin;
69
89
  const raw = await startAndPoll("/api/mcp/prove_fix", body, {
70
90
  // Budget for the worst case: no curated scenario → synthesize a probe
71
91
  // (~5 min) + two probe runs (buggy + fixed). Returns as soon as it's done.
@@ -1 +1 @@
1
- {"version":3,"file":"prove_fix.js","sourceRoot":"","sources":["../../src/tools/prove_fix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAU5C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,2EAA2E;QAC3E,oDAAoD;QACpD,6EAA6E;QAC7E,2EAA2E;QAC3E,4EAA4E;QAC5E,uE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AC;IAEjC,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,oBAAoB,EAAE,IAAI,EAAE;QACzD,sEAAsE;QACtE,2EAA2E;QAC3E,KAAK,EAAE,CAAC,SAAS,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI;KACpC,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,SAAS,CAAC,8BAA8B,GAAG,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO;QACL,aAAa,EAAE,GAAG,CAAC,aAAa,KAAK,IAAI;QACzC,KAAK,EAAE,GAAG,CAAC,KAA2B;QACtC,UAAU,EAAE,GAAG,CAAC,UAAiC;QACjD,QAAQ,EAAE,GAAG,CAAC,QAA+B;QAC7C,MAAM,EAAE,GAAG,CAAC,MAA4B;QACxC,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,WAAW,EAAE,GAAG,CAAC,WAAiC;QAClD,MAAM,EAAG,GAAG,CAAC,MAAiB,IAAI,cAAc;KACjD,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { ToolError, postJson } from "../client.js";
2
+ import { rememberTwin } from "../twin.js";
2
3
  export const quickrunTool = {
3
4
  name: "quickrun",
4
5
  description: "Run a curated proof workflow against a KNOWN, bundled spec (stripe, clerk, " +
@@ -45,6 +46,9 @@ export async function runQuickrun(input) {
45
46
  body.scenario = input.scenario.trim();
46
47
  const raw = await postJson(path, body);
47
48
  const steps = raw.steps ?? [];
49
+ // Carry the twin forward: prove_fix's declared tier reads back from it,
50
+ // and nothing else in the session knows this id exists.
51
+ rememberTwin(raw.sandbox_id);
48
52
  // Forward any field this client does not know about. The named fields below
49
53
  // are normalized (renames, derived counts); everything else travels as-is so
50
54
  // a newer backend can surface information to the agent without waiting for a
@@ -1 +1 @@
1
- {"version":3,"file":"quickrun.js","sourceRoot":"","sources":["../../src/tools/quickrun.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O;QACL,GAAG,WAAW;QACd,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,2EAA2E;QAC3E,yEAAyE;QACzE,6DAA6D;QAC7D,2DAA2D;QAC3D,YAAY,EAAE,GAAG,CAAC,YAAY,IAAI,SAAS;QAC3C,kBAAkB,EAAE,GAAG,CAAC,kBAAkB,IAAI,SAAS;QACvD,aAAa,EAAE,GAAG,CAAC,SAAS,IAAI,KAAK,CAAC,aAAa;QACnD,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QACpC,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,MAAM;QAC/D,WAAW,EAAE,KAAK,CAAC,MAAM;QACzB,iBAAiB,EAAE,GAAG,CAAC,iBAAiB,IAAI,CAAC;QAC7C,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,sFAAsF;QACtF,SAAS,EAAE,GAAG,CAAC,SAAS,IAAI,GAAG,CAAC,YAAY;QAC5C,OAAO,EAAE,GAAG,CAAC,OAAO;KACrB,CAAC;AACJ,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { postJson, ToolError } from "../client.js";
2
+ import { rememberTwin } from "../twin.js";
2
3
  export const runWorkflowTool = {
3
4
  name: "run_workflow",
4
5
  description: "Execute ONE specific workflow by name and return its step-by-step trace " +
@@ -53,6 +54,9 @@ export async function runRunWorkflow(input) {
53
54
  }
54
55
  const raw = await postJson(path, body);
55
56
  const steps = raw.steps ?? [];
57
+ // Carry the twin forward: prove_fix's declared tier reads back from it,
58
+ // and nothing else in the session knows this id exists.
59
+ rememberTwin(raw.sandbox_id);
56
60
  const passedSteps = steps.filter((s) => s.status === "passed").length;
57
61
  return {
58
62
  workflow_name: raw.flow_name ?? input.workflow_name,
@@ -1 +1 @@
1
- {"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D,CAAC;AACJ,CAAC"}
package/dist/twin.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The twin this session last stood up.
3
+ *
4
+ * `quickrun` / `run_workflow` resolve a provider twin and return its
5
+ * `sandbox_id`. `prove_fix` can read back from that same twin — but only if it
6
+ * is told which one, and nothing carried it across tool calls, so every
7
+ * prove_fix arrived with no twin and its declared tier (the reviewed
8
+ * `invariant_check` from brain.yaml) declined every time. Measured on prod
9
+ * 2026-09-08: 11 of 12 runs declined for "no twin supplied".
10
+ *
11
+ * The MCP server is a long-lived stdio process, so module state is exactly the
12
+ * lifetime we want: one IDE session. Nothing is persisted to disk — a new
13
+ * session starts with no twin, which is the correct default.
14
+ *
15
+ * DELIBERATELY NOT VALIDATED HERE. Whether the remembered twin is the right
16
+ * PROVIDER for a given bug is decided server-side, where `_spec_hint` already
17
+ * derives the provider from the bug text. A second copy of that mapping in
18
+ * TypeScript is a second thing to drift. The client's whole job is to report
19
+ * what it has; the server decides whether to use it.
20
+ */
21
+ /** Record a twin this session just exercised. Ignores empty values. */
22
+ export declare function rememberTwin(sandboxId: string | undefined | null): void;
23
+ /** The twin this session last exercised, or undefined if none yet. */
24
+ export declare function lastTwin(): string | undefined;
25
+ /** Test seam — never called in normal operation. */
26
+ export declare function __resetTwin(): void;
package/dist/twin.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The twin this session last stood up.
3
+ *
4
+ * `quickrun` / `run_workflow` resolve a provider twin and return its
5
+ * `sandbox_id`. `prove_fix` can read back from that same twin — but only if it
6
+ * is told which one, and nothing carried it across tool calls, so every
7
+ * prove_fix arrived with no twin and its declared tier (the reviewed
8
+ * `invariant_check` from brain.yaml) declined every time. Measured on prod
9
+ * 2026-09-08: 11 of 12 runs declined for "no twin supplied".
10
+ *
11
+ * The MCP server is a long-lived stdio process, so module state is exactly the
12
+ * lifetime we want: one IDE session. Nothing is persisted to disk — a new
13
+ * session starts with no twin, which is the correct default.
14
+ *
15
+ * DELIBERATELY NOT VALIDATED HERE. Whether the remembered twin is the right
16
+ * PROVIDER for a given bug is decided server-side, where `_spec_hint` already
17
+ * derives the provider from the bug text. A second copy of that mapping in
18
+ * TypeScript is a second thing to drift. The client's whole job is to report
19
+ * what it has; the server decides whether to use it.
20
+ */
21
+ let lastSandboxId;
22
+ /** Record a twin this session just exercised. Ignores empty values. */
23
+ export function rememberTwin(sandboxId) {
24
+ if (typeof sandboxId === "string" && sandboxId.trim()) {
25
+ lastSandboxId = sandboxId.trim();
26
+ }
27
+ }
28
+ /** The twin this session last exercised, or undefined if none yet. */
29
+ export function lastTwin() {
30
+ return lastSandboxId;
31
+ }
32
+ /** Test seam — never called in normal operation. */
33
+ export function __resetTwin() {
34
+ lastSandboxId = undefined;
35
+ }
36
+ //# sourceMappingURL=twin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twin.js","sourceRoot":"","sources":["../src/twin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,IAAI,aAAiC,CAAC;AAEtC,uEAAuE;AACvE,MAAM,UAAU,YAAY,CAAC,SAAoC;IAC/D,IAAI,OAAO,SAAS,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC;QACtD,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IACnC,CAAC;AACH,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,QAAQ;IACtB,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,WAAW;IACzB,aAAa,GAAG,SAAS,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fetchsandbox-mcp",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
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",