mcp-supabase-tools
v1.0.1
Published
MCP server for Supabase — query tables, manage auth users, check storage, run SQL from Claude.
Maintainers
Readme
mcp-supabase-tools
MCP server that connects Claude to your Supabase project. Query tables, manage auth users, inspect storage buckets, and run SQL -- all from Claude.
Built by THRYXAGI.
Install
npx -y mcp-supabase-toolsOr install globally:
npm install -g mcp-supabase-toolsClaude Desktop config
Add to your claude_desktop_config.json:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": ["-y", "mcp-supabase-tools"],
"env": {
"SUPABASE_URL": "https://your-project.supabase.co",
"SUPABASE_SERVICE_KEY": "your-service-role-key"
}
}
}
}Environment Variables
| Variable | Required | Description |
|----------|----------|-------------|
| SUPABASE_URL | Yes | Your Supabase project URL (e.g. https://abc123.supabase.co) |
| SUPABASE_SERVICE_KEY | Yes | Service role key (not the anon key). Found in Project Settings > API. |
Tools
query_table
Select rows from any table with optional filters, ordering, and limits.
- table (string, required) -- Table name
- select (string, default
"*") -- Column selection - filters (array, optional) -- Array of
{column, operator, value}objects. Operators:eq,neq,gt,gte,lt,lte,like,ilike,is,in - limit (number, default 100) -- Max rows to return
- order_by (string, optional) -- Column to order by
- ascending (boolean, default true) -- Sort direction
insert_rows
Insert one or more rows into a table.
- table (string, required) -- Table name
- rows (array, required) -- Array of row objects to insert
update_rows
Update rows matching filter conditions.
- table (string, required) -- Table name
- values (object, required) -- Key-value pairs to update
- filters (array, required) -- Array of
{column, operator, value}to match rows
delete_rows
Delete rows matching filter conditions.
- table (string, required) -- Table name
- filters (array, required) -- Array of
{column, operator, value}to match rows
run_sql
Execute raw SQL against your database.
- query (string, required) -- SQL query to execute
Setup required: Create a Postgres function in your Supabase SQL Editor:
CREATE OR REPLACE FUNCTION exec_sql(query text)
RETURNS json
LANGUAGE plpgsql
SECURITY DEFINER
AS $$
DECLARE
result json;
BEGIN
EXECUTE query INTO result;
RETURN result;
EXCEPTION WHEN OTHERS THEN
RETURN json_build_object('error', SQLERRM);
END;
$$;list_tables
List all tables in the public schema. No parameters.
Requires the exec_sql function above.
get_auth_users
List authentication users (requires service role key).
- limit (number, default 50) -- Max users to return
get_storage_buckets
List all storage buckets. No parameters.
Security Notes
- Use the service role key, not the anon key. The service role key bypasses Row Level Security, so treat it like a database password.
- Never commit your service key to version control. Use environment variables.
- The
run_sqltool uses aSECURITY DEFINERfunction, meaning it runs with the privileges of the function creator. Only create this function if you trust the agents using this MCP server. - For read-only access, modify the
exec_sqlfunction to reject write operations, or omit therun_sql/insert_rows/update_rows/delete_rowstools.
License
MIT
