Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

add logs

fzaninotto2ef4fa4fdb2d
diff --git a/supabase/functions/mcp/index.ts b/supabase/functions/mcp/index.ts
index a98a2131..9259a0c0 100644
--- a/supabase/functions/mcp/index.ts
+++ b/supabase/functions/mcp/index.ts
@@ -291,6 +291,7 @@ function createMcpServer(authInfo: AuthInfo): McpServer {
"Execute a SQL query against the CRM database. The query runs with Row Level Security (RLS) enforced for the authenticated user. Supports SELECT, INSERT, UPDATE, DELETE. Use *_summary views for aggregated/search data. IMPORTANT: Never specify sales_id in INSERT or UPDATE statements — it is automatically set to the authenticated user by a database trigger. Examples: SELECT id, first_name, last_name FROM contacts_summary WHERE email_fts LIKE '%@company.com%'; INSERT INTO contact_notes (contact_id, text, date, status) VALUES (1, 'Called client', NOW(), 'cold')",
{ sql: z.string().describe("The SQL query to execute") },
async ({ sql }) => {
+ console.log(`[MCP query] user=${authInfo.userId} sql=${sql}`);
const result = await executeQueryWithRLS(sql, authInfo.token);
if (result.success) {
return {