loading…
Search for a command to run...
loading…
A local policy wrapper for Supabase MCP that secures access tokens and enforces strict execution models, including project allowlists and write-access restricti
A local policy wrapper for Supabase MCP that secures access tokens and enforces strict execution models, including project allowlists and write-access restrictions. It provides a safety layer to prevent AI agents from accidentally executing migrations or writing SQL against production environments.
English | 简体中文
Local policy wrapper for Supabase MCP.
It keeps your Supabase access token out of MCP config files and command-line arguments, adds local policy checks before requests hit the official @supabase/mcp-server-supabase, and makes production write access an explicit action instead of a default capability.
This project does not replace Supabase MCP. It sits in front of it.
Supabase MCP is powerful, but AI coding clients usually treat MCP servers as highly trusted local tools. In practice that creates a few common problems:
supabase-mcp-guard reduces that risk locally with a stricter execution model.
execute_sql specially: read-only SQL can pass while write/DDL SQL is blocked unless unlocked.macos-keychainenvcommandpowershell-secretmanagement if you already use PowerShell on macOSpowershell-secretmanagementwindows-credential-managerenvcommandenvcommandpowershell-secretmanagement if PowerShell is installedThe first-class installers included in this repo are:
This project uses stdio transport, so it can be wired into many MCP-capable clients.
Documented in this repo:
git clone https://github.com/askmeishi/supabase-mcp-guard.git
cd supabase-mcp-guard
npm install
npm install -g supabase-mcp-guard
If you install from npm globally, you can run the wrapper directly without cloning the repo:
supabase-mcp-guard --self-test
This checks that the binary starts correctly and shows whether a config file is already present.
./scripts/install_macos.sh --client=codex
What it does:
~/.config/supabase-mcp-guard/config.json/usr/local/bin/supabase-mcp-guard~/.codex/config.tomlOpen PowerShell and run:
Set-ExecutionPolicy -Scope Process Bypass
.\scripts\install_windows.ps1
What it does:
SecretManagement and SecretStore modules if missingSecretStore%APPDATA%\supabase-mcp-guard\config.json%LOCALAPPDATA%\Programs\supabase-mcp-guardPATHIf you installed from npm instead of cloning this repo, you can still use the wrapper directly and create your config manually from config.example.json.
macos-keychainUse macOS Keychain:
{
"secretProvider": {
"type": "macos-keychain",
"service": "supabase-mcp-guard",
"account": "primary"
}
}
powershell-secretmanagementUse PowerShell SecretManagement and a named secret:
{
"secretProvider": {
"type": "powershell-secretmanagement",
"name": "supabase-mcp-guard",
"vault": "SecretStore"
}
}
windows-credential-managerUse a Windows Credential Manager target:
{
"secretProvider": {
"type": "windows-credential-manager",
"target": "supabase-mcp-guard"
}
}
This provider expects a PowerShell environment where the CredentialManager module and Get-StoredCredential are available.
envRead the token from an environment variable:
{
"secretProvider": {
"type": "env",
"name": "SUPABASE_ACCESS_TOKEN"
}
}
commandRead the token from an arbitrary local command:
{
"secretProvider": {
"type": "command",
"command": "op",
"args": ["read", "op://vault/item/token"]
}
}
This is the most flexible option for unsupported platforms or custom secret stores.
Example config: config.example.json
Typical config:
{
"secretProvider": {
"type": "macos-keychain",
"service": "supabase-mcp-guard",
"account": "primary"
},
"projectRef": null,
"readOnly": false,
"features": null,
"apiUrl": null,
"logFile": "~/.local/state/supabase-mcp-guard/audit.log",
"stateFile": "~/.local/state/supabase-mcp-guard/write_lock.json",
"defaultUnlockMinutes": 10,
"allowedProjectIds": ["your-project-ref"],
"alwaysBlockedTools": ["create_project", "pause_project", "restore_project"]
}
Notes:
allowedProjectIds: if set, requests for other project IDs are blocked.projectRef: optional upstream fixed project binding.readOnly: if true, all write-sensitive upstream tools are blocked even during unlock windows.alwaysBlockedTools: tools that are always denied.The CLI can print snippets directly:
supabase-mcp-guard print-snippet --client codex
supabase-mcp-guard print-snippet --client claude-code
supabase-mcp-guard print-snippet --client cursor
supabase-mcp-guard print-snippet --client vscode
[mcp_servers.supabase]
command = "supabase-mcp-guard"
startup_timeout_sec = 30
Use a stdio MCP server entry in your Claude Code MCP JSON:
{
"mcpServers": {
"supabase": {
"type": "stdio",
"command": "supabase-mcp-guard",
"args": []
}
}
}
Use a stdio MCP server entry in your Cursor MCP JSON:
{
"mcpServers": {
"supabase": {
"type": "stdio",
"command": "supabase-mcp-guard",
"args": []
}
}
}
Use a stdio MCP server entry in your VS Code MCP config:
{
"servers": {
"supabase": {
"type": "stdio",
"command": "supabase-mcp-guard",
"args": []
}
}
}
Start as MCP stdio server:
supabase-mcp-guard
Check current lock state:
supabase-mcp-guard status
Temporarily unlock writes:
supabase-mcp-guard unlock --minutes 10
Lock again:
supabase-mcp-guard lock
Self-test:
supabase-mcp-guard --self-test
The guard enforces a local policy layer before forwarding requests upstream:
execute_sqlalwaysBlockedToolsallowedProjectIdsThis helps reduce accidental misuse, but it is not a substitute for correct database-side security:
SECURITY DEFINER and search_path under controlThe wrapper writes a local audit log to the configured logFile.
Examples:
~/.local/state/supabase-mcp-guard/audit.log%LOCALAPPDATA%\supabase-mcp-guard\audit.logBlocked requests and completed upstream tool calls are both recorded.
This project is designed for the common local AI-assistant risk model:
It does not protect against:
This repository is set up for both local package validation and tagged releases.
Local verification before release:
npm run check
npm pack --dry-run
Release flow:
package.json versionmainv0.1.1Release publishes to npm and creates a GitHub ReleaseRequired secret:
NPM_TOKEN in the GitHub repository secretsFor the latest client-specific MCP setup details, check the official client docs:
The JSON snippets above are intended for stdio-based MCP clients and may need minor path adjustments depending on how you install the wrapper.
MIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"supabase-mcp-guard": {
"command": "npx",
"args": []
}
}
}