All posts

MCP gateways: what they mean for your blast radius (on Postgres)

A common misconception is that connecting an AI‑driven MCP gateway directly to PostgreSQL automatically contains the blast radius of any accidental data exposure. In reality, the gateway becomes another privileged client, and a compromised or mis‑behaving model can issue the same destructive statements as any human user. Most teams treat an MCP gateway as a thin wrapper around the database driver. The gateway authenticates with a static service account, then hands over the raw connection to the

Free White Paper

Blast Radius Reduction + Single Sign-On (SSO): The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

A common misconception is that connecting an AI‑driven MCP gateway directly to PostgreSQL automatically contains the blast radius of any accidental data exposure. In reality, the gateway becomes another privileged client, and a compromised or mis‑behaving model can issue the same destructive statements as any human user.

Most teams treat an MCP gateway as a thin wrapper around the database driver. The gateway authenticates with a static service account, then hands over the raw connection to the language model. From the database’s point of view, the request looks just like any other client with full read and write rights. If the model mistakenly generates a DROP TABLE command or a massive SELECT that exhausts resources, the impact spreads across the entire database cluster. The blast radius – the amount of infrastructure or data that can be affected by a single fault – therefore grows rather than shrinks.

Why the existing setup leaves the blast radius unchecked

Two pieces of the puzzle are usually in place before any mitigation is added:

  • Non‑human identity. The MCP gateway authenticates using a service account or an API token. This satisfies the requirement for a machine identity, but the token often has broad privileges because the model needs to read many tables.
  • Least‑privilege provisioning. Teams try to grant only the permissions the model needs, yet the exact set of tables or queries is hard to enumerate ahead of time. The result is a permission set that is still wide enough to cause serious damage if misused.

Both steps are necessary, but they stop short of controlling what happens once the request reaches PostgreSQL. The query flows straight to the database engine, bypassing any real guardrails. No audit trail is captured at the gateway level, no inline masking is applied to sensitive columns, and there is no way to intervene on a dangerous command before it executes. The blast radius therefore remains fully exposed.

Placing the MCP gateway in a Layer 7 data path

The missing piece is a dedicated data‑path gateway that sits between the MCP gateway and PostgreSQL. By routing every request through this gateway, you gain a single enforcement point where policies can be evaluated in real time.

Continue reading? Get the full guide.

Blast Radius Reduction + Single Sign-On (SSO): Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

hoop.dev provides exactly that layer‑7 gateway. It proxies the PostgreSQL wire protocol, inspects each statement, and applies the controls needed to shrink the blast radius:

  • Session recording. hoop.dev records every query and response, creating a replayable audit log that can be examined after an incident.
  • Inline masking. Sensitive columns such as credit‑card numbers or personal identifiers can be redacted on the fly, preventing the model from seeing raw values even if it has read access.
  • Just‑in‑time approval. High‑risk statements such as DROP, ALTER, or bulk deletes can be routed to a human approver before they are allowed to run.
  • Command blocking. Known dangerous patterns are rejected automatically, stopping a runaway query before it consumes resources.

All of these outcomes are possible only because hoop.dev occupies the data path. Without that placement, the MCP gateway would continue to issue commands directly to PostgreSQL, and none of the above protections would be enforced.

How the reduction in blast radius works in practice

When an LLM generates a SQL statement, the request first reaches hoop.dev. The gateway checks the statement against a policy engine that knows which tables are considered high‑value, which columns require masking, and which operations need approval. If the statement passes, hoop.dev forwards it to PostgreSQL; if not, it either masks the response or halts execution pending approval. Because every step is logged, a post‑mortem can pinpoint exactly which model prompt triggered a problematic query.

This approach turns an open‑ended client into a controlled, auditable participant. The blast radius is limited to the subset of data that the policy allows the model to see, and the impact of any single query is bounded by the gateway’s ability to block or require approval for high‑risk actions. In effect, the gateway acts as a firebreak that prevents a single errant model output from cascading through the entire database.

Getting started with MCP‑protected PostgreSQL

To adopt this pattern, teams should first provision an MCP gateway that speaks the PostgreSQL protocol. Next, deploy hoop.dev as the Layer 7 proxy in the same network segment as the database. The official getting‑started guide walks through the Docker Compose deployment and shows how to configure OIDC authentication, masking rules, and approval workflows. Detailed feature documentation is also available in the learning portal.

Once the gateway is live, you can define policies that reflect your organization’s risk tolerance. For example, you might allow the model to read customer names but require masking for email addresses, and you could require a senior engineer’s sign‑off before any DELETE FROM orders statement runs. Over time, the audit logs collected by hoop.dev become a valuable source of evidence for security reviews and compliance checks.

Key takeaways

  • Connecting an MCP gateway directly to PostgreSQL does not limit blast radius; it can actually increase it.
  • Non‑human identity and least‑privilege provisioning are necessary but insufficient without a data‑path enforcement point.
  • hoop.dev places the MCP gateway in a Layer 7 gateway, enabling session recording, inline masking, just‑in‑time approval, and command blocking.
  • These controls shrink the blast radius by limiting what data the model can see and by preventing dangerous commands from executing unchecked.

Ready to protect your PostgreSQL deployments from the hidden risks of AI‑driven queries? Explore the open‑source repository and start contributing at https://github.com/hoophq/hoop.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts