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;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the tool returns a key but doesn't disclose behavioral traits like whether it's read-only, safe to call frequently, requires permissions, or what format the key is in (e.g., string, JSON).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally complete. However, it lacks context on usage scenarios or output details, which could help an agent understand when and how to apply it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, so no parameter semantics are needed. The baseline for 0 parameters is 4, as the description adequately covers the tool's purpose without unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Returns') and resource ('configured Supabase anon key for this server'), distinguishing it from siblings like get_service_key or get_project_url by focusing on the anon key specifically.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. It doesn't mention use cases like authentication setup, API access, or why one might choose this over get_service_key or other key-related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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