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';

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