- Add healthCheck spec to templates and servers (tool, arguments, interval, timeout, failureThreshold) - Add healthStatus, lastHealthCheck, events fields to instances - Create grafana, home-assistant, node-red templates with healthcheck probes - Add healthcheck probes to existing templates (github, slack, postgres, jira) - Show HEALTH column in `get instances` and Events section in `describe instance` - Display healthCheck details in `describe server` and `describe template` - Schema + storage + display only; actual probe runner is future work Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
185 lines
4.0 KiB
Plaintext
185 lines
4.0 KiB
Plaintext
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
// ── Users ──
|
|
|
|
model User {
|
|
id String @id @default(cuid())
|
|
email String @unique
|
|
name String?
|
|
passwordHash String
|
|
role Role @default(USER)
|
|
version Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
sessions Session[]
|
|
auditLogs AuditLog[]
|
|
projects Project[]
|
|
|
|
@@index([email])
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
}
|
|
|
|
// ── Sessions ──
|
|
|
|
model Session {
|
|
id String @id @default(cuid())
|
|
token String @unique
|
|
userId String
|
|
expiresAt DateTime
|
|
createdAt DateTime @default(now())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([token])
|
|
@@index([userId])
|
|
@@index([expiresAt])
|
|
}
|
|
|
|
// ── MCP Servers ──
|
|
|
|
model McpServer {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
description String @default("")
|
|
packageName String?
|
|
dockerImage String?
|
|
transport Transport @default(STDIO)
|
|
repositoryUrl String?
|
|
externalUrl String?
|
|
command Json?
|
|
containerPort Int?
|
|
replicas Int @default(1)
|
|
env Json @default("[]")
|
|
healthCheck Json?
|
|
version Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
templateName String?
|
|
templateVersion String?
|
|
|
|
instances McpInstance[]
|
|
|
|
@@index([name])
|
|
}
|
|
|
|
enum Transport {
|
|
STDIO
|
|
SSE
|
|
STREAMABLE_HTTP
|
|
}
|
|
|
|
// ── MCP Templates ──
|
|
|
|
model McpTemplate {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
version String @default("1.0.0")
|
|
description String @default("")
|
|
packageName String?
|
|
dockerImage String?
|
|
transport Transport @default(STDIO)
|
|
repositoryUrl String?
|
|
externalUrl String?
|
|
command Json?
|
|
containerPort Int?
|
|
replicas Int @default(1)
|
|
env Json @default("[]")
|
|
healthCheck Json?
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([name])
|
|
}
|
|
|
|
// ── Secrets ──
|
|
|
|
model Secret {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
data Json @default("{}")
|
|
version Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@index([name])
|
|
}
|
|
|
|
// ── Projects ──
|
|
|
|
model Project {
|
|
id String @id @default(cuid())
|
|
name String @unique
|
|
description String @default("")
|
|
ownerId String
|
|
version Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([name])
|
|
@@index([ownerId])
|
|
}
|
|
|
|
// ── MCP Instances (running containers) ──
|
|
|
|
model McpInstance {
|
|
id String @id @default(cuid())
|
|
serverId String
|
|
containerId String?
|
|
status InstanceStatus @default(STOPPED)
|
|
port Int?
|
|
metadata Json @default("{}")
|
|
healthStatus String?
|
|
lastHealthCheck DateTime?
|
|
events Json @default("[]")
|
|
version Int @default(1)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
server McpServer @relation(fields: [serverId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([serverId])
|
|
@@index([status])
|
|
}
|
|
|
|
enum InstanceStatus {
|
|
STARTING
|
|
RUNNING
|
|
STOPPING
|
|
STOPPED
|
|
ERROR
|
|
}
|
|
|
|
// ── Audit Logs ──
|
|
|
|
model AuditLog {
|
|
id String @id @default(cuid())
|
|
userId String
|
|
action String
|
|
resource String
|
|
resourceId String?
|
|
details Json @default("{}")
|
|
createdAt DateTime @default(now())
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@index([userId])
|
|
@@index([action])
|
|
@@index([resource])
|
|
@@index([createdAt])
|
|
}
|