Skip to content

Conditional tools based on platform implementation #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gregnr
Copy link
Collaborator

@gregnr gregnr commented Jun 23, 2025

Supabase MCP supports custom platform implementations based on the environment it is running in. This PR makes it more flexible by allowing you to implement only a subset of platform operations.

Before:

const myPlatform: SupabasePlatform = {
  executeSql() { ... },
  listMigrations() { ... },
  applyMigration() { ... },
  // every other possible platform operation must be implemented
}

After:

const myPlatform: SupabasePlatform = {
  // grouped by feature category now
  database: {
    executeSql() { ... },
    listMigrations() { ... },
    applyMigration() { ... },
  },
  functions: { ... },
  // option to not implement anything else
}

Why?

Self-hosted Supabase can support some but not all platform operations (e.g. it can't support account level or branching operations). In order to make this MCP server compatible with self-hosted, we need a way to conditionally provide tools based on which platform operations are available.

This also gives us the flexibility to choose a subset of features to implement on the remote MCP implementation (useful during development and quick iterations).

How?

Now that we support feature groups, we can extend this logic to also filter by platform operations. The SupabasePlatform interface is now grouped by feature (database, account, functions, etc) and each group is optional. We add logic in the server that conditionally adds tools only if the platform methods for that group are implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants