YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
fix(mcp): retrieve maintained workflows and release 0.20.0 (#7161)
Louis Beaumont9c38b194f5e3
diff --git a/crates/screenpipe-engine/src/routes/workflow_catalog.rs b/crates/screenpipe-engine/src/routes/workflow_catalog.rsindex 8faafc09b..9ce1ee89a 100644--- a/crates/screenpipe-engine/src/routes/workflow_catalog.rs+++ b/crates/screenpipe-engine/src/routes/workflow_catalog.rs@@ -590,8 +590,14 @@ fn apply_feedback(workflow: &mut Value, body: &CorrectionRequest) -> Result<(),"Only small descriptive workflow corrections are allowed.",));}- if fields.keys().any(|key| workflow["userEdits"].get(key).is_some()) {- return Err(error(StatusCode::CONFLICT, "This field was manually edited. Use Edit workflow to change it."));+ if fields+ .keys()+ .any(|key| workflow["userEdits"].get(key).is_some())+ {+ return Err(error(+ StatusCode::CONFLICT,+ "This field was manually edited. Use Edit workflow to change it.",+ ));}for (key, value) in fields {workflow[key] = value.clone();diff --git a/crates/screenpipe-engine/src/server.rs b/crates/screenpipe-engine/src/server.rsindex 7513e300d..258344124 100644--- a/crates/screenpipe-engine/src/server.rs+++ b/crates/screenpipe-engine/src/server.rs@@ -1018,10 +1018,7 @@ impl SCServer {"/workflows/catalog",crate::routes::workflow_catalog::commit,)- .post(- "/workflows/edits",- crate::routes::workflow_edits::edit,- )+ .post("/workflows/edits", crate::routes::workflow_edits::edit).post("/workflows/corrections",crate::routes::workflow_catalog::correct,diff --git a/packages/screenpipe-mcp/RELEASE.md b/packages/screenpipe-mcp/RELEASE.mdindex 591b8de8b..a228091a0 100644--- a/packages/screenpipe-mcp/RELEASE.md+++ b/packages/screenpipe-mcp/RELEASE.md@@ -6,6 +6,13 @@ credentials for this package.---+## 0.20.0 — workflow catalog access++- Publishes `list-workflows` and `get-workflow` for the saved desktop Workflows catalog.+- Accepts both legacy hash IDs and UUID IDs created by maintained workflows.+- Adds unit and built-transport regression coverage for UUID retrieval and rejects malformed IDs before sending requests.+- Requires workflow tool markers in both published stdio entry points.+## 0.19.0 — release notes (pending publish)**Headline: `team-*` tools can finally be pointed at a customer's own querydiff --git a/packages/screenpipe-mcp/package.json b/packages/screenpipe-mcp/package.jsonindex 80bc3884e..71781694d 100644--- a/packages/screenpipe-mcp/package.json+++ b/packages/screenpipe-mcp/package.json@@ -1,6 +1,6 @@{"name": "screenpipe-mcp",- "version": "0.19.4",+ "version": "0.20.0","mcpName": "io.github.screenpipe/screenpipe-mcp","description": "MCP server for screenpipe - search your screen recordings and audio transcriptions","main": "dist/index.js",diff --git a/packages/screenpipe-mcp/scripts/assert-pack-contents.js b/packages/screenpipe-mcp/scripts/assert-pack-contents.jsindex 8d27b37a6..279f64cc8 100644--- a/packages/screenpipe-mcp/scripts/assert-pack-contents.js+++ b/packages/screenpipe-mcp/scripts/assert-pack-contents.js@@ -53,6 +53,13 @@ const REQUIRED_PATHS = [* file list but stale or reverted contents.*/const REQUIRED_MARKERS = [+ ...["dist/index.js", "dist/cli.js"].flatMap((file) =>+ ["list-workflows", "get-workflow"].map((marker) => ({+ file,+ marker,+ why: "both stdio entry points must expose the desktop workflow catalog",+ })),+ ),{file: "dist/index.js",marker: "SCREENPIPE_TEAM_API_URL",diff --git a/packages/screenpipe-mcp/server.json b/packages/screenpipe-mcp/server.jsonindex 57699ce80..abc154097 100644--- a/packages/screenpipe-mcp/server.json+++ b/packages/screenpipe-mcp/server.json@@ -8,13 +8,13 @@"source": "github","subfolder": "packages/screenpipe-mcp"},- "version": "0.19.4",+ "version": "0.20.0","packages": [{"registryType": "npm","registryBaseUrl": "https://registry.npmjs.org","identifier": "screenpipe-mcp",- "version": "0.19.4",+ "version": "0.20.0","transport": {"type": "stdio"}diff --git a/packages/screenpipe-mcp/src/pack-contents.test.ts b/packages/screenpipe-mcp/src/pack-contents.test.tsindex f01f20ee0..c5939a68d 100644--- a/packages/screenpipe-mcp/src/pack-contents.test.ts+++ b/packages/screenpipe-mcp/src/pack-contents.test.ts@@ -87,6 +87,7 @@ describe("pack-contents gate — built-file contents", () => {/** A dist/ built from THIS tree: every marker present, no hardcoded base. */const goodDist: Record<string, string> = {"dist/index.js":+ 'const workflowTools = ["list-workflows", "get-workflow"];\n' +'exports.HOSTED_TEAM_API = "https://screenpi.pe/api/enterprise/v1";\n' +"const base = flagOverride || env.SCREENPIPE_TEAM_API_URL || fromFile;\n" +"const url = typeof parsed?.gateway_url === \"string\" ? parsed.gateway_url : \"\";\n" +@@ -97,6 +98,16 @@ describe("pack-contents gate — built-file contents", () => {"const midnight = new Date(reference.getFullYear(), reference.getMonth(), reference.getDate());\n",};+ goodDist["dist/cli.js"] = goodDist["dist/index.js"];++ it("rejects a transport bundle missing workflow tools", () => {+ const failures = gate.markerFailures((file: string) =>+ file in goodDist ? goodDist[file].replaceAll("list-workflows", "missing-list").replaceAll("get-workflow", "missing-detail") : null,+ );+ expect(failures).toHaveLength(4);+ expect(failures.every((failure: string) => failure.includes("workflows") || failure.includes("get-workflow"))).toBe(true);+ });+const reader = (files: Record<string, string>) => (file: string) =>file in files ? files[file] : null;diff --git a/packages/screenpipe-mcp/src/workflow-tools.test.ts b/packages/screenpipe-mcp/src/workflow-tools.test.tsindex 6ccfd758e..11f75ff04 100644--- a/packages/screenpipe-mcp/src/workflow-tools.test.ts+++ b/packages/screenpipe-mcp/src/workflow-tools.test.ts@@ -22,6 +22,22 @@ describe("workflow MCP tools", () => {await readWorkflowTool("get-workflow",{id,include_automation:false},call);expect(call).toHaveBeenLastCalledWith(`/workflows/${id}?include_automation=false`);});+ it("retrieves UUID workflow IDs returned by the maintained catalog", async () => {+ const uuidId = "wf-12345678-1234-4234-8234-123456789abc";+ const call = vi.fn(async () => Response.json({ id: uuidId }));+ const result = await readWorkflowTool("get-workflow", { id: uuidId }, call);+ expect(call).toHaveBeenCalledWith(`/workflows/${uuidId}?include_automation=true`);+ expect(JSON.parse(result.content[0].text).id).toBe(uuidId);+ });+ it("rejects malformed IDs and URL injection before sending requests", async () => {+ const call = vi.fn();+ for (const invalid of ["wf-", "wf-1234", `wf-${"a".repeat(63)}`,+ "wf-12345678-1234-4234-8234-123456789abz", `${id}/../catalog`,+ `${id}?include_automation=false`, `${id}#fragment`, `${id}%2f..`, `${id}\n`]) {+ await expect(readWorkflowTool("get-workflow", { id: invalid }, call)).rejects.toThrow();+ }+ expect(call).not.toHaveBeenCalled();+ });it("rejects paths and malformed pagination without making a request", async () => {const call=vi.fn();for(const args of [{id:"../../secrets"},{id,include_automation:"false"}]) await expect(readWorkflowTool("get-workflow",args,call)).rejects.toThrow();diff --git a/packages/screenpipe-mcp/src/workflow-tools.ts b/packages/screenpipe-mcp/src/workflow-tools.tsindex 757b1a99c..2103006f0 100644--- a/packages/screenpipe-mcp/src/workflow-tools.ts+++ b/packages/screenpipe-mcp/src/workflow-tools.ts@@ -2,6 +2,9 @@// https://screenpipe.comimport type { Tool } from "@modelcontextprotocol/sdk/types.js";+// Older catalogs use content hashes; maintained workflows use UUIDs.+const WORKFLOW_ID = /^wf-(?:[0-9a-f]{64}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/;+export const WORKFLOW_TOOLS: Tool[] = [{name: "list-workflows",@@ -37,7 +40,7 @@ export async function readWorkflowTool(name: string, args: Record<string, unknow}endpoint = `/workflows?${params}`;} else if (name === "get-workflow") {- if (typeof args.id !== "string" || !/^wf-[0-9a-f]{64}$/.test(args.id)) throw new Error("Use a workflow ID returned by list-workflows");+ if (typeof args.id !== "string" || args.id.trim() !== args.id || !WORKFLOW_ID.test(args.id)) throw new Error("Use a workflow ID returned by list-workflows");if (args.include_automation !== undefined && typeof args.include_automation !== "boolean") throw new Error("include_automation must be a boolean");endpoint = `/workflows/${args.id}?include_automation=${args.include_automation !== false}`;} else { throw new Error("Unknown workflow tool"); }diff --git a/packages/screenpipe-mcp/src/workflow-transport.test.ts b/packages/screenpipe-mcp/src/workflow-transport.test.tsindex 4381c1090..0476ebfb6 100644--- a/packages/screenpipe-mcp/src/workflow-transport.test.ts+++ b/packages/screenpipe-mcp/src/workflow-transport.test.ts@@ -11,13 +11,15 @@ it("discovers and retrieves workflow targeting context through the built MCP traconst root=path.resolve(__dirname,"..");execFileSync("bun",["run","build"],{cwd:root,stdio:"pipe",timeout:120000});const id=`wf-${"b".repeat(64)}`;+ const uuidId="wf-12345678-1234-4234-8234-123456789abc";const requests: string[]=[];const api=createServer((req,res)=>{requests.push(req.url || "");if(req.headers.authorization !== "Bearer fixture-key") {res.writeHead(403);res.end();return;}res.setHeader("Content-Type","application/json");- if(req.url?.startsWith("/workflows?")) res.end(JSON.stringify({data:[{id,title:"Invoice review"}]}));+ if(req.url?.startsWith("/workflows?")) res.end(JSON.stringify({data:[{id,title:"Invoice review"},{id:uuidId,title:"Maintained workflow"}]}));else if(req.url?.startsWith(`/workflows/${id}?`)) res.end(JSON.stringify({id,workflow:{stages:[{name:"Review"}]},automationEvidence:[{status:"no_captured_frame",actionTarget:"unknown"}]}));+ else if(req.url?.startsWith(`/workflows/${uuidId}?`)) res.end(JSON.stringify({id:uuidId,workflow:{stages:[{name:"Review maintained workflow"}]}}));else if(req.url?.startsWith("/search?")) res.end(JSON.stringify({data:[{type:"Input",content:{id:8,event_type:"click",frame_id:7,x:40,y:60,element_role:"AXButton",element_name:"Approve"}}],pagination:{total:1,offset:0,limit:5}}));else if(req.url === "/frames/7/context?include_empty=true") res.end(JSON.stringify({frame_id:7,text_source:"accessibility",nodes:[{role:"AXButton",text:"",bounds:{left:0.25,top:0.5,width:0.125,height:0.0625},properties:{automation_id:"approve"}}]}));else { res.writeHead(404);res.end("{}"); }@@ -35,6 +37,10 @@ it("discovers and retrieves workflow targeting context through the built MCP traexpect(JSON.stringify(listed)).toContain(id);const detail=await client.callTool({name:"get-workflow",arguments:{id}});expect(detail.isError).not.toBe(true);expect(JSON.stringify(detail)).toContain("no_captured_frame");+ const maintained=await client.callTool({name:"get-workflow",arguments:{id:uuidId,include_automation:false}});+ expect(maintained.isError).not.toBe(true);+ expect(JSON.stringify(maintained)).toContain("Review maintained workflow");+ expect(requests).toContain(`/workflows/${uuidId}?include_automation=false`);const frame=await client.callTool({name:"frame-context",arguments:{frame_id:7,purpose:"automation"}});expect(frame.isError).not.toBe(true);expect(JSON.stringify(frame)).toContain("automation_id");expect(JSON.stringify(frame)).toContain("0.25");