---
title: "Defense in Depth for MCP Servers"
description: "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."
url: "https://swe.quest/articles/defense-in-depth-for-mcp-servers-841fdfa753be4c4a"
canonical: "https://supabase.com/blog/defense-in-depth-mcp"
source: "Supabase"
published: "2025-09-16"
difficulty: "easy"
kind: "Opinion"
reading_minutes: 5
tags: ["ai-agents","appsec","llms","postgres"]
---

# Defense in Depth for MCP Servers

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2025-09-16, 5 min read, Opinion. Original: [https://supabase.com/blog/defense-in-depth-mcp](https://supabase.com/blog/defense-in-depth-mcp)

## Summary

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.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)

## Prerequisites

- Model Context Protocol
- prompt injection ([easy posts on Application security](https://swe.quest/tags/appsec.md?difficulty=easy))
- Row Level Security ([easy posts on Security](https://swe.quest/tags/security.md?difficulty=easy))

## Keywords

MCP, Supabase, Row Level Security, CaMeL, Cursor, Lethal Trifecta, PostgREST

## Related posts

- [MCP Security: A Developer’s Guide](https://swe.quest/articles/mcp-security-a-developer-s-guide-ee8f7d25fd64b2f2.md): Docker · 2025-09-16 · Easy · 8 min read · AI agents, Security, Supply chain security, Containers
  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.
- [Are Supabase docs agent-friendly? We didn't know, so we checked](https://swe.quest/articles/are-supabase-docs-agent-friendly-we-didn-t-know-so-we-checked-d50f60678575a95b.md): Supabase · 2026-08-01 · Medium · 5 min read · Documentation, AI for coding, Evaluation, PostgreSQL, Identity & auth
  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.
- [Give your Supabase app its own MCP server](https://swe.quest/articles/give-your-supabase-app-its-own-mcp-server-db89f29412fb7983.md): Supabase · 2026-10-22 · Medium · 5 min read · AI agents, Identity & auth, PostgreSQL, Serverless, TypeScript
  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.
- [AI Agents Know About Supabase. They Don't Always Use It Right.](https://swe.quest/articles/ai-agents-know-about-supabase-they-don-t-always-use-it-right-c03d45208ad6704c.md): Supabase · 2026-04-09 · Medium · 9 min read · AI for coding, AI agents, PostgreSQL, Evaluation, Application security
  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.
- [Supabase MCP Server](https://swe.quest/articles/supabase-mcp-server-d66dd26bdd24699a.md): Supabase · 2025-04-04 · Medium · 6 min read · AI agents, PostgreSQL, Developer tools, LLMs
  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.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
