Skip to main content
Glama
HenkDz

Self-Hosted Supabase MCP Server

list_realtime_publications

Lists PostgreSQL publications utilized by Supabase Realtime, enabling developers to manage and inspect real-time database interactions in self-hosted Supabase environments.

Instructions

Lists PostgreSQL publications, often used by Supabase Realtime.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function that executes the tool: queries pg_catalog.pg_publication using direct PostgreSQL client, validates response with Zod schema, and returns list of publications.
    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 empty input and output structure (array of publications with fields from pg_publication).
    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>;
  • src/index.ts:120-120 (registration)
    Registers the tool in the availableTools object, making it available to the MCP server.
    [listRealtimePublicationsTool.name]: listRealtimePublicationsTool as AppTool,

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