diff --git a/dashboards/open-brain-dashboard/.env.example b/dashboards/open-brain-dashboard/.env.example index 6a3987c6..0d58cec0 100644 --- a/dashboards/open-brain-dashboard/.env.example +++ b/dashboards/open-brain-dashboard/.env.example @@ -2,6 +2,9 @@ # Copy this file to `.env.local` for local development. # SvelteKit only picks up env changes after restarting `npm run dev`. # +# Tip: symlink from the repo root so all dashboards share one file: +# ln -s ../../.env.local dashboards/open-brain-dashboard/.env.local +# # Preferred (server-only, does not expose key in browser): MCP_URL=https://your-project.supabase.co/functions/v1/open-brain-mcp MCP_KEY=your-access-key diff --git a/extensions/family-calendar/.env.example b/extensions/family-calendar/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/family-calendar/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/extensions/home-maintenance/.env.example b/extensions/home-maintenance/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/home-maintenance/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/extensions/household-knowledge/.env.example b/extensions/household-knowledge/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/household-knowledge/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/extensions/job-hunt/.env.example b/extensions/job-hunt/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/job-hunt/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/extensions/meal-planning/.env.example b/extensions/meal-planning/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/meal-planning/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/extensions/professional-crm/.env.example b/extensions/professional-crm/.env.example new file mode 100644 index 00000000..91155206 --- /dev/null +++ b/extensions/professional-crm/.env.example @@ -0,0 +1,6 @@ +# These are set automatically by Supabase when you deploy an Edge Function. +# You only need to set MCP_ACCESS_KEY manually. + +SUPABASE_URL=https://your-project.supabase.co +SUPABASE_SERVICE_ROLE_KEY=your-service-role-key +MCP_ACCESS_KEY=your-mcp-access-key diff --git a/server/index.ts b/server/index.ts index 9630220c..b40149f8 100644 --- a/server/index.ts +++ b/server/index.ts @@ -316,15 +316,27 @@ server.registerTool( extractMetadata(content), ]); - const { error } = await supabase.from("thoughts").insert({ - content, - embedding, - metadata: { ...metadata, source: "mcp" }, + const { data: upsertResult, error: upsertError } = await supabase.rpc("upsert_thought", { + p_content: content, + p_payload: { metadata: { ...metadata, source: "mcp" } }, }); - if (error) { + if (upsertError) { + return { + content: [{ type: "text" as const, text: `Failed to capture: ${upsertError.message}` }], + isError: true, + }; + } + + const thoughtId = upsertResult?.id; + const { error: embError } = await supabase + .from("thoughts") + .update({ embedding }) + .eq("id", thoughtId); + + if (embError) { return { - content: [{ type: "text" as const, text: `Failed to capture: ${error.message}` }], + content: [{ type: "text" as const, text: `Failed to save embedding: ${embError.message}` }], isError: true, }; }