Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 5 min read Opinion easyNovice

Defense in Depth for MCP Servers

Stored prompt injection, where malicious instructions hidden in database rows trick an AI agent into reading private data and writing it somewhere visible, is a property of LLM tool calling generally, not an MCP-specific flaw. Supabase's guardrails reduced the risk but did not eliminate it: read-only mode, project scoping, feature groups, warnings wrapped around query results and LLM classifiers. The recommended fix is environmental: never connect agents to production data, keep manual tool-call approval on, limit tools via feature groups, log all MCP queries, and consider CaMeL-style separation of quarantined and privileged LLMs. Planned work includes a production mode, branching, a PostgREST-backed MCP that reuses RLS, and scoped access tokens.

Assumes: Model Context Protocolprompt injectionRow Level Security

Related posts

  • MCP Security: A Developer’s Guide

    Docker easyNovice

    MCP servers expand what AI agents can do but introduce risks across four categories: misconfigurations and weak defaults, malicious or compromised servers, secret leakage, and prompt injection or tool poisoning. One cited analysis found command injection flaws in 43% of MCP servers examined. Static AppSec tools miss these risks because agent behavior is non-deterministic and models can treat tool descriptions as instructions. The recommended guardrails are to containerize each server with resource and egress limits, route calls through a policy gateway that verifies signatures, enforces allowlists, redacts secrets, runs pre- and post-call interceptors and logs every call, and pin vetted servers by digest. Docker positions its MCP Gateway and MCP Catalog & Toolkit as the implementation.

  • Are Supabase docs agent-friendly? We didn't know, so we checked

    Supabase mediumAdept

    Supabase built an eval that runs coding agents against its Row Level Security guide using a non-leading "vibe coder" prompt, then grades the resulting database setup against a checklist derived from experts and outside sources rather than from the guide itself. The first runs showed agents leaving anon with insert/update/delete/truncate grants on every public table. Adding explicit steps to revoke default grants fixed that immediately. Test-writing guidance only took effect once it sat next to the policy code agents actually copy. The takeaway is that agents read selectively, so critical instructions belong beside copyable code, and clear structure and signposting serve agents and humans alike.

  • Give your Supabase app its own MCP server

    Supabase mediumAdept

    Supabase apps can expose their own MCP server so customers use the app from ChatGPT, Claude or other MCP clients, signed in with their existing account. An installable MCP Server block generates an Edge Function with an MCP handler, OAuth middleware and per-file tools. Supabase Auth acts as the OAuth 2.1 server, and `withSupabase({ auth: 'user' })` gives each tool a user-scoped client, so Postgres RLS policies govern what an agent can reach without a service role key. Setup requires asymmetric signing keys, dynamic client registration, a consent page and `verify_jwt = false` on the function; MCP Apps can render reused React components inside the chat.

  • AI Agents Know About Supabase. They Don't Always Use It Right.

    Supabase mediumAdept

    Supabase Agent Skills is an open-source ~100-line SKILL.md that steers AI coding agents to check current docs before writing code, follow inline security rules, and use a defined schema workflow. The inline rules include security_invoker on views, app_metadata rather than user_metadata for authorization, SELECT policies for UPDATE, and revoking sessions on user deletion. The schema workflow is iterative DDL via execute_sql or `supabase db query`, then advisors, then a migration. Critical content was moved inline because agents often skipped reference files. In LLM-judged evals across six scenarios, MCP+Skill beat baseline and MCP-only for every model tested (e.g. Sonnet 4.6 46%→58%→71%, GPT-5.4 71%→88%), and MCP-only agents never called search_docs.

  • Supabase MCP Server

    Supabase mediumAdept

    Supabase ships an official MCP server with 20+ tools that let AI clients like Cursor and Claude create projects, manage tables via migrations, run SQL, create database branches, fetch config and logs, and generate TypeScript types. Setup is a JSON config running the npx package with a personal access token. MCP standardizes tool implementations so clients can use any compliant server, and it also defines resources and prompts, which most clients don't yet support. The roadmap covers deploying Edge Functions, OAuth-based authorization from the 2025-03-26 spec, more token-efficient schema discovery than querying information_schema, and confirmation before destructive operations.

The quest for software engineering knowledge.

Look:
Layout: