Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
if (!["127.0.0.1", "localhost", "::1"].includes(host)) throw new Error("MCP-WEB-001 QA workspace binds only to loopback addresses");
const csrf = randomBytes(32).toString("base64url"); const runs = new Map<string, WorkspaceRun>();
const assets = resolve(dirname(fileURLToPath(import.meta.url)), "../workspace-assets");
const server = createServer(async (req, res) => { securityHeaders(res); try { await route(req, res); } catch (error) { console.error("[MCP Rigor workspace] internal error:", messageOf(error)); json(res, 500, { error: { code: "MCP-WEB-500", message: "Internal server error" } }); } });
const server = createServer(async (req, res) => { securityHeaders(res); try { await route(req, res); } catch (error) { console.error("[MCP Rigor workspace] internal error:", messageOf(error).replace(/\r?\n/g, " ")); json(res, 500, { error: { code: "MCP-WEB-500", message: "Internal server error" } }); } });
async function route(req: IncomingMessage, res: ServerResponse): Promise<void> {
const url = new URL(req.url ?? "/", `http://${req.headers.host}`); const method = req.method ?? "GET";
if (method !== "GET" && !authorized(req, csrf, `http://${req.headers.host}`)) return json(res, 403, { error: { code: "MCP-WEB-403", message: "Invalid workspace origin or CSRF token" } });
Expand Down
Loading