get_anon_key
Retrieve the configured Supabase anon key to enable secure interactions with a self-hosted Supabase instance via MCP clients for database management and development tasks.
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 execute function implementing the core logic of the 'get_anon_key' tool, which extracts the anon key from the provided client context.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:5-12 (schema)Zod schemas defining the empty input and output structure (anon_key string) for the get_anon_key tool.// Input schema (none needed) const GetAnonKeyInputSchema = z.object({}); type GetAnonKeyInput = z.infer<typeof GetAnonKeyInputSchema>; // Output schema const GetAnonKeyOutputSchema = z.object({ anon_key: z.string(), });
- src/index.ts:107-109 (registration)Registration of the getAnonKeyTool in the availableTools object used by the MCP server.[getProjectUrlTool.name]: getProjectUrlTool as AppTool, [getAnonKeyTool.name]: getAnonKeyTool as AppTool, [getServiceKeyTool.name]: getServiceKeyTool as AppTool,
- src/client/index.ts:347-349 (helper)Helper method on SelfhostedSupabaseClient that provides the anon key, used by the tool handler.public getAnonKey(): string { return this.options.supabaseAnonKey; }
- src/index.ts:19-19 (registration)Import statement for the getAnonKeyTool in the main index file.import { getAnonKeyTool } from './tools/get_anon_key.js';