Schema Visibility Constraints as the First Governance Control When AI Agents Request Supabase Read Access
Limit what an agent can discover before you grant it access.

Governed data access for AI agents on Supabase via MCP should begin by limiting what the agent can discover, then apply explicit table privileges, row-level security, and time-bounded credentials. For governed metrics, a read-only MCP interface over pre-modeled datasets keeps the agent further from production tables by giving it no direct access to them. MCP supplies the connection.
Why schema visibility is the right starting point for AI agent governance
Governing an agent’s access to Supabase now extends beyond establishing a connection. Deciding what it should be allowed to discover before it acts is harder. The Supabase MCP server lets a connected agent call list_tables, get column details and foreign key constraints with verbose=true, and run SQL in the same session. No application code change is required. A connection can therefore expose both the database’s structure and a means of acting on it.
Supabase became an official ChatGPT app in May 2026, extending this access beyond coding tools hosted in development environments into conversational interfaces. That broadens the governance boundary. Supabase’s agent plugin also bundles the MCP server and agent skills into a setup path covering database queries, migrations, and Edge Functions. Supabase’s June 2026 developer update says that the MCP server still needs manual configuration, so teams can use that setup step to set what the agent can discover before it connects.
What schema introspection actually exposes when no visibility constraint is in place
Schema introspection discloses information before a data query runs. Table names, column names, types, and relationships show where sensitive information lives and how records connect. PostgREST’s introspection endpoint can return this structural map in one HTTP call. Discovery is therefore an exposure vector in its own right. An agent need not retrieve private rows to learn something about the system that stores them.
With sufficiently broad access, the exposed surface can include auth.users, which holds registered users’ email, phone, and provider identity. A connection using service_role bypasses Row Level Security, removing a further boundary between discovery and retrieval. Failed reads can disclose structure too. PostgREST permission errors can name an accessible table and provide a hint identifying the required GRANT statement. A rejected query is not necessarily an information-free response.
Tables created through SQL, migrations, or the API do not automatically receive RLS, while tables created through the dashboard do. Coding agents commonly use the former paths. Wiz’s February 2026 case report described an AI-agent social network built with coding assistants that had a Supabase credential in its client-side JavaScript and no RLS in its database. The exposure included 1.5 million API tokens, tens of thousands of email addresses, and thousands of private conversations, illustrating the consequences when accessible structure leads to unrestricted data.
Why RLS alone cannot substitute for constraining what an agent can see
RLS answers a narrower question than schema visibility. It governs row access during data operations, rather than determining which database objects an agent should learn about. A table can be discoverable even when its rows are protected. This leaves room for the agent to learn the structure, try speculative queries, and target objects outside its task.
The distinction also applies to destructive operations. RLS applies to SELECT, INSERT, UPDATE, and DELETE, with DROP TABLE, ALTER TABLE, and TRUNCATE outside its scope. Preventing those operations requires restrictions on the connecting role’s privileges. A read-only assignment must therefore be enforced at the database level. Calling a connection read-only does not make unrestricted database authority safe.
An agent using service_role bypasses RLS, even if policies have been carefully written for ordinary authenticated queries. Tables made through different paths can also leave some parts of a project less protected than others. Treating RLS as the complete security model confuses protection of returned rows with control over the objects an agent can inspect or address.
How Postgres role configuration constrains what an agent can discover
For a Supabase team, the actionable starting point is a dedicated read-only agent role. The role should have an explicit schema scope and SELECT privileges only on permitted tables. An illustrative configuration is ALTER ROLE agent_readonly SET search_path TO reporting, public. That names the intended working schemas. It must be paired with privilege restrictions and a discovery interface that respects the intended scope.
A search path must not be treated as a standalone security boundary or as proof that every introspection tool will hide other schemas. The governance requirement is that the agent receives only its permitted catalogue and cannot access excluded objects. Explicit grants enforce the access portion of that requirement. The connecting role must also lack the authority needed to drop or alter tables, or to truncate their contents, because RLS cannot block those operations.
Supabase’s May 2026 changelog introduced temporary token-based database access, which its June 2026 developer update also highlighted. The mechanism pairs a database role with an expiry window. This adds a time boundary to the object boundary established by the role. It leaves excessive privileges in place, but puts an end date on that access.
Supabase’s April 28, 2026 announcement also changed publication defaults for new public-schema tables, requiring explicit grants rather than automatic exposure through the Data API or GraphQL. The announced rollout dates were May 30 for new projects and October 30 for existing projects. That change supports deliberate publication alongside agent-specific scoping. In a two-pass schema-grounding pattern, the agent first calls list_tables for a compact catalogue, then requests get_table_schema for the two or three tables it needs. The first response must already be restricted, because selective follow-up cannot retract a catalogue already disclosed.
What the agent's discovery surface looks like with and without visibility constraints applied

Under open discovery, an agent begins with a broad inventory. Depending on its permissions and tool configuration, that inventory can expose public tables, internal configuration, and authentication-related structure. Tables made without RLS may show up beside protected ones. The agent must then choose among objects that its task never required it to know about. Each extra object gives the agent one more target for a query it does not need to run.
Scoped discovery changes the starting context instead. The agent receives only the permitted reporting tables or governed datasets, with access restrictions backing that narrower catalogue. It can ground its queries in relevant objects without inspecting the rest of the project. This reduces disclosure and limits opportunities for incorrect joins. For example, excluding tbl_usr_acc removes that discovered name as a prompt for speculative relationships, though it does not guarantee that a model will never invent an identifier.
Visibility constraints limit what the model learns, while privileges control which operations it can carry out. Both are needed when an agent guesses a name or receives one through a prompt. Error responses also belong within the discovery boundary, because a failed read can reveal information that the initial catalogue withheld. For any separately authorized write workflow, the same bounded surface gives a confirm-then-execute process a defined set of objects to review.
How schema visibility constraints set the terms for every downstream governance layer

Schema visibility comes first because it establishes the scope against which later controls are judged. RLS can then control which rows come back from approved tables, while explicit privileges keep unrelated objects out of reach. This narrows the agent-specific policy review. It prevents the agent integration from depending on every policy across the project being equally complete.
Token scope answers a different question. A read-only credential limits what the agent can do, and a temporary credential limits how long it can do it, but neither on its own limits how much sensitive structure the connection reveals. Nor does read-only access mean low-risk access if the role can retrieve an entire user table. The scope of discovery and the scope of readable data must therefore be considered together. An expiry window is useful only in relation to the authority that exists within it.
The same boundary gives review artifacts their meaning. Supabase introduced pg-delta in April 2026 as a Postgres schema diffing engine that generates SQL migrations from declarative SQL schema files. An object-level diff shows what changed, and the scope set for the agent lets a reviewer judge whether that change belongs in the task. Without an agreed scope, the diff is only a description. A propose-then-execute approval loop likewise becomes clearer when reviewers know which objects the agent was authorized to consider.
Audit logs complete a different part of the record. They show what an agent did, while the recorded role, grants, and visibility configuration establish the limits of its authorized access at that time. Neither substitutes for the other. Together, they let reviewers compare actual behavior with a defined contract instead of inferring acceptable behavior from whatever happened to appear in the logs.
How can teams expose governed metrics without production-table access?
Pre-modeling data changes the boundary more fundamentally than narrowing a production catalogue. Instead of asking an agent to navigate raw tables, a team can expose governed datasets through a read-only, MCP-accessible interface. Metrics are calculated and datasets shaped, scoped, and validated ahead of agent consumption. The agent discovers a purpose-built analytical surface. Raw production-table access is no longer part of its contract.
This also addresses a correctness problem that permissions alone cannot solve. One engineer may work out revenue with SUM(revenue), while another uses SUM(amount_captured). An agent given raw tables can come up with a third way to read the metric without breaking any access rule. A pre-modeled semantic layer defines the metric once, so the agent consumes the same definition as a dashboard. Governance then covers meaning as well as permission.
MCP makes those governed capabilities reachable through tools for dataset discovery, metric queries, and analytics. The semantics and access rules for those capabilities must exist upstream of the protocol, whether the interface exposes raw SQL or a curated metric query. For a Supabase team, the architectural preference follows the task. Governed datasets are a better fit when the task needs metrics, while scoped database access fits tasks that need to work with database structure.
A governed data layer can extend an existing Supabase project without changing its production schema. The proposed pattern needs no ETL or separate infrastructure and keeps raw tables out of the agent interface. Those are requirements for the chosen implementation. Evaluating the interface therefore means examining connection support, what it exposes, and how its definitions are governed.
What a governed agent-to-data contract looks like in practice for a Supabase team
The minimum contract begins with a dedicated agent role, an explicit schema scope, and a discovery catalogue limited to permitted objects. It excludes service_role and admin tokens. Explicit grants authorize reads only from approved tables, with RLS governing the rows available through those reads. Temporary token-based access sets an expiry window for that access.
Read-only mode should remain the default. Any write exception belongs behind explicit review and documentation in AGENTS.md or the repository onboarding documents. Agent-produced migrations should receive object-level schema review through a pg-delta-style diff alongside the raw SQL blob. Audit records should preserve both the actions taken and the visibility and privilege configuration that bounded the connection.
For teams whose agents need metrics rather than database administration, replacing raw access with pre-modeled datasets moves that contract upstream. The Philadelphia Inquirer adopted a metrics-as-code, version-controlled semantic layer approach in 2024 to enforce consistency for self-serve analytics. Informatica announced fully headless data management through native MCP support in May 2026. These approaches work on different parts of the architecture, but both make access for agents part of a broader governed data system and go beyond just making a connection.
If the agent’s connection were compromised tomorrow, could the team bound the blast radius from its recorded schema visibility configuration, role privileges, and token lifetime? A sound contract makes that boundary explicit before the first discovery call.


