MCP demos usually begin with the exciting part.
You connect an AI assistant to a service, ask a question in plain English, and watch it inspect schemas, explore data, or help with development work.
When I looked at adding an MCP path to the Supabase template in Nitrobase, however, my first question was less exciting:
What should happen when somebody on the public internet discovers the endpoint?
For now, the answer is deliberately boring:
HTTP/1.1 403 Forbidden
Access is forbidden.
That default is the feature I care about most.
Nitrobase has only recently launched and is still in Beta. Its MCP support is currently focused on Supabase deployments: Nitrobase preserves a dedicated route to Supabase Studio's MCP endpoint, but the route is blocked unless the server owner explicitly chooses to open it to trusted local addresses.
This is not a story about giving an AI unrestricted control over a VPS. It is about making a useful interface available without quietly turning it into a public administrative surface.
Why MCP is useful here
MCP, or Model Context Protocol, gives an AI client a structured way to communicate with a tool or data source.
Without it, a typical database conversation becomes a copy-and-paste loop:
Open terminal
|
Run a schema command
|
Copy the output
|
Paste it into the assistant
|
Receive a suggested query
|
Copy it back to the terminal
With an MCP-capable Supabase instance, the client can discover the capabilities made available by Supabase and use them in context.
That can shorten tasks such as:
- understanding an unfamiliar database schema;
- investigating why an application query is failing;
- preparing SQL while keeping the real schema in view;
- exploring a development project without repeatedly exporting context;
- helping a teammate navigate a self-hosted Supabase stack.
The attraction is obvious: less glue work between the question and the system that contains the answer.
The risk is equally obvious: the system that contains the answer may also contain production data.
A route is also a security boundary
A self-hosted Supabase stack contains multiple services behind one public entry point. Nitrobase uses a reverse-proxy chain to send each path to the correct service.
The MCP path looks roughly like this:
MCP client
|
| HTTPS /mcp
v
Application reverse proxy
|
v
Supabase gateway
|
| /api/mcp
v
Supabase Studio MCP handler
Adding the path to the proxy is technically simple. Deciding what is allowed to cross it is the real work.
The Nitrobase Supabase template therefore defines two boundaries:
| Incoming path | Purpose | Default result |
|---|---|---|
/api/mcp |
Internal Studio path | Blocked |
/mcp |
Intended MCP entry point | Blocked |
The direct internal path is denied so that it cannot become an accidental bypass. The cleaner /mcp route also starts with a request-termination rule that returns 403.
In other words, deploying Supabase does not automatically publish its MCP capability.
MCP code exists yes
Proxy route exists yes
Public access exists no
That distinction is easy to lose when a feature is reduced to a checkbox called “Enable MCP.”
Opening it should be a conscious change
The current template includes an explicit “danger zone” in its gateway configuration. To allow MCP access, the operator must remove the default termination rule, enable IP restriction, and add the trusted local addresses.
A simplified version of the intended policy looks like this:
plugins:
- name: ip-restriction
config:
allow:
- 127.0.0.1
- 10.0.0.24
The important part is not the YAML syntax. It is the decision represented by each address.
Who needs MCP access?
|
+-- AI client on the same machine -> loopback address
|
+-- Client over a private network -> private/VPN address
|
+-- Everyone on the internet -> do not allow by default
An allowlist is not complete authentication, and it is not a substitute for transport security or Supabase's own authorization model. It is one boundary that reduces the number of machines that can even reach the endpoint.
For a Beta product, I prefer making that boundary visible over pretending that every possible MCP client and network topology can be configured safely with one universal switch.
Why I did not make it public after deployment
Nitrobase already knows how to give an application an HTTPS route. It would have been easy to make /mcp immediately reachable and describe that as a smoother onboarding experience.
But convenience at deployment time can create ambiguity later:
- Was the endpoint opened for local development or production use?
- Does the client run on the VPS, a laptop, or a hosted AI service?
- Which database role does the MCP server use?
- Can the available tools only inspect state, or can they change it?
- Are prompts and tool results leaving the operator's network?
- Will the endpoint still be exposed after the experiment ends?
Nitrobase cannot answer those questions merely because it installed the stack.
So the safer default is:
deploy capability -> keep it closed -> understand the client -> open the narrowest path
This adds one manual step, but it prevents an infrastructure template from making a security decision on behalf of every user.
MCP does not remove the need to understand permissions
Structured tools are better than asking an assistant to improvise shell commands, but “structured” does not automatically mean “safe.”
There are several separate layers:
| Layer | Question to answer |
|---|---|
| Network | Which clients can reach /mcp? |
| Transport | Is the connection protected in transit? |
| Authentication | How does the server know who the client is? |
| Database role | What data and operations can the session access? |
| Tool policy | Which MCP tools may the assistant call? |
| Human approval | Which changes require confirmation? |
| Logging | Can sensitive arguments or results appear in logs? |
An IP allowlist only answers the first question.
If an MCP server can execute an operation, a connected client may eventually attempt that operation. The database permissions behind the connection remain the final enforcement point, so a development assistant should not inherit a production superuser role merely because its interface looks friendly.
I use this mental model:
Assistant intention
!=
MCP tool definition
!=
Database permission
Each layer should assume the layer above can make a mistake.
A practical workflow for a self-hosted setup
If I were enabling the current MCP route for my own development environment, I would do it in this order:
- Decide where the MCP client will run.
- Prefer the same host or a private network instead of a public source address.
- Allow only that source in the Supabase gateway configuration.
- Use HTTPS even when an endpoint is allowlisted.
- Give the underlying database identity only the permissions needed for the task.
- Inspect the tools exposed by the server before approving calls.
- Test with non-production data first.
- Remove the allowlist entry when the integration is no longer used.
The resulting path should be narrow:
One known client
|
Private or restricted network
|
HTTPS /mcp
|
Supabase authorization
|
Least-privileged database access
If any box is unclear, leaving the default 403 in place is a perfectly valid outcome.
What Nitrobase currently does -- and does not do
The current Beta behavior is intentionally small.
Nitrobase does:
- deploy a self-hosted Supabase stack;
- preserve a dedicated
/mcpproxy path; - block the direct
/api/mcppath; - block
/mcpby default; - provide a configuration pattern for restricting access to trusted IPs.
Nitrobase does not currently turn the whole control panel into an MCP server. An assistant is not being given a Nitrobase tool that can deploy applications, delete volumes, rotate secrets, or operate every connected VPS.
It also does not automatically determine whether a particular AI client, database role, or network is trustworthy. Those decisions still belong to the server owner.
I think stating this boundary matters. “Nitrobase supports MCP” should not be interpreted as “connect an AI and give it root.” In the current implementation, it means Nitrobase's Supabase deployment understands the MCP route and starts from a closed network policy.
My MCP exposure checklist
Before removing that 403, I want clear answers to these questions:
- Is this a development, staging, or production database?
- Where does the MCP client execute?
- Can it connect through loopback, a VPN, or a private network?
- Is
/api/mcpstill blocked as a direct path? - Is
/mcplimited to explicit source addresses? - Is the connection protected with HTTPS?
- Which identity and database role will the MCP session use?
- Which operations can that role perform?
- Does the client ask before write or destructive operations?
- Could tool inputs or results contain secrets or personal data?
- Is there a plan to remove access when it is no longer needed?
The checklist is intentionally longer than the configuration snippet. The line that enables access is short; the trust decision behind it is not.
The problem this feature is trying to solve
I want self-hosting to work with newer developer tools without requiring people to publish every new protocol endpoint the moment it appears.
MCP can make a database easier to understand and operate through an AI-assisted workflow. Nitrobase can make the underlying Supabase stack easier to deploy on infrastructure the user owns.
The useful combination is not simply:
self-hosted Supabase + AI = convenience
It is:
self-hosted Supabase
+
an explicit MCP route
+
a closed-by-default boundary
+
permissions chosen by the owner
=
convenience with a place to apply control
There is more work to do. I would like Nitrobase to make trusted-client setup easier, show the active exposure clearly, and help operators understand the permissions behind an MCP connection without hiding the security model.
For now, the most honest first version is an endpoint that exists, a route that is understood, and a default response that says no.
Sometimes the best way to ship a powerful feature is to begin with a good 403.
Nitrobase source code: https://github.com/AydenGroup/nitrobase
Top comments (0)