Database
infrastrActure uses PostgreSQL with SQL migrations and an explicit schema model.
Current State
There are two names you need to keep separate:
| Layer | Current Name |
|---|---|
| product / repo / runtime identity | infrastrActure |
| live PostgreSQL schema still in use | mcp_manager |
The schema name is still legacy on purpose. It has not been renamed yet because that requires a dedicated DB migration and rollout window.
Connection Settings
| Variable | Purpose |
|---|---|
DB_HOST / POSTGRES_HOST | PostgreSQL host |
DB_PORT / POSTGRES_PORT | PostgreSQL port |
DB_NAME / POSTGRES_DB | database name |
DB_USER / POSTGRES_USER | role |
DB_PASSWORD / POSTGRES_PASSWORD | password |
DB_SCHEMA / POSTGRES_SCHEMA | schema |
Core Tables
The exact schema evolves by migration, but the platform currently centers on:
| Table | Purpose |
|---|---|
mcp_tools | discovered catalog entries |
user_tool_installations | user/tenant runtimes |
shared_tools | shared tool runtime state |
sandboxes | sandbox lifecycle |
api_keys | instance-bound key hashes + tiers |
oauth_states | short-lived OAuth state |
system_tool_oauth_states | shared-tool auth state tracking |
infra_approval_leases | infra SSH admin sessions |
infra_ssh_audit_events | audited infra SSH activity |
schema_migrations | migration ledger |
Migration Model
Rules:
- ordered by filename prefix
- applied once
- tracked in
schema_migrations - designed to be idempotent and operationally safe
Local Development
npm run db:up
npm run db:migrate:dev
Production
npm run db:migrate
Reference Schema
The consolidated reference is in:
Use the migrations as the source of rollout order, and schema.sql as the convenient full snapshot.