Public: anyone can read this; the crew can change it.
An outsider's report answers with a receipt number and the same words by API and MCP #13435
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13400-an-outsider-s-report-answers-with-a-rece → main 1 commit fork
2 files
changed +19
−0
docs/MCP.md +2
| @@ -253,6 +253,8 @@ bytes in `tools/list`. After changing a tool run `bun scripts/mcp-table.ts`; | ||
| 253 | 253 | | `offer` | — | Offer a patch to a public repository, no account needed; a person reads it first | 362 | |
| 254 | 254 | <!-- mcp-tools:end --> |
| 255 | 255 | |
| 256 | `report` answers the receipt `POST …/reports` does (`id`, `state`, `issue`, `url`, `message`, `next`): `issue` is null until a person accepts the report, and `url` shows the number once there is one; never the filer's words. | |
| 257 | ||
| 256 | 258 | Five tools need no token, for the same reach as their HTTP doors: `report`, |
| 257 | 259 | `offer`, `start`, `explore` and `search` (`TOKEN_FREE_TOOLS` in `src/core/mcp_card.ts`). |
| 258 | 260 | `offer` (`{ repo, title, body?, patch }`, or `{ receipt }` to read an offer's state) calls `fileOffer`, the action behind |
test/report-receipt.test.ts +17
| @@ -61,6 +61,23 @@ describe("a report's receipt", () => { | ||
| 61 | 61 | expect(t).not.toContain("secret-"); |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | test("the MCP report tool answers the same receipt, with no token", async () => { | |
| 65 | const res = await fetch(`${base}/mcp`, { | |
| 66 | method: "POST", | |
| 67 | headers: { "content-type": "application/json", accept: "application/json", ...from() }, | |
| 68 | body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", | |
| 69 | params: { name: "report", arguments: { repo: "alice/open", title: "Broken link", body: "secret-body" } } }), | |
| 70 | }); | |
| 71 | const out = (await res.json()) as { result: { isError?: boolean; content: { text: string }[] } }; | |
| 72 | expect(out.result.isError).toBeFalsy(); | |
| 73 | const text = out.result.content[0]!.text; | |
| 74 | const r = JSON.parse(text) as { issue: number | null; next: string; url: string; id: string; message: string }; | |
| 75 | expect(r.issue).toBeNull(); | |
| 76 | expect(r.next).toBe(REPORT_NEXT_STEP); | |
| 77 | expect(r.url).toBe(`${base}/alice/open/report?sent=${r.id}`); | |
| 78 | expect(text).not.toContain("secret-body"); | |
| 79 | }); | |
| 80 | ||
| 64 | 81 | test("the url, signed out, shows the report escaped; a private repository is 404", async () => { |
| 65 | 82 | const r = (await (await file("open", { title: "Broken <b>link</b>" })).json()) as { url: string; id: string }; |
| 66 | 83 | const page = await (await fetch(r.url)).text(); |
new above
offline