Supabase

supabase

by byungkyu

|

4.5k数据与存储未扫描2026年4月6日

安装

claude skill add --url https://github.com/openclaw/skills

文档

Supabase

Access the Supabase API with managed authentication. Query database tables via PostgREST, manage auth users, and handle storage buckets.

Quick Start

bash
# List storage buckets
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/supabase/storage/v1/bucket')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Base URL

code
https://gateway.maton.ai/supabase/{service}/{native-api-path}

The gateway proxies requests to your connected Supabase project. Services include:

  • rest/v1 - PostgREST API (database tables)
  • auth/v1 - GoTrue authentication API
  • storage/v1 - Storage API

Authentication

All requests require the Maton API key in the Authorization header:

code
Authorization: Bearer $MATON_API_KEY

Environment Variable: Set your API key as MATON_API_KEY:

bash
export MATON_API_KEY="YOUR_API_KEY"

Getting Your API Key

  1. Sign in or create an account at maton.ai
  2. Go to maton.ai/settings
  3. Copy your API key

Connection Management

Manage your Supabase connections at https://ctrl.maton.ai.

List Connections

bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections?app=supabase&status=ACTIVE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Create Connection

bash
python <<'EOF'
import urllib.request, os, json
data = json.dumps({'app': 'supabase'}).encode()
req = urllib.request.Request('https://ctrl.maton.ai/connections', data=data, method='POST')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Content-Type', 'application/json')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Get Connection

bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Response:

json
{
  "connection": {
    "connection_id": "c22a6ea6-4cf6-42a0-9e1c-d81ca8d6fc7e",
    "status": "ACTIVE",
    "creation_time": "2026-03-29T22:47:35.570344Z",
    "last_updated_time": "2026-03-29T22:48:23.435225Z",
    "url": "https://connect.maton.ai/?session_token=...",
    "app": "supabase",
    "metadata": {}
  }
}

Open the returned url in a browser to complete authentication setup.

Delete Connection

bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://ctrl.maton.ai/connections/{connection_id}', method='DELETE')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

Specifying Connection

If you have multiple Supabase connections, specify which one to use with the Maton-Connection header:

bash
python <<'EOF'
import urllib.request, os, json
req = urllib.request.Request('https://gateway.maton.ai/supabase/storage/v1/bucket')
req.add_header('Authorization', f'Bearer {os.environ["MATON_API_KEY"]}')
req.add_header('Maton-Connection', 'c22a6ea6-4cf6-42a0-9e1c-d81ca8d6fc7e')
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF

If omitted, the gateway uses the default (oldest) active connection.

API Reference

Database (PostgREST)

The PostgREST API auto-generates endpoints based on your database schema. Access tables and views in the public schema.

Get OpenAPI Schema

bash
GET /supabase/rest/v1/

Returns the OpenAPI specification describing all available tables and endpoints.

List Records from Table

bash
GET /supabase/rest/v1/{table_name}

Query Parameters:

  • select - Columns to return (e.g., select=id,name,email)
  • order - Sort order (e.g., order=created_at.desc)
  • limit - Maximum records to return
  • offset - Number of records to skip

Example:

bash
GET /supabase/rest/v1/users?select=id,email&order=created_at.desc&limit=10

Get Single Record

bash
GET /supabase/rest/v1/{table_name}?id=eq.{id}&select=*

Insert Records

bash
POST /supabase/rest/v1/{table_name}
Content-Type: application/json
Prefer: return=representation

{
  "name": "John Doe",
  "email": "john@example.com"
}

Update Records

bash
PATCH /supabase/rest/v1/{table_name}?id=eq.{id}
Content-Type: application/json
Prefer: return=representation

{
  "name": "Jane Doe"
}

Delete Records

bash
DELETE /supabase/rest/v1/{table_name}?id=eq.{id}

Filtering Operators

OperatorMeaningExample
eqEquals?status=eq.active
neqNot equals?status=neq.deleted
gtGreater than?age=gt.18
gteGreater than or equal?age=gte.18
ltLess than?age=lt.65
lteLess than or equal?age=lte.65
likePattern match?name=like.*john*
ilikeCase-insensitive pattern?name=ilike.*john*
inIn list?status=in.(active,pending)
isIs null/true/false?deleted_at=is.null

