Est.

Structuring the Metrics Promotion Path so AI Agents Never Resolve Against Live Supabase Relations

Agents get trusted metrics only through a governed copy, never live Postgres.

· 9 min read
Cover illustration for “Structuring the Metrics Promotion Path so AI Agents Never Resolve Against Live Supabase Relations”
MCP and Headless Analytics · November 12, 2026 · 9 min read · 1,923 words

AI agents should query Supabase-derived metrics only through an identity-aware MCP server that reads from a governed analytical copy, with no direct access to live Postgres relations. The metrics promotion path moves data into that copy, fixes shared metric definitions there, and enforces access on every agent request. Permissions remain necessary, but workload separation and governed definitions make agent answers trustworthy, repeatable, and auditable.

Why agents querying live Postgres relations create a structural problem, not just a permissions one

A team hands an agent a connection string and calls the integration “done.” The credential works, queries return results, and access seems to be all that is left to check. Yet the connection has already placed analytical work inside a transactional system. Postgres is row-oriented and tuned for transactional workloads, so analytical scans against live relations compete with production traffic for CPU and memory. Narrower permissions do not change that workload conflict.

A human analyst writes one query at a time, while an agent can issue queries in volume and trigger an access-policy gap much faster. Atlan describes a static credential as a standing grant with no expiration or per-request check. The agent’s blast radius therefore includes everything that credential can reach. Restricting the credential narrows that radius, but leaves connection-pool pressure and analytical accuracy unresolved.

The State of AI Agent Security 2026 finds that only a minority of organizations define an agent’s access scope before deployment. The majority put agents into production before every agent is fully secured and governed. That sequence makes connectivity the default and governance the cleanup task. The architectural requirement is the reverse. The data surface an agent is allowed to use must be in place before the agent gets a route to it.

How Supabase's own key model makes the problem concrete

Supabase’s service_role key bypasses Row-Level Security entirely. Giving that key to an agent removes the RLS authorization boundary. This is the clearest failure of treating a broad administrative credential as a convenient integration mechanism.

Supabase’s policies use auth.uid() and per-user JWT claims, which fit application requests made for one user at a time. An analytical service account that needs to scan across all rows does not fit that model cleanly. Granting an RLS-bypassing role abandons the boundary, while adding analytics-shaped policies puts analytical requirements into production authorization. Both approaches place responsibility in the wrong layer.

Read replicas address contention, but not the underlying analytical mismatch. A replica remains row-based Postgres, and scans over tens of millions of rows can still perform poorly. Long-running scans can still put pressure on a shared connection pool when they use a read-only credential. Analytical requests hold connections longer than transactional requests, and parallel agent queries can saturate the pool and block user-facing operations.

How do AI agents query Supabase data without direct database access?

A governed analytical copy separates workloads by shape. Production Postgres remains responsible for row-level transactional work, while a pre-calculated, columnar copy absorbs the scan-and-aggregate requests that agents issue. Governed Parquet files queryable through DuckDB are one concrete implementation. They give agents fast, accurate context that is cheap to query, without using production connections for agent reads. The boundary is the copy’s independent existence.

Agents discover available datasets by name and request them through defined interfaces. The restriction on ad-hoc SQL against raw production relations changes what the agent is allowed to resolve. Instead of choosing tables and inventing a route through them, it consumes a prepared analytical product with defined meaning and access rules. The production database is no longer the destination for the agent’s business question.

The governed layer owns metric definitions, access rules, and update cadence, so its consumers share both meaning and an explicit refresh boundary. Informatica distinguishes a catalog that identifies approved data from a governed copy that delivers data, enforces quality at query time, and assembles task-specific context. Discovery alone does not perform those functions. A catalog can identify an approved destination without providing the controlled read path to it.

The copy also creates a precise audit surface. Agent reads use named dataset versions rather than whatever state production tables happen to be in. That distinction connects an answer to the data version used to produce it. The relevant object is the governed dataset the agent consumed.

Why pre-modeled metric definitions must live in the governed layer, not in the agent's prompt

Without shared definitions, one agent can compute SUM(revenue) while another computes SUM(amount_captured) for the same Q2 business question. Both queries can run successfully and still give different numbers. The failure is semantic. Moving those raw inputs away from production protects the workload, but leaves the disagreement over what the metric means.

An agent’s prompt is not the authoritative metric layer. When each agent constructs its own SQL, every workflow can introduce a separate interpretation of revenue, ARR, churn, or active user. An agent can then propagate its interpretation consistently through dependent workflows without exposing where the divergence began. Consistency within one workflow is not agreement across the business. Shared definitions must therefore precede the agent’s reasoning.

The governed layer owns that definition once. Each metric is calculated there, stored in the governed copy, and consumed identically by dashboards and agents. The practical test is reconciliation between a CEO dashboard KPI and an agent answering the same business question. If the numbers cannot reconcile, the definition is being approximated. A reusable prompt can guide analysis, but it cannot replace this common source of meaning.

