Skip to main content
Glama
abushadab

Self-Hosted Supabase MCP Server

by abushadab

list_realtime_publications

Retrieve PostgreSQL publications configured for Supabase Realtime to monitor and manage real-time data synchronization in self-hosted Supabase instances.

Instructions

Lists PostgreSQL publications, often used by Supabase Realtime.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute handler function that performs the tool logic: checks for direct PG connection, executes SQL query on pg_catalog.pg_publication, processes and validates the response using handleSqlResponse and Zod schema.
    execute: async (
        input: ListRealtimePublicationsInput,
        context: ToolContext
    ): Promise<ListRealtimePublicationsOutput> => {
        const client = context.selfhostedClient;
        console.error('Listing Realtime publications...');
    
        // Direct DB connection likely needed for pg_catalog access
        if (!client.isPgAvailable()) {
            context.log('Direct database connection (DATABASE_URL) is required to list publications.', 'error');
            throw new Error('Direct database connection (DATABASE_URL) is required to list publications.');
        }
    
        const sql = `
            SELECT
                oid,
                pubname,
                pubowner,
                puballtables,
                pubinsert,
                pubupdate,
                pubdelete,
                pubtruncate,
                pubviaroot
            FROM pg_catalog.pg_publication;
        `;
    
        console.error('Attempting to list publications using direct DB connection...');
        // Use executeSqlWithPg as it's a simple read query without parameters
        const result = await client.executeSqlWithPg(sql);
    
        const validatedPublications = handleSqlResponse(result, ListRealtimePublicationsOutputSchema);
    
        console.error(`Found ${validatedPublications.length} publications.`);
        context.log(`Found ${validatedPublications.length} publications.`);
        return validatedPublications;
    },
  • Zod schemas defining the input (empty object), output Publication model based on pg_publication columns, and output as array of Publications.
    // Input schema (no parameters needed)
    const ListRealtimePublicationsInputSchema = z.object({});
    type ListRealtimePublicationsInput = z.infer<typeof ListRealtimePublicationsInputSchema>;
    
    // Output schema based on pg_publication columns
    const PublicationSchema = z.object({
        oid: z.number().int(),
        pubname: z.string(),
        pubowner: z.number().int(), // Owner OID
        puballtables: z.boolean(),
        pubinsert: z.boolean(),
        pubupdate: z.boolean(),
        pubdelete: z.boolean(),
        pubtruncate: z.boolean(),
        pubviaroot: z.boolean(),
        // Potentially add pubownername if needed via join
    });
    const ListRealtimePublicationsOutputSchema = z.array(PublicationSchema);
    type ListRealtimePublicationsOutput = z.infer<typeof ListRealtimePublicationsOutputSchema>;
  • Static JSON schema for MCP tool input, as required by the protocol (empty object).
    // Static JSON schema for MCP (no parameters)
    export const mcpInputSchema = {
        type: 'object',
        properties: {},
        required: [],
    };
  • src/index.ts:120-120 (registration)
    Registration of the list_realtime_publications tool in the availableTools object, which is used to populate the MCP server's tool capabilities.
    [listRealtimePublicationsTool.name]: listRealtimePublicationsTool as AppTool,
  • src/index.ts:34-34 (registration)
    Import of the list_realtime_publications tool module.
    import listRealtimePublicationsTool from './tools/list_realtime_publications.js';
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool lists publications but doesn't describe what format the output takes, whether it's paginated, if it requires specific permissions, or any rate limits. For a tool with zero annotation coverage, this is insufficient behavioral context.

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 perfectly concise at one sentence with zero wasted words. It front-loads the core purpose ('Lists PostgreSQL publications') and adds only relevant supplemental context. Every word earns its place in this efficient description.

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 lack of annotations and output schema, the description is incomplete for proper tool usage. While it states what the tool does, it doesn't explain what the output looks like, any behavioral constraints, or how results are structured. For a listing tool in a database context, more completeness is needed.

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 zero parameters with 100% schema coverage, so the schema already fully documents the empty parameter set. The description appropriately doesn't waste space discussing nonexistent parameters, earning a baseline score above minimum viable. It could mention that no filtering parameters are available, but this isn't required.

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

Purpose4/5

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

The description clearly states the tool's purpose as 'Lists PostgreSQL publications' with the specific resource identified. It adds context about Supabase Realtime usage, which helps distinguish it from generic database listing tools. However, it doesn't explicitly differentiate from sibling tools like list_tables or list_extensions, keeping it from a perfect score.

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 provides no guidance on when to use this tool versus alternatives. While it mentions Supabase Realtime context, it doesn't specify prerequisites, timing considerations, or comparisons with other listing tools in the sibling set. This leaves the agent without usage direction.

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