MCP server for your users
Every project can be an MCP server for its own users. An AI app (Claude, ChatGPT, Cursor, an agent you wrote) signs the user in through your project’s identity provider (OAuth 2.1) and then calls tools generated from the tables and functions you choose. Every tool runs as that user, under row level security.
What an agent can and cannot do:
- It sees only what the user could already read with your policies, and cannot change a row it cannot see.
- It uses only the tables, columns, functions, Edge Functions and Flows on your allowlist (default deny). Never
auth,storageor other internal schemas, DDL, arbitrary SQL orservice_role. - Anonymous users cannot use it. The user signs in and approves the connection on a consent screen.
- Reading and writing are separate scopes,
mcp:readandmcp:write. By default an app only getsmcp:read.
Set up
Section titled “Set up”In the dashboard under Authentication, MCP server (project admins):
- Enable the identity provider (OAuth apps).
- Switch MCP server on.
- In the Allowlist pick a table, its operations (
select,insert,update,delete) and columns, with a short description for the model. The table must have RLS enabled; write the policies first and run the RLS test.updateanddeleteneed a primary key whose columns are exposed. ASECURITY DEFINERfunction can bypass RLS, so you must acknowledge it. - Keep confirmation on for writes. Turn require elicitation on for sensitive data: a client that cannot ask the user then cannot write at all.
Generated tools: <table>_query (filters eq, neq, gt, gte, lt, lte, like, ilike, in, is_null, columns, order_by, limit up to 100, offset), <table>_insert, <table>_update, <table>_delete, rpc_<name>, fn_<name>.
Connect a client
Section titled “Connect a client”The endpoint is https://<project>/mcp/v1/<ref> (Streamable HTTP):
{ "mcpServers": { "my-app": { "url": "https://<project>/mcp/v1/<ref>" } } }The client discovers the sign-in from the endpoint, the user signs in and approves, and the client gets a token. The token is checked on every request: disabling an app, revoking a grant or banning the user stops the next call.
Where OAuth clients come from
Section titled “Where OAuth clients come from”- Created by you under OAuth apps: a public client with PKCE and scopes
openid mcp:read(addmcp:writeonly if the app should write). - Dynamic Client Registration (DCR), off by default. Switch it on when any MCP client should connect without you registering it first. Safeguards: public PKCE clients only, read-only unless you allow
mcp:write, a registration limit per address and per project, a cap on the number of apps, and unused apps deleted after 24 hours. Such apps are unverified: the consent screen says so in red. Verify an app you recognise; revoke one you do not (this kills its grants and tokens at once).
Built-in tools
Section titled “Built-in tools”Under Allowlist, Built-in tools you can switch on read-only tools, each separately. They look only at the user of the token; no argument can name another user.
| Tool | Returns |
|---|---|
my_profile |
The user’s own account (id, email, name, providers, user_metadata). Never app_metadata, password hashes, tokens or sessions. |
my_files |
Ready files in Storage owned by the user (bucket, path, size, content type). Your policies on storage.objects still apply. |
my_file_url |
A short-lived download link (up to 300 seconds) for one file the user owns. |
Flows as tools
Section titled “Flows as tools”A deployed Flow can be a tool (flow_<name>): Allowlist, Add Flow.
- It runs as the signed-in user with that flow’s own access rules, caller policy and plan quota.
- Async (default) answers with a
run_id, and the assistant pollsflows_run_status. Sync waits up to the wait you set (at most 20 seconds), then returns the output or therun_id. - A flow tool is a write tool by default, because a flow can do anything you coded. Tick Read only only for a flow that never changes anything.
- A flow run does not carry the
agentclaim, so keep exposed flows narrow and validate the input inside the flow.
Confirmation and safety
Section titled “Confirmation and safety”- With elicitation the client asks the user (“add a row to notes: …”) while the call is open, and the change runs only after the user agrees.
- A client that cannot elicit gets a single-use
confirm_token(5 minutes, bound to the user, app, tool and exact arguments). It proves the arguments did not change, not that a human looked; switch on require elicitation if that is not enough. - Apps registered through DCR can only write through elicitation.
- Content returned from your database is marked as untrusted data for the model.
- The database sees the claim
agent = {client_id, grant_id, scopes}, so a restrictive policy can make agents weaker than the user, for example “an agent may only write withmcp:write”.
Limits and audit
Section titled “Limits and audit”Plan keys: mcp_enduser_enabled, mcp_write_enabled, max_mcp_exposed_items, mcp_calls_per_min_per_user (rate_limited), mcp_calls_per_user_month (quota_exceeded) and mcp_max_rows_per_call (at most 100). Every call is recorded (arguments as a hash, never the values) for 180 days and shown under MCP server, Activity.
Not supported: sessions and server-initiated streams, batching, anonymous users, resources and prompts, schemas other than public.
Before exposing a table, test its policies as an agent: connect any MCP client (for example MCP Inspector) with two test users and check that user B sees nothing of user A.