A data dictionary with expiry dates and named owners is the minimum viable foundation. Every metric needs an agreed definition and a single source of truth. Without that ownership, different teams can report different performance numbers and divert the executive team’s attention from decisions to disputes over data. This problem predates agentic systems, but agents remove friction that once slowed its spread. A human analyst may pause at conflicting numbers, while an agent can pass the disagreement downstream without noticing.

How MCP serves as the enforcement layer that keeps agents bound to the governed copy

MCP replaces the N×M problem of one-off agent-to-source connections with a common interface. An agent calls a tool or requests a resource, and the MCP server decides what the requesting identity receives. In this architecture, that interface leads only to the governed copy. MCP standardizes the request path, but the server’s configuration and policy enforcement establish the boundary. The protocol alone does not turn production access into governed analytics.

Its three primitives serve distinct roles within that boundary. Resources expose read-only datasets and schemas, allowing the client application to attach context about available data and its meaning without the model touching underlying tables. Tools execute defined operations against the governed copy, such as querying DuckDB against Parquet. Prompts supply reusable analytical templates based on pre-approved logic. Together, these primitives make approved data and operations available without asking the agent to improvise production SQL.

The stateless MCP specification revision finalized July 28, 2026 changes how this access layer scales. It removes protocol-level session tracking and places protocol version, client info, and client capabilities in a _meta field with each request. MCP servers can consequently scale horizontally behind a plain load balancer without sticky sessions or shared session stores. The access layer can grow independently of the analytical copy. That does not mean additional server instances create more analytical capacity or solve database connection-pool exhaustion.

Even with that deployment change, authorization must be checked on each request. Atlan distinguishes a shared credential, which grants everything its connection can reach, from identity-aware access that enforces the caller’s entitlement on each request. Rate limits and per-agent quotas belong at this server boundary, before a query is issued. An MCP server must support those controls and run queries only through the governed read path. Exposing row-level access controls is insufficient if the same server still gives agents unrestricted routes to live relations.

The confused-deputy risk makes that distinction operationally important. An MCP proxy can be manipulated into acting with broader permissions than the requesting agent should have. Token passthrough is therefore forbidden in a correctly built governed layer. The server must enforce the requesting identity’s scope. Keeping the governed copy behind the server also stops agents from using the enforcement service as a route to query production.

What the full promotion path looks like tier by tier, and what each stage eliminates

The first tier establishes the governed analytical copy. Data from Supabase becomes a pre-calculated, queryable analytical dataset. This keeps agent analytical reads out of the production connection pool and scan-heavy work apart from transactional traffic. Named datasets and versions also replace arbitrary table states as the objects of access and audit.

Tier 2 establishes shared metric definitions in the governed layer. Dashboards and agents use the same logic to answer the same business question. This eliminates semantic drift and ad-hoc SQL divergence at the metric boundary. The “which revenue number?” problem is resolved before a consumer asks for revenue. The definition is part of the promoted dataset.

Tier 3 uses MCP to enforce the rules on every agent request. Each request is a discrete, authenticated call, with execution handled by DuckDB against Parquet or a configured read path within the governed boundary. Server-side rate limits and per-agent quotas constrain volume before execution. Identity-aware authorization removes the standing database credential as the agent’s access instrument. This tier addresses unenforced access scope and unbounded request volume without asking the production database to reject excess work.

Connection-pool configuration needs to be set with care at each of these boundaries. It should be pinned and tested, never inherited without examination from library defaults. A misconfigured default can silently undermine the intended separation. Treat connection behavior as part of the architecture’s contract. An approved interface does not compensate for a read path configured to use the wrong pool.

The observability contract is similarly narrow and explicit. Agents use read-only, project-scoped access to watch long-running sessions, query execution-time regressions, and advisor findings. They do not create indexes, rewrite queries, or cancel sessions. Health and security checks therefore remain observational rather than becoming a separate route to production intervention. This preserves the distinction between inspecting a system and receiving authority to change it.

Why the architecture must be in place before the agent fleet grows, not after the first incident

The same report finds that the share of organizations running large agent fleets has more than doubled since April 2026. Confidence in incident readiness has fallen sharply over the same period. Scale is increasing faster than operational control. The report also finds that most organizations experienced an agent security or privacy incident in the past year, while only a small fraction could revoke a misbehaving agent’s access to all systems within an hour.

Nearly one in four agents now acts without human review. For those requests, the governed layer is the reliable checkpoint before execution. Policies that depend on later inspection take effect after queries execute, making the timing of architecture consequential. Copy separation, shared definitions, and request-level enforcement must be in place before agents start issuing more queries on their own.

Informatica treats governance, quality, and observability from day one as requirements for production-grade agentic systems. For a small team starting on Supabase, those requirements are cheaper to establish before ad-hoc queries accumulate across production workflows. Retrofitting them later means replacing access paths and reconciling definitions that consumers already depend on. The metrics promotion path is the infrastructure that makes useful agent work trustworthy, repeatable, and auditable, and it is cheaper to build early than to impose after an incident.

Sources

  1. AI Agent Data Access: Governed Patterns and Setup [2026]
  2. State of AI Agent Security Report 2026
  3. Before the Tool Call: Deterministic Pre-Action Authorization for Autonomous AI Agents

More in MCP and Headless Analytics