Supabase MCP Server
Enables AI assistants to interact with Supabase databases through standardized CRUD operations including querying, inserting, updating, and deleting records with support for filtering, pagination, and column selection.
README
Supabase MCP Server
A Model Context Protocol (MCP) server that provides tools for interacting with a Supabase database. This server enables AI assistants to perform database operations through a standardized interface.
NOTE: This Supabase MCP server was created as a demonstration of my AI IDE coding workflow. It is still a work in progress which I will expand on in future videos on my channel.
Features
- Read Table Rows: Query data from Supabase tables with optional filtering, pagination, and column selection
- Create Table Records: Insert new records into Supabase tables
- Update Table Records: Modify existing records in Supabase tables based on filters
- Delete Table Records: Remove records from Supabase tables based on filters
Prerequisites
- Docker or Docker Desktop
- Supabase account and project
Installation
- Clone the repository:
git clone https://github.com/coleam00/supabase-mcp.git cd supabase-mcp
Docker Setup
- Build the Docker image:
docker build -t mcp/supabase .
Usage
Running as an MCP Server with Docker
The Supabase MCP server can be integrated with AI assistants using the Model Context Protocol.
- Include the below configuration in your MCP config (in Claude Desktop, Windsurf, etc.)
Be sure to build the container with the installation steps first!
{
"mcpServers": {
"supabase": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SUPABASE_URL", "-e", "SUPABASE_SERVICE_KEY", "mcp/supabase"],
"env": {
"SUPABASE_URL": "YOUR-SUPABASE-URL",
"SUPABASE_SERVICE_KEY": "YOUR-SUPABASE-SERVICE-ROLE-KEY"
}
}
}
}
-
Replace
YOUR-SUPABASE-URLandYOUR-SUPABASE-SERVICE-ROLE-KEYwith your actual Supabase credentials. -
The AI assistant can now access the Supabase database through the MCP server using the provided tools.
For more information on the Model Context Protocol, visit modelcontextprotocol.io.
Available Tools
Read Table Rows
read_table_rows(
table_name: str,
columns: Optional[List[str]] = None,
filters: Optional[Dict[str, Any]] = None,
limit: Optional[int] = None,
offset: Optional[int] = None
)
Example:
# Read active users
read_table_rows(
table_name="users",
columns=["id", "name", "email"],
filters={"is_active": True},
limit=10,
offset=0
)
Create Table Records
create_table_records(
table_name: str,
records: Union[Dict[str, Any], List[Dict[str, Any]]]
)
Example:
# Create a new user
create_table_records(
table_name="users",
records={
"name": "John Doe",
"email": "john@example.com",
"is_active": True
}
)
Update Table Records
update_table_records(
table_name: str,
updates: Dict[str, Any],
filters: Dict[str, Any]
)
Example:
# Update user status
update_table_records(
table_name="users",
updates={"status": "premium"},
filters={"is_active": True}
)
Delete Table Records
delete_table_records(
table_name: str,
filters: Dict[str, Any]
)
Example:
# Delete inactive users
delete_table_records(
table_name="users",
filters={"is_active": False}
)
Development
Project Structure
supabase-mcp/
├── supabase_mcp/
│ ├── __init__.py
│ ├── server.py # Main MCP server implementation
│ └── tests/ # Unit tests
├── Dockerfile # Docker configuration for MCP server
├── example_mcp_config.json # Example MCP configuration
├── requirements.txt # Python dependencies
├── .env.example # Example environment variables
├── README.md # Project documentation
├── PLANNING.md # Project planning
└── TASKS.md # Task tracking
Running Tests
pytest supabase_mcp/tests/
Model Context Protocol Integration
The Supabase MCP server implements the Model Context Protocol, which allows AI assistants to interact with Supabase databases in a standardized way.
How It Works
- The MCP server exposes tools for database operations (read, create, update, delete)
- AI assistants connect to the MCP server using the stdio transport
- The AI assistant can invoke the tools to perform database operations
- The MCP server handles the communication with Supabase and returns the results
MCP Configuration
The example_mcp_config.json file shows how to configure an AI assistant to use the Supabase MCP server:
{
"mcpServers": {
"supabase": {
"command": "docker",
"args": ["run", "--rm", "-i", "-e", "SUPABASE_URL", "-e", "SUPABASE_SERVICE_KEY", "mcp/supabase"],
"env": {
"SUPABASE_URL": "YOUR-SUPABASE-URL",
"SUPABASE_SERVICE_KEY": "YOUR-SUPABASE-SERVICE-ROLE-KEY"
}
}
}
}
This configuration tells the AI assistant:
- To use Docker to run the MCP server
- To pass the Supabase credentials as environment variables
- To use the
mcp/supabaseDocker image
Using with AI Assistants
AI assistants that support the Model Context Protocol can use this server to:
- Query data from Supabase tables
- Insert new records into tables
- Update existing records
- Delete records
The assistant will have access to the tools documented in the "Available Tools" section above.
Environment Variables
| Variable | Description |
|---|---|
SUPABASE_URL |
URL of your Supabase project |
SUPABASE_SERVICE_KEY |
Service role key for Supabase authentication |
License
This project is licensed under the MIT License - see the LICENSE file for details.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。