A powerful Model Context Protocol (MCP) server that enables seamless interaction with Supabase databases. This project provides a comprehensive suite of CRUD operations through the MCP interface, allowing AI assistants and tools to manage your Supabase data effortlessly.
Supabase MCP is a Next.js-powered MCP server that bridges the gap between AI assistants and Supabase databases. It exposes a set of standardized tools that enable AI models to perform database operations through the Model Context Protocol, making it easy to build AI-powered applications with persistent data storage.
The project features a beautiful landing page showcasing the available tools and provides a production-ready MCP server endpoint that can be integrated with Claude Desktop, AI agents, or any MCP-compatible client.
- π MCP Server Integration - Full Model Context Protocol server implementation with SSE and HTTP transport support
- π Complete CRUD Operations - Create, Read, Update, Delete operations for Supabase tables
- π― Type-Safe - Built with TypeScript and Zod validation for robust type safety
- β‘ Real-time Ready - Powered by Supabase's real-time capabilities
- π¨ Modern UI - Beautiful, responsive landing page with animated components
- π Secure - Environment-based configuration with Supabase Row Level Security support
- π Production Ready - Optimized Next.js build with error handling and validation
The MCP server provides 6 powerful tools for database operations:
Add new products to your inventory with comprehensive validation for title, price, category, and quantity. Automatically validates data types and constraints before insertion.
Retrieve all products from the database with optional filtering by any column.
Find specific products by any column (ID, title, price, category, etc.) with exact value matching.
Modify existing product details with flexible JSON-based updates. Supports partial updates of any field.
Create or update records intelligently based on primary key (ID). Perfect for bulk operations and synchronization tasks.
Safely remove products from the inventory with existence verification before deletion.
- Next.js 16 - React framework with App Router
- React 19 - Latest React with React Compiler
- TypeScript - Type-safe development
- Tailwind CSS 4 - Utility-first CSS framework
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icon library
- Supabase - PostgreSQL database with real-time capabilities
- @supabase/supabase-js - Supabase client library
- MCP SDK - Model Context Protocol implementation
- mcp-handler - MCP server handler for Next.js
- Zod - TypeScript-first schema validation
- clsx - Conditional className utility
- tailwind-merge - Merge Tailwind classes
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript - Static type checking
- Node.js 18+ and npm/yarn/pnpm
- A Supabase account and project (Create one here)
-
Clone the repository
git clone https://github.com/xwaleedahmad/supabase-mcp.git cd supabase-mcp -
Install dependencies
npm install # or yarn install # or pnpm install
-
Set up environment variables
Create a
.env.localfile in the root directory:NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key NEXT_PUBLIC_SERVER_URL=http://localhost:3000/mcp (to connect the mcp with AI Assistants)
Get your Supabase credentials from:
- Go to Supabase Dashboard
- Select your project
- Navigate to Settings β API
- Copy the Project URL and anon/public key
-
Run the development server
npm run dev # or yarn dev # or pnpm dev
-
Open your browser
Navigate to http://localhost:3000 to see the landing page.
Create the following table in your Supabase database:
CREATE TABLE "Products" (
"id" UUID DEFAULT gen_random_uuid() PRIMARY KEY,
"title" TEXT NOT NULL,
"price" NUMERIC NOT NULL CHECK (price > 0),
"category" TEXT NOT NULL,
"quantity" INTEGER DEFAULT 1 CHECK (quantity >= 0),
"created_at" TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);Run this SQL in your Supabase SQL Editor:
- Go to your Supabase Dashboard
- Navigate to SQL Editor
- Click New Query
- Paste the SQL above and click Run
supabase-mcp/
βββ public/ # Static assets
βββ src/
β βββ app/
β β βββ [transport]/
β β β βββ route.ts # MCP server endpoint (SSE/HTTP)
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β βββ globals.css # Global styles
β βββ components/
β β βββ ui/ # Reusable UI components
β β β βββ badge.tsx
β β β βββ button.tsx
β β β βββ card.tsx
β β βββ AnimatedBackground.tsx
β β βββ Footer.tsx
β β βββ Header.tsx
β β βββ Hero.tsx
β β βββ ToolsShowcase.tsx
β β βββ VideoShowcase.tsx
β βββ lib/
β βββ utils.ts # Utility functions
β βββ supabase/
β βββ server.ts # Supabase client configuration
βββ .env.local # Environment variables (create this)
βββ components.json # shadcn/ui configuration
βββ next.config.ts # Next.js configuration
βββ package.json # Dependencies
βββ postcss.config.mjs # PostCSS configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
Configuration:
{
"mcpServers": {
"supabase-mcp": {
"url": "http://localhost:3000/mcp"
}
}
}For production:
{
"mcpServers": {
"supabase-mcp": {
"url": "https://your-production-domain.com/mcp"
}
}
}- SSE:
http://localhost:3000/sse - HTTP:
http://localhost:3000/mcp
Once configured with an MCP client, you can interact with your database using natural language:
"Add a new laptop to the inventory priced at $999 in the Electronics category"
β Uses create_document tool
"Show me all products in the Electronics category"
β Uses list_documents tool with filtering
"Find the product with ID abc-123"
β Uses get_document tool
"Update the price of product with ID abc-123 to $899"
β Uses update_document tool
"Upsert a product with ID xyz-456, title 'Gaming Mouse', price $59.99, category 'Electronics', quantity 25"
β Uses upsert_document tool
"Delete the product with title 'Old Laptop'"
β Uses delete_document tool
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables in Vercel dashboard
- Deploy!
Ensure these are set in your deployment platform:
NEXT_PUBLIC_SUPABASE_URL=your_production_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_production_anon_keyContributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
Waleed Ahmad
- π» GitHub: @xwaleedahmad
- π¦ Twitter/X: @xwaleedahmad
- π§ Email: waleedgondal57@gmail.com
- Model Context Protocol - For the amazing protocol
- Supabase - For the powerful backend platform
- Next.js - For the incredible React framework
- Vercel - For seamless deployment
Built with β€οΈ using Model Context Protocol and Supabase