File tree Expand file tree Collapse file tree
dashboards/open-brain-dashboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22# Copy this file to `.env.local` for local development.
33# SvelteKit only picks up env changes after restarting `npm run dev`.
44#
5+ # Tip: symlink from the repo root so all dashboards share one file:
6+ # ln -s ../../.env.local dashboards/open-brain-dashboard/.env.local
7+ #
58# Preferred (server-only, does not expose key in browser):
69MCP_URL = https://your-project.supabase.co/functions/v1/open-brain-mcp
710MCP_KEY = your-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change 1+ # These are set automatically by Supabase when you deploy an Edge Function.
2+ # You only need to set MCP_ACCESS_KEY manually.
3+
4+ SUPABASE_URL = https://your-project.supabase.co
5+ SUPABASE_SERVICE_ROLE_KEY = your-service-role-key
6+ MCP_ACCESS_KEY = your-mcp-access-key
Original file line number Diff line number Diff line change @@ -316,15 +316,27 @@ server.registerTool(
316316 extractMetadata ( content ) ,
317317 ] ) ;
318318
319- const { error } = await supabase . from ( "thoughts" ) . insert ( {
320- content,
321- embedding,
322- metadata : { ...metadata , source : "mcp" } ,
319+ const { data : upsertResult , error : upsertError } = await supabase . rpc ( "upsert_thought" , {
320+ p_content : content ,
321+ p_payload : { metadata : { ...metadata , source : "mcp" } } ,
323322 } ) ;
324323
325- if ( error ) {
324+ if ( upsertError ) {
325+ return {
326+ content : [ { type : "text" as const , text : `Failed to capture: ${ upsertError . message } ` } ] ,
327+ isError : true ,
328+ } ;
329+ }
330+
331+ const thoughtId = upsertResult ?. id ;
332+ const { error : embError } = await supabase
333+ . from ( "thoughts" )
334+ . update ( { embedding } )
335+ . eq ( "id" , thoughtId ) ;
336+
337+ if ( embError ) {
326338 return {
327- content : [ { type : "text" as const , text : `Failed to capture : ${ error . message } ` } ] ,
339+ content : [ { type : "text" as const , text : `Failed to save embedding : ${ embError . message } ` } ] ,
328340 isError : true ,
329341 } ;
330342 }
You can’t perform that action at this time.
0 commit comments