Skip to main content
Glama
20251015000001_create_api_keys_table.sql1.03 kB
-- Migration: Create api_keys table for MCP authentication -- Date: 2025-10-15 -- Create api_keys table CREATE TABLE IF NOT EXISTS api_keys ( id TEXT PRIMARY KEY DEFAULT gen_random_uuid()::TEXT, organization_id TEXT NOT NULL, key_hash TEXT NOT NULL UNIQUE, name TEXT NOT NULL, created_by_user_id UUID, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ, last_used_at TIMESTAMPTZ, is_active BOOLEAN NOT NULL DEFAULT true, CHECK (length(key_hash) = 64) ); -- Create indexes CREATE INDEX IF NOT EXISTS idx_api_keys_org ON api_keys(organization_id); CREATE INDEX IF NOT EXISTS idx_api_keys_hash ON api_keys(key_hash) WHERE is_active = true; CREATE INDEX IF NOT EXISTS idx_api_keys_active ON api_keys(organization_id, is_active) WHERE is_active = true; -- Enable RLS ALTER TABLE api_keys ENABLE ROW LEVEL SECURITY; -- Create RLS policy for service role CREATE POLICY "Service role has full access to api_keys" ON api_keys FOR ALL TO service_role USING (true) WITH CHECK (true);

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/darrentmorgan/hostaway-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server