Auth (GoTrue)

Get Auth Health

bash
GET /supabase/auth/v1/health

Response:

json
{
  "version": "v2.188.1",
  "name": "GoTrue",
  "description": "GoTrue is a user registration and authentication API"
}

Get Auth Settings

bash
GET /supabase/auth/v1/settings

Response:

json
{
  "external": {
    "email": true,
    "phone": false,
    "google": false,
    "github": false
  },
  "disable_signup": false,
  "mailer_autoconfirm": false
}

List Users (Admin)

bash
GET /supabase/auth/v1/admin/users

Response:

json
{
  "users": [
    {
      "id": "8974a9fa-95c4-4839-8d50-76f4666d2113",
      "email": "user@example.com",
      "email_confirmed_at": "2026-03-29T23:01:46.718322Z",
      "created_at": "2026-03-29T23:01:46.689584Z"
    }
  ],
  "aud": "authenticated"
}

Get User (Admin)

bash
GET /supabase/auth/v1/admin/users/{user_id}

Create User (Admin)

bash
POST /supabase/auth/v1/admin/users
Content-Type: application/json

{
  "email": "newuser@example.com",
  "password": "securepassword123",
  "email_confirm": true
}

Response:

json
{
  "id": "8974a9fa-95c4-4839-8d50-76f4666d2113",
  "email": "newuser@example.com",
  "email_confirmed_at": "2026-03-29T23:01:46.718322Z",
  "role": "authenticated",
  "app_metadata": {
    "provider": "email",
    "providers": ["email"]
  }
}

Update User (Admin)

bash
PUT /supabase/auth/v1/admin/users/{user_id}
Content-Type: application/json

{
  "email": "updated@example.com",
  "user_metadata": {
    "name": "Updated Name"
  }
}

Delete User (Admin)

bash
DELETE /supabase/auth/v1/admin/users/{user_id}

Storage

List Buckets

bash
GET /supabase/storage/v1/bucket

Response:

json
[
  {
    "id": "avatars",
    "name": "avatars",
    "public": true,
    "created_at": "2026-03-29T23:01:06.638Z",
    "updated_at": "2026-03-29T23:01:06.638Z"
  }
]

Get Bucket

bash
GET /supabase/storage/v1/bucket/{bucket_id}

Create Bucket

bash
POST /supabase/storage/v1/bucket
Content-Type: application/json

{
  "id": "documents",
  "name": "documents",
  "public": false,
  "file_size_limit": 10485760,
  "allowed_mime_types": ["application/pdf", "image/png"]
}

Update Bucket

bash
PUT /supabase/storage/v1/bucket/{bucket_id}
Content-Type: application/json

{
  "public": true
}

Delete Bucket

bash
DELETE /supabase/storage/v1/bucket/{bucket_id}

List Objects in Bucket

bash
POST /supabase/storage/v1/object/list/{bucket_id}
Content-Type: application/json

{
  "prefix": "",
  "limit": 100,
  "offset": 0
}

Upload Object

bash
POST /supabase/storage/v1/object/{bucket_id}/{path}
Content-Type: {mime_type}

{binary_data}

Download Object

bash
GET /supabase/storage/v1/object/{bucket_id}/{path}

Delete Object

bash
DELETE /supabase/storage/v1/object/{bucket_id}/{path}

Pagination

PostgREST Pagination

Use limit and offset query parameters:

bash
GET /supabase/rest/v1/users?limit=10&offset=20

Use the Range header for range-based pagination:

bash
GET /supabase/rest/v1/users
Range: 0-9

Auth User Pagination

bash
GET /supabase/auth/v1/admin/users?page=1&per_page=50

Code Examples

JavaScript

javascript
// List storage buckets
const response = await fetch(
  'https://gateway.maton.ai/supabase/storage/v1/bucket',
  {
    headers: {
      'Authorization': `Bearer ${process.env.MATON_API_KEY}`
    }
  }
);
const buckets = await response.json();

Python

python
import os
import requests

# Query database table
response = requests.get(
    'https://gateway.maton.ai/supabase/rest/v1/users',
    headers={'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}'},
    params={'select': 'id,email', 'limit': 10}
)
users = response.json()

Create User and Storage Bucket

python
import os
import requests

headers = {
    'Authorization': f'Bearer {os.environ["MATON_API_KEY"]}',
    'Content-Type': 'application/json'
}

# Create auth user
user_resp = requests.post(
    'https://gateway.maton.ai/supabase/auth/v1/admin/users',
    headers=headers,
    json={
        'email': 'test@example.com',
        'password': 'securepass123',
        'email_confirm': True
    }
)
user = user_resp.json()

# Create storage bucket
bucket_resp = requests.post(
    'https://gateway.maton.ai/supabase/storage/v1/bucket',
    headers=headers,
    json={
        'id': 'user-uploads',
        'name': 'user-uploads',
        'public': False
    }
)
bucket = bucket_resp.json()

Notes

  • The connection routes to a specific Supabase project configured during setup
  • PostgREST endpoints are auto-generated from your database schema
  • Use Prefer: return=representation header to get created/updated records back
  • Storage bucket names must be unique within the project
  • Auth admin endpoints require service role permissions
  • Database queries support complex filtering, ordering, and joins via PostgREST syntax
  • IMPORTANT: When using curl commands, use curl -g when URLs contain brackets or special characters
  • IMPORTANT: When piping curl output to jq, environment variables may not expand correctly in some shells

Error Handling

StatusMeaning
400Missing Supabase connection or invalid request
401Invalid or missing Maton API key
404Table or resource not found
409Conflict (e.g., duplicate bucket name)
429Rate limited
4xx/5xxPassthrough error from Supabase API

PostgREST Errors

json
{
  "code": "PGRST205",
  "details": null,
  "hint": null,
  "message": "Could not find the table 'public.users' in the schema cache"
}

Resources

相关 Skills

资深架构师

by alirezarezvani

Universal
热门

适合系统设计评审、ADR记录和扩展性规划,分析依赖与耦合,权衡单体或微服务、数据库与技术栈选型,并输出Mermaid、PlantUML、ASCII架构图。

搞系统设计、技术选型和扩展规划时,用它能更快理清架构决策与依赖关系,还能直接产出 Mermaid/PlantUML 图,方案讨论效率很高。

数据与存储
未扫描23.1k

技术栈评估

by alirezarezvani

Universal
热门

对比框架、数据库和云服务,结合 5 年 TCO、安全风险、生态活力与迁移复杂度做量化评估,适合技术选型、栈升级和替换路线决策。

帮你系统比较技术栈优劣,不只看功能,还把TCO、安全性和生态健康度一起量化,选型和迁移决策更稳。

数据与存储
未扫描23.1k

资深数据科学家

by alirezarezvani

Universal
热门

覆盖实验设计、特征工程、预测建模、因果推断与模型评估,适合用 Python/R/SQL 做 A/B 测试、时序分析和生产级 ML 落地,支撑数据驱动决策。

从 A/B 测试、因果分析到预测建模一条龙搞定,既有硬核统计方法也懂业务沟通,特别适合把数据结论真正落地。

数据与存储
未扫描23.1k

相关 MCP 服务

by Anthropic

热门

PostgreSQL 是让 Claude 直接查询和管理你的数据库的 MCP 服务器。

这个服务器解决了开发者需要手动编写 SQL 查询的痛点,特别适合数据分析师或后端开发者快速探索数据库结构。不过,由于是参考实现,生产环境使用前务必评估安全风险,别指望它能处理复杂事务。

数据与存储
88.8k

SQLite 数据库

编辑精选

by Anthropic

热门

SQLite 是让 AI 直接查询本地数据库进行数据分析的 MCP 服务器。

这个服务器解决了 AI 无法直接访问 SQLite 数据库的问题,适合需要快速分析本地数据集的开发者。不过,作为参考实现,它可能缺乏生产级的安全特性,建议在受控环境中使用。

数据与存储
88.1k

by Firecrawl

热门

Firecrawl 是让 AI 直接抓取网页并提取结构化数据的 MCP 服务器。

它解决了手动写爬虫的麻烦,让 Claude 能直接访问动态网页内容。最适合需要实时数据的研究者或开发者,比如监控竞品价格或抓取新闻。但要注意,它依赖第三方 API,可能涉及隐私和成本问题。

数据与存储
6.8k

评论