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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get_anon_key.ts:28-32 (handler)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 }; },
- src/tools/get_anon_key.ts:6-19 (schema)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: [], };
- src/tools/get_anon_key.ts:22-33 (registration)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,
- src/client/index.ts:347-349 (helper)Getter method on SelfhostedSupabaseClient class that returns the configured Supabase anon key, used by the tool handler.public getAnonKey(): string { return this.options.supabaseAnonKey; }