caelum0x 53c7478c18 feat(mcp): flags.list is live for the signed-in org, from a token-scoped console route (PY3.4)
The Railyard MCP server's flags.list now lists the org's flags per app and
environment (key, on or off, value, description) from the new console route
GET /api/v1/flags?app= for an org's ry_ token (lib/flags/http.ts
tokenListFlags; read only, at most 100 environments). A token only ever reads
its own org: the MCP test shows org B naming org A's app lists nothing and
never sees org A's flag. Annotations stay read-only (the linter test), and
the README row says what it does.

Tests: mcp 9/9 (incl. copy lint), console 128/128, tsc clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 04:17:44 +03:00

14 lines
596 B
TypeScript

import { deps } from "../../../../lib/deps.ts";
import { tokenListFlags } from "../../../../lib/flags/http.ts";
import { json } from "../../../../lib/http.ts";
import { orgForBearer } from "../../../../lib/tokens.ts";
export const dynamic = "force-dynamic";
// The org's flags for its own `ry_` token, read only (the agent surface, PY3.4).
export async function GET(req: Request) {
const { repo, flags } = deps();
const r = await tokenListFlags(flags, await orgForBearer(repo, req.headers.get("authorization")), new URL(req.url).searchParams.get("app"));
return json(r.body, r.status);
}