Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ PYMTHOUSE_ALLOW_INSECURE_HTTP=
# PYMTHOUSE_SIGNER_URL=https://signer.pymthouse.com
# Non-prod mint requires PYMTHOUSE_PUBLIC_CLIENT_ID=app_98575870d7ae33589a3f0660

# Neon Postgres. Local: `pnpm db:migrate`. Production: GitHub Actions
# `.github/workflows/deploy-production-vercel.yml` (not the Vercel build).
# DATABASE_URL=postgresql://USER:PASSWORD@HOST/neondb?sslmode=require

# Invite-only Console HTML (/home, /usage, /keys, /calls, /settings).
# Empty = no gate. Comma-separated emails, matched case-insensitively.
# CONSOLE_EMAIL_ALLOWLIST=alice@livepeer.org,bob@studio.com
37 changes: 37 additions & 0 deletions db/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
index,
pgTable,
text,
timestamp,
uniqueIndex,
} from "drizzle-orm/pg-core";

/** MCP-produced media URLs, scoped per console/MCP principal (`eu_…`). */
export const mcpAssets = pgTable(
"mcp_assets",
{
id: text("id").primaryKey(),
principalId: text("principal_id").notNull(),
url: text("url").notNull(),
capability: text("capability").notNull(),
gatewayRequestId: text("gateway_request_id").notNull(),
providerRequestId: text("provider_request_id"),
createdAt: timestamp("created_at", { withTimezone: true, mode: "date" })
.notNull()
.defaultNow(),
},
(table) => [
uniqueIndex("mcp_assets_job_url_unique").on(
table.gatewayRequestId,
table.url
),
index("mcp_assets_principal_created_idx").on(
table.principalId,
table.createdAt.desc()
),
index("mcp_assets_principal_capability_idx").on(
table.principalId,
table.capability
),
]
);
12 changes: 12 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from "drizzle-kit";

export default defineConfig({
schema: "./db/schema.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
url:
process.env.DATABASE_URL?.trim() ||
"postgresql://unused:unused@localhost/unused",
},
});
13 changes: 13 additions & 0 deletions drizzle/0000_warm_hellfire_club.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CREATE TABLE IF NOT EXISTS "mcp_assets" (
"id" text PRIMARY KEY NOT NULL,
"principal_id" text NOT NULL,
"url" text NOT NULL,
"capability" text NOT NULL,
"gateway_request_id" text NOT NULL,
"provider_request_id" text,
"created_at" timestamp with time zone DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX IF NOT EXISTS "mcp_assets_job_url_unique" ON "mcp_assets" USING btree ("gateway_request_id","url");--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "mcp_assets_principal_created_idx" ON "mcp_assets" USING btree ("principal_id","created_at" DESC NULLS LAST);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "mcp_assets_principal_capability_idx" ON "mcp_assets" USING btree ("principal_id","capability");
139 changes: 139 additions & 0 deletions drizzle/meta/0000_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"id": "c8a7fdb3-fc88-4d53-a2d4-38c75c9f02e1",
"prevId": "00000000-0000-0000-0000-000000000000",
"version": "7",
"dialect": "postgresql",
"tables": {
"public.mcp_assets": {
"name": "mcp_assets",
"schema": "",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true
},
"principal_id": {
"name": "principal_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"url": {
"name": "url",
"type": "text",
"primaryKey": false,
"notNull": true
},
"capability": {
"name": "capability",
"type": "text",
"primaryKey": false,
"notNull": true
},
"gateway_request_id": {
"name": "gateway_request_id",
"type": "text",
"primaryKey": false,
"notNull": true
},
"provider_request_id": {
"name": "provider_request_id",
"type": "text",
"primaryKey": false,
"notNull": false
},
"created_at": {
"name": "created_at",
"type": "timestamp with time zone",
"primaryKey": false,
"notNull": true,
"default": "now()"
}
},
"indexes": {
"mcp_assets_job_url_unique": {
"name": "mcp_assets_job_url_unique",
"columns": [
{
"expression": "gateway_request_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "url",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": true,
"concurrently": false,
"method": "btree",
"with": {}
},
"mcp_assets_principal_created_idx": {
"name": "mcp_assets_principal_created_idx",
"columns": [
{
"expression": "principal_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "created_at",
"isExpression": false,
"asc": false,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
},
"mcp_assets_principal_capability_idx": {
"name": "mcp_assets_principal_capability_idx",
"columns": [
{
"expression": "principal_id",
"isExpression": false,
"asc": true,
"nulls": "last"
},
{
"expression": "capability",
"isExpression": false,
"asc": true,
"nulls": "last"
}
],
"isUnique": false,
"concurrently": false,
"method": "btree",
"with": {}
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
}
},
"enums": {},
"schemas": {},
"sequences": {},
"roles": {},
"policies": {},
"views": {},
"_meta": {
"columns": {},
"schemas": {},
"tables": {}
}
}
13 changes: 13 additions & 0 deletions drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1788578134136,
"tag": "0000_warm_hellfire_club",
"breakpoints": true
}
]
}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
"lint": "eslint . --max-warnings 0",
"typecheck": "tsc --noEmit --incremental false",
"format": "prettier . --write",
"format:check": "prettier . --check"
"format:check": "prettier . --check",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate"
},
"dependencies": {
"@auth0/nextjs-auth0": "^4.27.0",
"@modelcontextprotocol/sdk": "^1.30.0",
"@pymthouse/builder-sdk": "^0.6.5",
"@pymthouse/gateway-web": "0.3.2",
"drizzle-orm": "^0.45.2",
"framer-motion": "^11.15.0",
"geist": "^1.7.0",
"jose": "^6.2.10",
Expand All @@ -37,6 +40,7 @@
"@types/node": "^22.0.0",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"drizzle-kit": "^0.31.10",
"eslint": "^9",
"eslint-config-next": "^15.1.0",
"eslint-config-prettier": "^10.1.8",
Expand Down
Loading