Skip to content

MCP API Keys Table

Overview

Table for managing MCP API key information

Table Definition

Logical Name Physical Name Column Name Data Type Primary Key Relation Unique Nullable Default Value Remarks
MCP API Key Information mcp_api_keys id serial โ—ฏ
user_id string โ—ฏ Logical: user.cognito_sub (no FK)
project_id number project:id โ—ฏ
name string
key_prefix string โ—ฏ
key_hash string โ—ฏ
salt string โ—ฏ
permission enum '0' mcp_api_key_permission ('0', '1')
expires_at datetime โ—ฏ
revoked_at datetime โ—ฏ
last_used_at datetime โ—ฏ
created_at datetime โ—ฏ
updated_at datetime
deleted_at datetime โ—ฏ
created_by string
updated_by string
deleted_by string โ—ฏ

Relations

  • user_id โ†’ user.cognito_sub (application-level; not an FK in schema)
  • project_id โ†’ project.id (on delete/update cascade from model)

Indexes

  • PRIMARY KEY (id)
  • UNIQUE (key_prefix)
  • UNIQUE (key_hash)
  • UNIQUE (salt)
  • INDEX mcp_api_keys_user_id_idx (user_id)
  • INDEX mcp_api_keys_project_id_idx (project_id)

Notes

  • At least one of user_id or project_id must be set (enforced in application; both columns nullable in DB)
  • updated_at is NOT NULL with default CURRENT_TIMESTAMP in schema