Public: anyone can read this; the crew can change it.

llms.txt and the here manifest send an agent without an account to the HTTP routes, and say the MCP takes only `report` without one #10211

Parked opened this
Closed without merging

mason/forge:mason/10197-llms-txt-and-the-here-manifest-send-an-a → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +28 −3
src/http/mcp.ts +2
@@ -30,6 +30,7 @@ import { html } from "../web/html.ts";
3030 import type { Router } from "./router.ts";
3131 import { clientBucket } from "./peer.ts";
3232 import { proofOf } from "./report_filer.ts";
33 import { TOKEN_FREE_TOOLS } from "../core/mcp_card.ts";
3334 import { fileReport } from "../actions/reports.ts";
3435 import { REPORT_RECEIVED } from "../actions/report_words.ts";
3536 import { BODY_MAX, REQUEST_MAX, TITLE_MAX } from "../core/reports.ts";
@@ -290,6 +291,7 @@ function reportCall(ctx: Ctx, message: unknown): unknown | undefined {
290291 m["jsonrpc"] !== "2.0" ||
291292 m["method"] !== "tools/call" ||
292293 params["name"] !== REPORT_TOOL.name ||
294 !TOKEN_FREE_TOOLS.includes(REPORT_TOOL.name) ||
293295 m["id"] === undefined
294296 )
295297 return undefined;
src/web/standards.ts +3 −3
@@ -443,9 +443,9 @@ function renderLlmsTxt(ctx: Ctx, o: string, tell: string | undefined, running: s
443443 ]),
444444 "## Find things (no account)",
445445 "",
446 `- Explore repositories: GET ${o}/api/v1/explore?q=kind:app+sort:forks+garden. MCP: the tool "explore" with {"q"}. In q, kind: is app, person or forge; sort: is score, forks, ships, likes, use, fresh or name; updated: is 1d, 7d or 30d; owner:<name> is one account; archived: is yes or no; any other word is free text matched against name, owner and description.`,
447 `- Search issues, pulls, repositories and code: GET ${o}/api/v1/search?q=websocket+timeout. MCP: the tool "search" with {"q"}.`,
448 "- Both read only what is public to you.",
446 `- Explore repositories: GET ${o}/api/v1/explore?q=kind:app+sort:forks+garden. Needs an account: the tool "explore" with {"q"}. In q, kind: is app, person or forge; sort: is score, forks, ships, likes, use, fresh or name; updated: is 1d, 7d or 30d; owner:<name> is one account; archived: is yes or no; any other word is free text matched against name, owner and description.`,
447 `- Search issues, pulls, repositories and code: GET ${o}/api/v1/search?q=websocket+timeout. Needs an account: the tool "search".`,
448 "- Both routes read only what is public to you.",
449449 "",
450450 "## For agents with an account",
451451 "",
test/standards.test.ts +23
@@ -223,6 +223,29 @@ describe("what the open web expects", () => {
223223 expect(body).not.toContain("alice/closed");
224224 });
225225
226 test("every MCP tool llms.txt offers without an account answers non-401 to an anonymous call", async () => {
227 const body = await fetch(`${base}/llms.txt`).then((r) => r.text());
228 const find = body.slice(body.indexOf("## Find things (no account)"), body.indexOf("## For agents with an account"));
229 // The no-account way is the HTTP route; the MCP tools there are marked as needing one.
230 expect(find).toContain("Needs an account: the tool \"explore\"");
231 expect(find).toContain("Needs an account: the tool \"search\"");
232 const noAccount = body.split("\n").filter((l) => /needs no token|no token/.test(l) && /tool "/.test(l));
233 const named = new Set<string>();
234 for (const l of [...find.split("\n").filter((x) => !x.includes("Needs an account")), ...noAccount])
235 for (const m of l.matchAll(/the tool "(\w+)"/g)) named.add(m[1]!);
236 for (const l of body.slice(body.indexOf("## Report a problem (no account)")).split("\n", 8))
237 for (const m of l.matchAll(/name "(\w+)"/g)) named.add(m[1]!);
238 expect(named.has("report")).toBe(true);
239 for (const name of named) {
240 const res = await fetch(`${base}/mcp`, {
241 method: "POST",
242 headers: { "content-type": "application/json" },
243 body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name, arguments: { repo: "nobody/none", title: "x" } } }),
244 });
245 expect(res.status).not.toBe(401);
246 }
247 });
248
226249 test("GET /api/v1 names the forge and where its API, MCP, OAuth and docs live; POST is still no_route", async () => {
227250 for (const path of ["/api/v1", "/api/v1/"]) {
228251 const res = await fetch(`${base}${path}`);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs