How to Configure OpenHands Supabase MCP Server
You set up an openhands supabase mcp server by giving the agent your database credentials. The agent then uses the Model Context Protocol to read tables and run SQL queries. Many teams start by passing their main admin password into the agent workspace. This approach gets the tool running fast, but it creates major risks. An autonomous agent with broad permissions can drop tables or read private user data. How the openhands supabase mcp server workflow runs OpenHands runs as an autonomous cod
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up an openhands supabase mcp server by giving the agent your database credentials. The agent then uses the Model Context Protocol to read tables and run SQL queries. Many teams start by passing their main admin password into the agent workspace. This approach gets the tool running fast, but it creates major risks. An autonomous agent with broad permissions can drop tables or read private user data.
How the openhands supabase mcp server workflow runs
OpenHands runs as an autonomous coding agent inside its own workspace. It uses the Model Context Protocol to talk to external data tools. When you link the Supabase MCP server, the agent gains direct database query rights. The server takes requests from the agent and sends SQL statements to your project.
Every Supabase project comes with a default postgres role that holds admin privileges. Supabase does not give out full superuser rights because those allow destructive actions. Even so, the default postgres role still holds broad admin power across your tables. The password you pick when you create a project belongs to this default role.
Supabase says you should not give this main password to outside services. Instead, they recommend that you create a new database user for every service. Each new project also includes built-in roles like anon, authenticated, and service_role. When you set up your agent, you should make a dedicated database role first. You can limit that role so it only reads the specific tables the agent needs. Then you pass those limited credentials into the agent settings so it can log in.
What native database roles solve and what they miss
Dedicated Postgres roles solve the basic login problem for your coding agents. They stop an agent from using your primary admin password during daily tasks. You can block the agent role from changing database schemas or deleting core tables. You can also use native table rules to limit which rows a role sees.
Still, static database roles only decide who can log in at the start. They do not inspect what individual SQL statements do while the agent runs. Once the agent logs in with an allowed role, every allowed query runs right away. If a role can read a customer table, a single prompt can pull every row by default. Native roles also leave raw database passwords sitting inside agent config files. Also, database logs only show which role ran a query, not why the agent ran it. And if the table holds emails, phone numbers, or card numbers, the query returns them all.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
How to scope database roles for coding agents
Start by listing the exact tasks your coding agent needs to perform. Most agents only need to inspect schema metadata or read sample rows for debugging. Create a fresh Postgres user in your project just for the OpenHands agent. Grant read rights only on the non-sensitive tables that relate to the code task.
Do not reuse the default postgres password that you set at project creation. Keep dashboard work separate, as dashboard queries run as the default postgres admin role. If the agent needs to test schema changes, point it at a staging project instead. Review your active database users often and drop any roles that agents no longer use. These steps shrink the blast radius before you add query controls in flight.
Check every Postgres query on the wire
Database roles and network rules decide who can open a session. They do not read what each SQL statement does after login. With hoop.dev, you run an open-source proxy, a sidecar for your Postgres. It runs beside your database and reads the Postgres wire protocol. Your apps and agents keep their login details and change only the host and port in the connection string their tool uses.
Before a query runs, hoop.dev guardrails check the statement by its effect, table, or pattern. They refuse bad deletes or drops with a real Postgres error. On the way back, hoop.dev data masking rewrites sensitive values in returned rows based on your rules. Every query and verdict goes to the audit trail. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and generates evidence for HIPAA, GDPR, and PCI DSS. See the code on GitHub.
Frequently asked questions
Should I give the OpenHands agent my default postgres password?
No, the default postgres role has admin rights across your project. Supabase recommends creating a separate database user for each external service you use.
Does the default Supabase postgres role have superuser rights?
No, Supabase does not grant superuser access because it allows destructive database actions. The default postgres role is an admin role with extra privileges for select tasks.
Can native database roles hide emails or card numbers in query results?
Standard table roles either allow or block access to whole tables or columns. They do not rewrite matched fields like emails or phone numbers inside query results.
Related guides
In this post