Skip to main content
Glama
abushadab

Self-Hosted Supabase MCP Server

by abushadab

list_migrations

Track and display applied database migrations from the supabase_migrations.schema_migrations table for self-hosted Supabase instances. Useful for managing and verifying database schema changes.

Instructions

Lists applied database migrations recorded in supabase_migrations.schema_migrations table.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the tool logic: queries the database for applied migrations using a SQL statement and processes the response.
    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 defining the output structure: an array of migration objects containing version, name, and inserted_at.
    const ListMigrationsOutputSchema = z.array(z.object({
        version: z.string(),
        name: z.string(),
        inserted_at: z.string(), // Keep as string from DB
    }));
  • Zod schema for input (empty object since no parameters required) and inferred type.
    const ListMigrationsInputSchema = z.object({});
    type ListMigrationsInput = z.infer<typeof ListMigrationsInputSchema>;
  • The tool object definition including name, description, schemas, and execute handler, exported for use in the MCP server.
    export const listMigrationsTool = {
        name: 'list_migrations',
        description: 'Lists applied database migrations recorded in supabase_migrations.schema_migrations table.',
        inputSchema: ListMigrationsInputSchema,
        mcpInputSchema: mcpInputSchema,
        outputSchema: ListMigrationsOutputSchema,
        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);
        },
    }; 
  • src/index.ts:102-102 (registration)
    Registers the listMigrationsTool in the availableTools map used to populate MCP server capabilities.
    [listMigrationsTool.name]: listMigrationsTool as AppTool,
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it 'Lists' but doesn't clarify if this is a read-only operation, what permissions are needed, how results are formatted, or if there are rate limits. The description is minimal and misses key behavioral details for a tool that interacts with database metadata.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any fluff. It is front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of database migrations and the lack of annotations and output schema, the description is insufficient. It doesn't explain what information is returned (e.g., migration names, timestamps, statuses), how to interpret the results, or any limitations, leaving gaps for an AI agent to use the tool effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The description appropriately avoids redundant information, earning a baseline score of 4 for not adding unnecessary parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Lists') and resource ('applied database migrations recorded in supabase_migrations.schema_migrations table'), distinguishing it from siblings like list_tables or list_extensions by focusing on migrations. It provides precise scope and location information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers no guidance on when to use this tool versus alternatives like list_tables or apply_migration. It lacks context about prerequisites, such as whether migrations need to be applied first, or when this tool is most relevant in a workflow.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/abushadab/selfhosted-supabase-mcp-basic-auth'

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