Skip to main content
Glama
HenkDz

Self-Hosted Supabase MCP Server

list_migrations

View applied database migrations to track schema changes and deployment history in self-hosted Supabase instances.

Instructions

Lists applied database migrations recorded in supabase_migrations.schema_migrations table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function that runs an SQL query to list applied Supabase migrations from the schema_migrations table, handles potential errors if the table doesn't exist, and returns the parsed result.
    execute: async (input: ListMigrationsInput, context: ToolContext) => { const client = context.selfhostedClient; // SQL to query the Supabase migrations table const listMigrationsSql = ` SELECT version, name, inserted_at FROM supabase_migrations.schema_migrations ORDER BY version `; // This table might not exist if migrations haven't been run // The RPC call will handle the error, which handleSqlResponse will catch const result = await executeSqlWithFallback(client, listMigrationsSql, true); return handleSqlResponse(result, ListMigrationsOutputSchema); },
  • Zod schema for the tool's output: an array of objects containing migration version, name, and inserted_at timestamp.
    const ListMigrationsOutputSchema = z.array(z.object({ version: z.string(), name: z.string(), inserted_at: z.string(), // Keep as string from DB }));
  • Zod schema for the tool's input (empty object, no parameters required).
    const ListMigrationsInputSchema = z.object({}); type ListMigrationsInput = z.infer<typeof ListMigrationsInputSchema>;
  • src/index.ts:102-102 (registration)
    Registration of the listMigrationsTool in the availableTools object used by the MCP server.
    [listMigrationsTool.name]: listMigrationsTool as AppTool,
  • src/index.ts:13-13 (registration)
    Import of the listMigrationsTool for registration in the main index file.
    import { listMigrationsTool } from './tools/list_migrations.js';

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/HenkDz/selfhosted-supabase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server