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_idorproject_idmust be set (enforced in application; both columns nullable in DB) updated_atis NOT NULL with defaultCURRENT_TIMESTAMPin schema