Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,32 @@ For more information, see the [VS Code MCP docs](https://code.visualstudio.com/d

</details>

<details>
<summary>Gemini CLI</summary>

#### Install via command line:

```bash
gemini mcp add -t http supabase https://mcp.supabase.com/mcp
```

#### Install using Supabase extension for Gemini CLI:

The Supabase extension for Gemini CLI bundles the MCP server with a context
file and custom commands, teaching Gemini how to better use all tools.

Use the following command to install the extension:

```bash
gemini extensions install https://github.com/supabase-community/supabase-mcp
```

After adding the server or extension, start Gemini CLI and run `/mcp auth supabase` to authenticate.

For more information, see the [Gemini CLI MCP docs](https://geminicli.com/docs/tools/mcp-server/).

</details>

## Options

The following options are configurable as URL query parameters:
Expand Down
35 changes: 35 additions & 0 deletions SUPABASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Supabase extension for Gemini CLI

## Overview

This extension allows you to access your Supabase projects and perform tasks like managing tables, fetching config, and querying data.

**Key capabilities**: Execute SQL, manage migrations, deploy functions, generate TypeScript types, access logs, and search documentation.

## Best Practices

**Security defaults**
- Use read-only mode (`?read_only=true`) to prevent accidental writes
- Scope to specific projects (`?project_ref=<project-ref>`) to limit access
- Limit tool access with feature groups (`?features=docs%2Caccount%2Cdatabase%2Cdebugging%2Cdevelopment`)
- Available groups: `account`, `docs`, `database`, `debugging`, `development`, `functions`, `storage`, `branching`
- Avoid connecting to production databases even in read-only mode
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these thing things users add to the MCP url?

i.e. https://mcp.supabase.com/mcp?read_only=true

Because users when they install the extension will get the MCP server config of the extension json automatically (they can not configure it per say).

So a quick question:

I assume the same read-only and project specific stuff can also be configured via auth scopes during the oauth flow?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume the same read-only and project specific stuff can also be configured via auth scopes during the oauth flow?

Not currently, it requests all possible scopes. The only way to configure these options right now is through the URL.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackwotherspoon In that case, would it be better to just omit this whole section as it's beyond what Gemini can do for the user?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I would probably omit for now. I'll think of some better ways we can enhance extensions framework to allow URL query params better in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


**Schema management**
- Use `apply_migration` for schema changes (CREATE/ALTER/DROP tables) - these are tracked
- Use `execute_sql` for queries and data operations (SELECT/INSERT/UPDATE/DELETE) - these are not tracked
- Always specify schemas explicitly: `public.users` instead of `users`

## Troubleshooting

**Common errors**
- "permission denied": Remove `read_only=true` for write operations
- "relation does not exist": Use `list_tables` to verify table names and schemas
- "Not authenticated": Restart MCP connection and verify organization access
- Migration conflicts: Check `list_migrations` history before applying new migrations

**Using logs for debugging**
- Use `get_logs` to view service logs when certain action fails
- Available log types: `api`, `branch-action`, `postgres`, `edge-function`, `auth`, `storage`, `realtime`
- Check Postgres logs to see slow queries, errors, or connection issues
- Review API logs to debug PostgREST endpoint failures or RLS policy issues
11 changes: 11 additions & 0 deletions gemini-extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "supabase",
"description": "Access your Supabase projects and perform tasks like managing tables, fetching config, and querying data.",
"version": "0.5.9",
"contextFileName": "SUPABASE.md",
"mcpServers": {
"supabase": {
"httpUrl": "https://mcp.supabase.com/mcp"
}
}
}