Skip to main content
Glama
abushadab

Self-Hosted Supabase MCP Server

by abushadab

get_anon_key

Retrieve the configured Supabase anon key from a self-hosted MCP server to securely interact with its Supabase instance for database queries, migrations, and feature management.

Instructions

Returns the configured Supabase anon key for this server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The async execute function implementing the get_anon_key tool logic. It retrieves the SelfhostedSupabaseClient from context and calls its getAnonKey() method to return the anon key.
    execute: async (input: GetAnonKeyInput, context: ToolContext) => { const client = context.selfhostedClient; const key = client.getAnonKey(); // Use getter from client return { anon_key: key }; },
  • Zod schemas defining empty input, output with anon_key string field, and static MCP input schema (empty object).
    const GetAnonKeyInputSchema = z.object({}); type GetAnonKeyInput = z.infer<typeof GetAnonKeyInputSchema>; // Output schema const GetAnonKeyOutputSchema = z.object({ anon_key: z.string(), }); // Static JSON Schema for MCP capabilities const mcpInputSchema = { type: 'object', properties: {}, required: [], };
  • Definition and export of the getAnonKeyTool object, which includes name, description, schemas, and execute handler. This is imported and registered elsewhere.
    export const getAnonKeyTool = { name: 'get_anon_key', description: 'Returns the configured Supabase anon key for this server.', inputSchema: GetAnonKeyInputSchema, mcpInputSchema: mcpInputSchema, outputSchema: GetAnonKeyOutputSchema, execute: async (input: GetAnonKeyInput, context: ToolContext) => { const client = context.selfhostedClient; const key = client.getAnonKey(); // Use getter from client return { anon_key: key }; }, };
  • src/index.ts:108-108 (registration)
    Registration of getAnonKeyTool in the availableTools object used by the MCP server.
    [getAnonKeyTool.name]: getAnonKeyTool as AppTool,
  • Getter method on SelfhostedSupabaseClient class that returns the configured Supabase anon key, used by the tool handler.
    public getAnonKey(): string { return this.options.supabaseAnonKey; }

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