
supabase mcp
通过 MCP 协议连接 LLMs 和 Supabase 数据库的 Python 服务。
Repository Info
About This Server
通过 MCP 协议连接 LLMs 和 Supabase 数据库的 Python 服务。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Supabase MCP Server
MCP (Model Context Protocol) server kết nối LLMs như Claude với cơ sở dữ liệu Supabase. Server này cung cấp các công cụ để LLMs có thể truy vấn và quản lý dữ liệu trong Supabase thông qua giao thức MCP.
Tính năng
- Kết nối với Supabase thông qua Python SDK
- Đọc dữ liệu từ bảng với bộ lọc và sắp xếp linh hoạt
- Tạo bản ghi mới trong bảng
- Cập nhật bản ghi đã tồn tại
- Xóa bản ghi theo bộ lọc
- Sử dụng StdioTransport cho tích hợp MCP dễ dàng
Cài đặt
Yêu cầu
- Python 3.10+
- Supabase project với PostgreSQL
- Supabase Service Role Key
Thiết lập môi trường
- Clone repository:
git clone <repository-url>
cd supabase-mcp-server
- Tạo và kích hoạt môi trường ảo:
python -m venv venv
# Linux/macOS
source venv/bin/activate
# Windows
venv\Scripts\activate
- Cài đặt dependencies:
pip install -r requirements.txt
- Thiết lập biến môi trường:
Tạo file .env trong thư mục gốc và thêm các biến sau:
SUPABASE_URL=your_supabase_project_url
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
Thiết lập Supabase
- Đăng nhập vào Supabase Dashboard
- Vào SQL Editor
- Thực thi script trong
src/supabase_mcp/setup/create_read_only_function.sqlđể tạo function thực thi truy vấn read-only
Sử dụng
Chạy MCP Server
python -m src.supabase_mcp.server
Kết nối với Claude hoặc các MCP clients khác
Cấu hình Cursor với Supabase MCP Server:
- Tạo thư mục
.cursortrong dự án nếu chưa có - Tạo file
.cursor/mcp.jsonvới nội dung:
{
"mcpServers": {
"supabase": {
"command": "python",
"args": ["-m", "src.supabase_mcp.server"]
}
}
}
- Mở Cursor và vào Settings/MCP để kiểm tra kết nối
Các công cụ có sẵn
Database Tools
-
read_rows: Đọc dữ liệu từ bảng với các bộ lọc tùy chọn, giới hạn số lượng và sắp xếp.
- Các tham số: table_name, columns, filters, limit, order_by
-
create_records: Tạo một hoặc nhiều bản ghi mới trong bảng.
- Các tham số: table_name, data
-
update_records: Cập nhật một hoặc nhiều bản ghi trong bảng dựa trên bộ lọc.
- Các tham số: table_name, data, filters
-
delete_records: Xóa một hoặc nhiều bản ghi từ bảng dựa trên bộ lọc.
- Các tham số: table_name, filters
Ví dụ sử dụng
Đọc dữ liệu từ bảng
Cho tôi biết 10 người dùng mới nhất trong hệ thống.
Claude sẽ sử dụng công cụ read_rows với:
- table_name: "users"
- limit: 10
- order_by: {"created_at": "desc"}
Tạo bản ghi mới
Tạo một sản phẩm mới có tên "Smartphone XYZ", giá 999.99 và thuộc danh mục "Electronics".
Claude sẽ sử dụng công cụ create_records với:
- table_name: "products"
- data: {"name": "Smartphone XYZ", "price": 999.99, "category": "Electronics"}
Bảo mật
- Server này sử dụng Service Role Key nên có toàn quyền với dự án Supabase
- Cẩn thận khi thiết lập quyền truy cập và sử dụng MCP server
- Chỉ sử dụng trong môi trường tin cậy
- Nên triển khai các biện pháp xác thực và phân quyền bổ sung trong môi trường sản xuất
Đóng góp
Đóng góp và báo lỗi luôn được chào đón! Vui lòng gửi pull request hoặc tạo issue trên GitHub.
Giấy phép
MIT
Quick Start
Clone the repository
git clone https://github.com/tuyentran4992/supabase-mcpInstall dependencies
cd supabase-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.