MCP Supabase Server for AI Agent with RAG & Multi-Tenant CRUD

Go to Workflow
11,593 views
Built by Luciano Gutierrez Luciano Gutierrez
Created on April 23, 2025

Description

Supabase AI Agent with RAG & Multi-Tenant CRUD
Version: 1.0.0
n8n Version: 1.88.0+
Author: Koresolucoes
License: MIT

Description
A stateful AI agent workflow powered by Supabase and Retrieval-Augmented Generation (RAG). Enables persistent memory, dynamic CRUD operations, and multi-tenant data isolation for AI-driven applications like customer support, task orchestration, and knowledge management.

Key Features:
🧠 RAG Integration: Leverages OpenAI embeddings and Supabase vector search for context-aware responses.
šŸ—ƒļø Full CRUD: Manage agent_messages, agent_tasks, agent_status, and agent_knowledge in real time.
šŸ“¤ Multi-Tenant Ready: Supports per-user/organization data isolation via dynamic table names and webhooks.
šŸ”’ Secure: Role-based access control via Supabase Row Level Security (RLS).

Use Cases
Customer Support Chatbots: Persist conversation history and resolve queries using institutional knowledge.
Automated Task Management: Track and update task statuses dynamically.
Knowledge Repositories: Store and retrieve domain-specific information for AI agents.

Instructions
1. Import Template
Go to n8n > Templates > Import from File and upload this workflow.

2. Configure Credentials
Add your Supabase and OpenAI API keys under Settings > Credentials.

3. Set Up Multi-Tenancy (Optional)
Dynamic Webhook Path**:
Replace the default webhook path with /mcp/tool/supabase/:userId to enable per-user routing.
Table Names**:
Use a Set Node to dynamically generate table names (e.g., agent_messages_{{userId}}).

4. Activate & Test
Enable the workflow and send test requests to the webhook URL.

Tags
AI Agent RAG Supabase CRUD Multi-Tenant OpenAI Automation

Screenshots

License
This template is licensed under the MIT License.

This workflow was created by Luciano Gutierrez and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.

Categories

AI Langchain

Nodes Used (2)

Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi
Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase