-
Notifications
You must be signed in to change notification settings - Fork 140
feat: add supabase local mcp #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
486d190
Add Supabase‑Aidap MCP server with uvx entry
sjcsjcsjc 9e29d34
Update pyproject.toml with uvx script entry and package path
sjcsjcsjc f5ff80b
chore(supabase): switch volcengine sdk to github source
sjcsjcsjc 3726e92
fix(supabase): support aidap workspace filter signature variants
sjcsjcsjc c0b0630
fix:注册所有工具
sjcsjcsjc 46ae768
fix:注册所有工具
sjcsjcsjc 3aa9c50
fix:注册所有工具
sjcsjcsjc 5886b27
fix:注册所有工具
sjcsjcsjc e5e606b
fix:注册所有工具
sjcsjcsjc 4c76f3e
fix:注册所有工具
sjcsjcsjc f555508
fix:注册所有工具
sjcsjcsjc 7b4fbbf
fix:注册所有工具
sjcsjcsjc 7399970
fix:注册所有工具
sjcsjcsjc c5cd994
fix:注优化备份工单
sjcsjcsjc 8c2fb07
fix:注优化备份工单
sjcsjcsjc 69c8182
fix:注优化备份工单
sjcsjcsjc 7cbcb38
fix:supbase
sjcsjcsjc 03d26cb
fix:supbase
sjcsjcsjc 5f383db
fix:supbase
sjcsjcsjc e5c2fcd
fix:supbase
sjcsjcsjc 8c990ae
fix:supbase
sjcsjcsjc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| # Supabase MCP Server | ||
|
|
||
| English | [简体中文](README_zh.md) | ||
|
|
||
| > Supabase MCP server for AIDAP workspaces. It exposes workspace, branch, database, Edge Functions, storage, and TypeScript type generation capabilities through MCP. | ||
|
|
||
| | Item | Details | | ||
| | ---- | ---- | | ||
| | Version | v0.1.0 | | ||
| | Description | Supabase MCP server built on top of AIDAP workspaces | | ||
| | Category | Database / Developer Tools | | ||
| | Tags | Supabase, PostgreSQL, Edge Functions, Storage, AIDAP | | ||
|
|
||
| ## Tools | ||
|
|
||
| ### Workspace and Branch | ||
|
|
||
| | Tool | Description | | ||
| | ---- | ---- | | ||
| | `list_workspaces` | List all available Supabase workspaces in the current account | | ||
| | `get_workspace` | Get workspace details; branch IDs are also accepted | | ||
| | `create_workspace` | Create a new Supabase workspace | | ||
| | `pause_workspace` | Pause a workspace | | ||
| | `restore_workspace` | Resume a paused workspace | | ||
| | `get_workspace_url` | Get the API endpoint for a workspace or branch | | ||
| | `get_publishable_keys` | Get publishable, anon, and service role keys | | ||
| | `list_branches` | List branches under a workspace | | ||
| | `create_branch` | Create a development branch | | ||
| | `delete_branch` | Delete a development branch | | ||
| | `reset_branch` | Reset a branch to its baseline state | | ||
|
|
||
| ### Database | ||
|
|
||
| | Tool | Description | | ||
| | ---- | ---- | | ||
| | `execute_sql` | Execute raw SQL against the Postgres database | | ||
| | `list_tables` | List tables in one or more schemas | | ||
| | `list_migrations` | List records from `supabase_migrations.schema_migrations` | | ||
| | `list_extensions` | List installed PostgreSQL extensions | | ||
| | `apply_migration` | Run migration SQL and record it in `supabase_migrations.schema_migrations` | | ||
| | `generate_typescript_types` | Generate TypeScript definitions from schema metadata | | ||
|
|
||
| ### Edge Functions | ||
|
|
||
| | Tool | Description | | ||
| | ---- | ---- | | ||
| | `list_edge_functions` | List Edge Functions in a workspace or branch | | ||
| | `get_edge_function` | Get the source code and configuration of an Edge Function | | ||
| | `deploy_edge_function` | Create or update an Edge Function | | ||
| | `delete_edge_function` | Delete an Edge Function | | ||
|
|
||
| ### Storage | ||
|
|
||
| | Tool | Description | | ||
| | ---- | ---- | | ||
| | `list_storage_buckets` | List storage buckets | | ||
| | `create_storage_bucket` | Create a new storage bucket | | ||
| | `delete_storage_bucket` | Delete a storage bucket | | ||
| | `get_storage_config` | Get storage configuration | | ||
|
|
||
| ## Authentication | ||
|
|
||
| Use Volcengine AK/SK authentication. Obtain your credentials from the [Volcengine API Access Key console](https://console.volcengine.com/iam/keymanage/). | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| | Name | Required | Default | Description | | ||
| | ---- | ---- | ---- | ---- | | ||
| | `VOLCENGINE_ACCESS_KEY` | Yes | - | Volcengine access key | | ||
| | `VOLCENGINE_SECRET_KEY` | Yes | - | Volcengine secret key | | ||
| | `VOLCENGINE_REGION` | No | `cn-beijing` | Region used for the AIDAP API | | ||
| | `DEFAULT_WORKSPACE_ID` | No | - | Default target used when `workspace_id` is omitted | | ||
| | `READ_ONLY` | No | `false` | Set to `true` to block all mutating tools | | ||
| | `SUPABASE_WORKSPACE_SLUG` | No | `default` | Project slug used by Edge Functions APIs | | ||
| | `SUPABASE_ENDPOINT_SCHEME` | No | `http` | Endpoint scheme used when building workspace URLs | | ||
| | `PORT` | No | `8000` | Port used when running the server directly | | ||
|
|
||
| ## Deployment | ||
|
|
||
| ### Run from a local checkout | ||
|
|
||
| ```bash | ||
| uv --directory /ABSOLUTE/PATH/TO/mcp-server/server/mcp_server_supabase run mcp-server-supabase | ||
| ``` | ||
|
|
||
| ### MCP client config with local source | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "supabase": { | ||
| "command": "uv", | ||
| "args": [ | ||
| "--directory", | ||
| "/ABSOLUTE/PATH/TO/mcp-server/server/mcp_server_supabase", | ||
| "run", | ||
| "mcp-server-supabase" | ||
| ], | ||
| "env": { | ||
| "VOLCENGINE_ACCESS_KEY": "<your-access-key>", | ||
| "VOLCENGINE_SECRET_KEY": "<your-secret-key>", | ||
| "VOLCENGINE_REGION": "cn-beijing", | ||
| "DEFAULT_WORKSPACE_ID": "ws-xxxxxxxx" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### MCP client config with `uvx` | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "supabase": { | ||
| "command": "uvx", | ||
| "args": [ | ||
| "--from", | ||
| "git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_supabase", | ||
| "mcp-server-supabase" | ||
| ], | ||
| "env": { | ||
| "VOLCENGINE_ACCESS_KEY": "<your-access-key>", | ||
| "VOLCENGINE_SECRET_KEY": "<your-secret-key>", | ||
| "VOLCENGINE_REGION": "cn-beijing", | ||
| "DEFAULT_WORKSPACE_ID": "ws-xxxxxxxx" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Direct Python entrypoint | ||
|
|
||
| ```bash | ||
| python3 -m mcp_server_supabase.server --port 8000 | ||
| ``` | ||
|
|
||
| The package exposes both `mcp-server-supabase` and `supabase-aidap`. The examples above use `mcp-server-supabase`. | ||
|
|
||
| ## Usage Notes | ||
|
|
||
| - If `workspace_id` is omitted, the server falls back to `DEFAULT_WORKSPACE_ID` when configured. | ||
| - If a branch ID such as `br-xxxx` is provided, the server resolves the corresponding workspace automatically. | ||
| - `get_publishable_keys` resolves the default branch automatically when needed. | ||
| - `reset_branch` accepts `migration_version`, but the current AIDAP API ignores that value and performs a branch reset only. | ||
| - `deploy_edge_function` currently supports `native-node20/v1`, `native-python3.9/v1`, `native-python3.10/v1`, and `native-python3.12/v1`. | ||
|
|
||
| ## Compatible Clients | ||
|
|
||
| - Cursor | ||
| - Claude Desktop | ||
| - Cline | ||
| - Trae | ||
| - Any MCP client that supports `stdio` | ||
|
|
||
| ## License | ||
|
|
||
| volcengine/mcp-server is licensed under the [MIT License](https://github.com/volcengine/mcp-server/blob/main/LICENSE). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| # Supabase MCP Server | ||
|
|
||
| [English](README.md) | 简体中文 | ||
|
|
||
| > 面向 AIDAP workspace 的 Supabase MCP Server,通过 MCP 暴露工作区、分支、数据库、Edge Functions、Storage 和 TypeScript 类型生成能力。 | ||
|
|
||
| | 项目 | 详情 | | ||
| | ---- | ---- | | ||
| | 版本 | v0.1.0 | | ||
| | 描述 | 基于 AIDAP workspace 的 Supabase MCP Server | | ||
| | 分类 | 数据库 / 开发工具 | | ||
| | 标签 | Supabase, PostgreSQL, Edge Functions, Storage, AIDAP | | ||
|
|
||
| ## 工具列表 | ||
|
|
||
| ### 工作区与分支 | ||
|
|
||
| | 工具 | 说明 | | ||
| | ---- | ---- | | ||
| | `list_workspaces` | 列出当前账号下可访问的 Supabase workspace | | ||
| | `get_workspace` | 查询 workspace 详情,也支持直接传 branch ID | | ||
| | `create_workspace` | 创建新的 Supabase workspace | | ||
| | `pause_workspace` | 暂停 workspace | | ||
| | `restore_workspace` | 恢复已暂停的 workspace | | ||
| | `get_workspace_url` | 获取 workspace 或 branch 的 API 地址 | | ||
| | `get_publishable_keys` | 获取 publishable、anon、service_role 等密钥 | | ||
| | `list_branches` | 列出 workspace 下的分支 | | ||
| | `create_branch` | 创建开发分支 | | ||
| | `delete_branch` | 删除开发分支 | | ||
| | `reset_branch` | 将分支重置到初始状态 | | ||
|
|
||
| ### 数据库 | ||
|
|
||
| | 工具 | 说明 | | ||
| | ---- | ---- | | ||
| | `execute_sql` | 在 Postgres 数据库上执行原始 SQL | | ||
| | `list_tables` | 列出一个或多个 schema 下的表 | | ||
| | `list_migrations` | 查询 `supabase_migrations.schema_migrations` 中的迁移记录 | | ||
| | `list_extensions` | 列出已安装的 PostgreSQL 扩展 | | ||
| | `apply_migration` | 执行迁移 SQL,并写入 `supabase_migrations.schema_migrations` | | ||
| | `generate_typescript_types` | 根据 schema 元数据生成 TypeScript 类型定义 | | ||
|
|
||
| ### Edge Functions | ||
|
|
||
| | 工具 | 说明 | | ||
| | ---- | ---- | | ||
| | `list_edge_functions` | 列出 workspace 或 branch 下的 Edge Functions | | ||
| | `get_edge_function` | 获取 Edge Function 的代码和配置 | | ||
| | `deploy_edge_function` | 创建或更新 Edge Function | | ||
| | `delete_edge_function` | 删除 Edge Function | | ||
|
|
||
| ### Storage | ||
|
|
||
| | 工具 | 说明 | | ||
| | ---- | ---- | | ||
| | `list_storage_buckets` | 列出存储桶 | | ||
| | `create_storage_bucket` | 创建新的存储桶 | | ||
| | `delete_storage_bucket` | 删除存储桶 | | ||
| | `get_storage_config` | 获取 Storage 配置 | | ||
|
|
||
| ## 鉴权方式 | ||
|
|
||
| 使用火山引擎 AK/SK 鉴权。可在[火山引擎 API 访问密钥控制台](https://console.volcengine.com/iam/keymanage/)获取凭证。 | ||
|
|
||
| ## 环境变量 | ||
|
|
||
| | 变量名 | 必需 | 默认值 | 说明 | | ||
| | ---- | ---- | ---- | ---- | | ||
| | `VOLCENGINE_ACCESS_KEY` | 是 | - | 火山引擎 Access Key | | ||
| | `VOLCENGINE_SECRET_KEY` | 是 | - | 火山引擎 Secret Key | | ||
| | `VOLCENGINE_REGION` | 否 | `cn-beijing` | AIDAP API 所在地域 | | ||
| | `DEFAULT_WORKSPACE_ID` | 否 | - | 未传 `workspace_id` 时使用的默认目标 | | ||
| | `READ_ONLY` | 否 | `false` | 设为 `true` 后会禁止所有写操作工具 | | ||
| | `SUPABASE_WORKSPACE_SLUG` | 否 | `default` | Edge Functions API 使用的项目 slug | | ||
| | `SUPABASE_ENDPOINT_SCHEME` | 否 | `http` | 生成 workspace URL 时使用的协议 | | ||
| | `PORT` | 否 | `8000` | 直接启动服务时监听的端口 | | ||
|
|
||
| ## 部署 | ||
|
|
||
| ### 在本地代码仓库中运行 | ||
|
|
||
| ```bash | ||
| uv --directory /ABSOLUTE/PATH/TO/mcp-server/server/mcp_server_supabase run mcp-server-supabase | ||
| ``` | ||
|
|
||
| ### 使用本地源码配置 MCP Client | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "supabase": { | ||
| "command": "uv", | ||
| "args": [ | ||
| "--directory", | ||
| "/ABSOLUTE/PATH/TO/mcp-server/server/mcp_server_supabase", | ||
| "run", | ||
| "mcp-server-supabase" | ||
| ], | ||
| "env": { | ||
| "VOLCENGINE_ACCESS_KEY": "<your-access-key>", | ||
| "VOLCENGINE_SECRET_KEY": "<your-secret-key>", | ||
| "VOLCENGINE_REGION": "cn-beijing", | ||
| "DEFAULT_WORKSPACE_ID": "ws-xxxxxxxx" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 使用 `uvx` 配置 MCP Client | ||
|
|
||
| ```json | ||
| { | ||
| "mcpServers": { | ||
| "supabase": { | ||
| "command": "uvx", | ||
| "args": [ | ||
| "--from", | ||
| "git+https://github.com/volcengine/mcp-server#subdirectory=server/mcp_server_supabase", | ||
| "mcp-server-supabase" | ||
| ], | ||
| "env": { | ||
| "VOLCENGINE_ACCESS_KEY": "<your-access-key>", | ||
| "VOLCENGINE_SECRET_KEY": "<your-secret-key>", | ||
| "VOLCENGINE_REGION": "cn-beijing", | ||
| "DEFAULT_WORKSPACE_ID": "ws-xxxxxxxx" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### 直接使用 Python 入口启动 | ||
|
|
||
| ```bash | ||
| python3 -m mcp_server_supabase.server --port 8000 | ||
| ``` | ||
|
|
||
| 这个包同时暴露了 `mcp-server-supabase` 和 `supabase-aidap` 两个入口,示例统一使用 `mcp-server-supabase`。 | ||
|
|
||
| ## 使用说明 | ||
|
|
||
| - 如果没有显式传入 `workspace_id`,且配置了 `DEFAULT_WORKSPACE_ID`,服务会自动使用这个默认目标。 | ||
| - 如果传入的是 `br-xxxx` 这样的 branch ID,服务会自动解析所属 workspace。 | ||
| - `get_publishable_keys` 在需要时会自动解析默认分支。 | ||
| - `reset_branch` 虽然接收 `migration_version` 参数,但当前 AIDAP API 会忽略这个值,只执行分支重置。 | ||
| - `deploy_edge_function` 当前支持 `native-node20/v1`、`native-python3.9/v1`、`native-python3.10/v1`、`native-python3.12/v1`。 | ||
|
|
||
| ## 可适配客户端 | ||
|
|
||
| - Cursor | ||
| - Claude Desktop | ||
| - Cline | ||
| - Trae | ||
| - 所有支持 `stdio` 的 MCP Client | ||
|
|
||
| ## License | ||
|
|
||
| volcengine/mcp-server is licensed under the [MIT License](https://github.com/volcengine/mcp-server/blob/main/LICENSE). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| [project] | ||
| name = "mcp-server-supabase" | ||
| version = "0.1.0" | ||
| description = "MCP server for Supabase/AIDAP" | ||
| readme = "README.md" | ||
| requires-python = ">=3.10" | ||
| license = { text = "Apache-2.0" } | ||
| authors = [ | ||
| { name = "Volcengine", email = "support@volcengine.com" } | ||
| ] | ||
| dependencies = [ | ||
| "mcp>=1.1.2", | ||
| "httpx>=0.27.0", | ||
| "pydantic>=2.0.0", | ||
| "volcengine-python-sdk @ git+https://github.com/sjcsjcsjc/volcengine-python-sdk.git", | ||
| ] | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "pytest>=8.0.0", | ||
| "pytest-asyncio>=0.23.0", | ||
| "black>=24.0.0", | ||
| "ruff>=0.3.0", | ||
| ] | ||
| legacy = [ | ||
| "psycopg2-binary>=2.9.0", | ||
| ] | ||
|
|
||
| [project.scripts] | ||
| mcp-server-supabase = "mcp_server_supabase.server:main" | ||
| supabase-aidap = "mcp_server_supabase.server:main" | ||
|
|
||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/mcp_server_supabase"] | ||
|
|
||
| [tool.hatch.metadata] | ||
| allow-direct-references = true | ||
|
|
||
| [tool.black] | ||
| line-length = 100 | ||
| target-version = ["py310"] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 100 | ||
| target-version = "py310" |
3 changes: 3 additions & 0 deletions
3
server/mcp_server_supabase/src/mcp_server_supabase/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """Supabase MCP Server package.""" | ||
|
|
||
| __version__ = "0.1.0" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README states the project is licensed under MIT, but
pyproject.tomldeclaresApache-2.0. Please align the README and packaging metadata to reflect the actual license for this subproject.