upres-cli 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.cjs CHANGED
@@ -27,85 +27,55 @@ __export(mcp_exports, {
27
27
  module.exports = __toCommonJS(mcp_exports);
28
28
 
29
29
  // src/models.ts
30
+ function scaleParam(maxScale) {
31
+ if (maxScale <= 1) return [];
32
+ const options = [];
33
+ for (let step = 2; step <= maxScale; step *= 2) options.push(step);
34
+ return [
35
+ {
36
+ name: "scale",
37
+ type: "integer",
38
+ required: false,
39
+ default: 4,
40
+ options,
41
+ description: "Scale multiplier. Ignored when the alias does not enlarge."
42
+ }
43
+ ];
44
+ }
45
+ function model(id, name, description, category, inputTypes, maxScale) {
46
+ const fileParam = category.startsWith("video") ? { name: "video", type: "string", required: true, description: "Video URL or file" } : category.startsWith("audio") ? { name: "audio", type: "string", required: true, description: "Audio URL or file" } : { name: "image", type: "string", required: true, description: "Image URL or file" };
47
+ return {
48
+ id,
49
+ name,
50
+ description,
51
+ category,
52
+ price: "One credit per stage that runs",
53
+ inputTypes,
54
+ params: [fileParam, ...scaleParam(maxScale)]
55
+ };
56
+ }
30
57
  var MODELS = [
31
- {
32
- id: "flare",
33
- name: "Flare",
34
- description: "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.",
35
- category: "image-upscale",
36
- price: "Included in plan quota",
37
- inputTypes: ["image/*"],
38
- params: [
39
- { name: "image", type: "string", required: true, description: "Image URL or file" },
40
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
41
- ]
42
- },
43
- {
44
- id: "prism",
45
- name: "Prism",
46
- description: "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.",
47
- category: "image-upscale",
48
- price: "Included in plan quota",
49
- inputTypes: ["image/*"],
50
- params: [
51
- { name: "image", type: "string", required: true, description: "Image URL or file" },
52
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
53
- ]
54
- },
55
- {
56
- id: "lumen",
57
- name: "Lumen",
58
- description: "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.",
59
- category: "image-upscale",
60
- price: "Included in plan quota",
61
- inputTypes: ["image/*"],
62
- params: [
63
- { name: "image", type: "string", required: true, description: "Image URL or file" },
64
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
65
- ]
66
- },
67
- {
68
- id: "mirage",
69
- name: "Mirage",
70
- description: "Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.",
71
- category: "image-enhance",
72
- price: "Included in plan quota",
73
- inputTypes: ["image/*"],
74
- params: [
75
- { name: "image", type: "string", required: true, description: "Image URL or file" },
76
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
77
- ]
78
- },
79
- {
80
- id: "motion",
81
- name: "Motion",
82
- description: "Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.",
83
- category: "video-upscale",
84
- price: "Counts against monthly video minutes",
85
- inputTypes: ["video/*"],
86
- params: [
87
- { name: "video", type: "string", required: true, description: "Video URL or file" },
88
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
89
- ]
90
- },
91
- {
92
- id: "motion-x",
93
- name: "Motion X",
94
- description: "Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.",
95
- category: "video-upscale",
96
- price: "Counts against monthly video minutes",
97
- inputTypes: ["video/*"],
98
- params: [
99
- { name: "video", type: "string", required: true, description: "Video URL or file" },
100
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
101
- ]
102
- }
58
+ model("flare", "Flare", "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.", "image-upscale", ["image/*"], 4),
59
+ model("prism", "Prism", "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.", "image-upscale", ["image/*"], 4),
60
+ model("lumen", "Lumen", "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.", "image-upscale", ["image/*"], 8),
61
+ model("mirage", "Mirage", "Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.", "image-upscale", ["image/*"], 8),
62
+ model("hush", "Hush", "Faithful denoise. Same size as the source, nothing invented.", "image-clean", ["image/*"], 1),
63
+ model("keen", "Keen", "Deblur and sharpen. Same size as the source, does not invent texture.", "image-restore", ["image/*"], 1),
64
+ model("visage", "Visage", "Restores faces and leaves the rest of the frame alone. Does not enlarge.", "image-restore", ["image/*"], 1),
65
+ model("atelier", "Atelier", "Hush, then Visage if the photo looks like a portrait, then Lumen. A skipped face stage is free.", "image-studio", ["image/*"], 8),
66
+ model("motion", "Motion", "Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.", "video-upscale", ["video/*"], 4),
67
+ model("motion-x", "Motion X", "Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.", "video-upscale", ["video/*"], 4),
68
+ model("still", "Still", "Temporal video denoise. Resolution stays put.", "video-clean", ["video/*"], 1),
69
+ model("cadence", "Cadence", "Frame interpolation. Does not enlarge the picture.", "video-restore", ["video/*"], 1),
70
+ model("atelier-x", "Atelier X", "Still, then Motion X. Two credits.", "video-studio", ["video/*"], 4),
71
+ model("voice", "Voice", "Speech denoise and bandwidth extension to 48 kHz. Not for music.", "audio-clean", ["audio/*"], 1)
103
72
  ];
104
- var IMAGE_MODELS = MODELS.filter((m) => m.category !== "video-upscale");
105
- var VIDEO_MODELS = MODELS.filter((m) => m.category === "video-upscale");
73
+ var IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith("image"));
74
+ var VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith("video"));
75
+ var AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith("audio"));
106
76
 
107
77
  // src/mcp.ts
108
- var VERSION = "0.2.0";
78
+ var VERSION = "0.3.0";
109
79
  var DEFAULT_BASE_URL = "https://api.upres.ai/v1";
110
80
  function apiKey() {
111
81
  return process.env.UPRES_API_KEY ?? "";
@@ -135,7 +105,7 @@ async function api(method, endpoint, body) {
135
105
  var TOOLS = [
136
106
  {
137
107
  name: "upres_list_models",
138
- description: "List UpRes upscale models (flare, prism, lumen, mirage, motion, motion-x) with use cases.",
108
+ description: "List the 14 public UpRes aliases for image, video, and speech.",
139
109
  inputSchema: { type: "object", properties: {}, additionalProperties: false }
140
110
  },
141
111
  {
@@ -145,17 +115,17 @@ var TOOLS = [
145
115
  },
146
116
  {
147
117
  name: "upres_upscale_image",
148
- description: "Submit an image upscale job from a public URL. Models: flare, prism, lumen, mirage.",
118
+ description: "Submit an image job from a public URL. Upscale: flare, prism, lumen, mirage. Restore: hush, keen, visage, atelier. Scale is ignored when the alias does not enlarge.",
149
119
  inputSchema: {
150
120
  type: "object",
151
121
  properties: {
152
122
  image_url: { type: "string", description: "Public HTTPS URL of the image" },
153
123
  model: {
154
124
  type: "string",
155
- enum: ["flare", "prism", "lumen", "mirage"],
156
- description: "Image model. Default flare."
125
+ enum: IMAGE_MODELS.map((m) => m.id),
126
+ description: "Image alias. Default flare."
157
127
  },
158
- scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4." }
128
+ scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4. Ignored for hush, keen, and visage." }
159
129
  },
160
130
  required: ["image_url"],
161
131
  additionalProperties: false
@@ -163,22 +133,39 @@ var TOOLS = [
163
133
  },
164
134
  {
165
135
  name: "upres_upscale_video",
166
- description: "Submit a video upscale job from a public URL. Models: motion, motion-x.",
136
+ description: "Submit a video job from a public URL. motion and motion-x upscale. still denoises, cadence interpolates frames, atelier-x runs still then motion-x.",
167
137
  inputSchema: {
168
138
  type: "object",
169
139
  properties: {
170
140
  video_url: { type: "string", description: "Public HTTPS URL of the video" },
171
141
  model: {
172
142
  type: "string",
173
- enum: ["motion", "motion-x"],
174
- description: "Video model. Default motion."
143
+ enum: VIDEO_MODELS.map((m) => m.id),
144
+ description: "Video alias. Default motion."
175
145
  },
176
- scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4." }
146
+ scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4. Ignored for still and cadence." }
177
147
  },
178
148
  required: ["video_url"],
179
149
  additionalProperties: false
180
150
  }
181
151
  },
152
+ {
153
+ name: "upres_enhance_audio",
154
+ description: "Submit a speech job from a public URL. voice denoises speech and extends it to 48 kHz. Music is not supported.",
155
+ inputSchema: {
156
+ type: "object",
157
+ properties: {
158
+ audio_url: { type: "string", description: "Public HTTPS URL of wav, mp3, m4a, or flac speech" },
159
+ model: {
160
+ type: "string",
161
+ enum: AUDIO_MODELS.map((m) => m.id),
162
+ description: "Audio alias. Default voice."
163
+ }
164
+ },
165
+ required: ["audio_url"],
166
+ additionalProperties: false
167
+ }
168
+ },
182
169
  {
183
170
  name: "upres_get_job",
184
171
  description: "Get status and result_url of an UpRes job by id.",
@@ -241,6 +228,15 @@ async function callTool(name, args) {
241
228
  });
242
229
  return text(job);
243
230
  }
231
+ case "upres_enhance_audio": {
232
+ const audio_url = String(args.audio_url ?? "");
233
+ if (!audio_url) throw new Error("audio_url is required");
234
+ const job = await api("POST", "/jobs", {
235
+ image_url: audio_url,
236
+ model: args.model ?? "voice"
237
+ });
238
+ return text(job);
239
+ }
244
240
  case "upres_get_job": {
245
241
  const job_id = String(args.job_id ?? "");
246
242
  if (!job_id) throw new Error("job_id is required");
package/dist/mcp.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/mcp.ts","../src/models.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * UpRes MCP stdio server. Speaks JSON-RPC over stdin/stdout so Claude,\n * Cursor, and Hermes can upscale without a browser.\n *\n * UPRES_API_KEY=upres_... npx upres-cli mcp\n * claude mcp add upres -- npx -y upres-cli mcp\n */\nimport { MODELS } from \"./models.js\";\n\nconst VERSION = \"0.2.0\";\nconst DEFAULT_BASE_URL = \"https://api.upres.ai/v1\";\n\ntype Json = Record<string, unknown>;\n\nfunction apiKey(): string {\n return process.env.UPRES_API_KEY ?? \"\";\n}\n\nfunction baseUrl(): string {\n return process.env.UPRES_BASE_URL ?? DEFAULT_BASE_URL;\n}\n\nasync function api<T>(method: string, endpoint: string, body?: unknown): Promise<T> {\n const key = apiKey();\n if (!key) {\n throw new Error(\"UPRES_API_KEY is not set. Get a key at https://upres.ai/account/api-keys\");\n }\n const res = await fetch(`${baseUrl()}${endpoint}`, {\n method,\n headers: {\n Authorization: `Bearer ${key}`,\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n const data = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) {\n throw new Error(data.error ?? `HTTP ${res.status}`);\n }\n return data;\n}\n\nconst TOOLS = [\n {\n name: \"upres_list_models\",\n description:\n \"List UpRes upscale models (flare, prism, lumen, mirage, motion, motion-x) with use cases.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_get_credits\",\n description: \"Show recent job count for the authenticated UpRes API key as a quota proxy.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_upscale_image\",\n description: \"Submit an image upscale job from a public URL. Models: flare, prism, lumen, mirage.\",\n inputSchema: {\n type: \"object\",\n properties: {\n image_url: { type: \"string\", description: \"Public HTTPS URL of the image\" },\n model: {\n type: \"string\",\n enum: [\"flare\", \"prism\", \"lumen\", \"mirage\"],\n description: \"Image model. Default flare.\",\n },\n scale: { type: \"integer\", enum: [2, 4, 8], description: \"Scale multiplier. Default 4.\" },\n },\n required: [\"image_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_upscale_video\",\n description: \"Submit a video upscale job from a public URL. Models: motion, motion-x.\",\n inputSchema: {\n type: \"object\",\n properties: {\n video_url: { type: \"string\", description: \"Public HTTPS URL of the video\" },\n model: {\n type: \"string\",\n enum: [\"motion\", \"motion-x\"],\n description: \"Video model. Default motion.\",\n },\n scale: { type: \"integer\", enum: [2, 4], description: \"Scale multiplier. Default 4.\" },\n },\n required: [\"video_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_get_job\",\n description: \"Get status and result_url of an UpRes job by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n job_id: { type: \"string\", description: \"Job UUID returned by an upscale tool\" },\n },\n required: [\"job_id\"],\n additionalProperties: false,\n },\n },\n];\n\nfunction ok(id: unknown, result: unknown) {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction fail(id: unknown, code: number, message: string) {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction text(obj: unknown) {\n return { content: [{ type: \"text\", text: JSON.stringify(obj, null, 2) }] };\n}\n\nasync function callTool(name: string, args: Json): Promise<unknown> {\n switch (name) {\n case \"upres_list_models\":\n return text(\n MODELS.map((m) => ({\n id: m.id,\n name: m.name,\n category: m.category,\n description: m.description,\n })),\n );\n case \"upres_get_credits\": {\n const jobs = await api<{ data: { status: string }[] }>(\"GET\", \"/jobs?limit=100\");\n const data = jobs.data ?? [];\n return text({\n recent_jobs: data.length,\n completed: data.filter((j) => j.status === \"completed\").length,\n pricing: \"https://upres.ai/pricing\",\n });\n }\n case \"upres_upscale_image\": {\n const image_url = String(args.image_url ?? \"\");\n if (!image_url) throw new Error(\"image_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url,\n model: args.model ?? \"flare\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_upscale_video\": {\n const video_url = String(args.video_url ?? \"\");\n if (!video_url) throw new Error(\"video_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: video_url,\n model: args.model ?? \"motion\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_get_job\": {\n const job_id = String(args.job_id ?? \"\");\n if (!job_id) throw new Error(\"job_id is required\");\n const job = await api(\"GET\", `/jobs/${job_id}`);\n return text(job);\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n}\n\nasync function handle(msg: Json): Promise<Json | null> {\n const id = msg.id;\n const method = String(msg.method ?? \"\");\n if (msg.jsonrpc !== \"2.0\") return fail(id, -32600, \"Invalid Request\");\n\n if (method === \"initialize\") {\n return ok(id, {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"upres\", version: VERSION },\n });\n }\n if (method === \"notifications/initialized\" || method === \"initialized\") return null;\n if (method === \"ping\") return ok(id, {});\n if (method === \"tools/list\") return ok(id, { tools: TOOLS });\n if (method === \"tools/call\") {\n const params = (msg.params ?? {}) as Json;\n const name = String(params.name ?? \"\");\n const args = (params.arguments ?? {}) as Json;\n try {\n return ok(id, await callTool(name, args));\n } catch (e) {\n return ok(id, {\n isError: true,\n content: [{ type: \"text\", text: (e as Error).message }],\n });\n }\n }\n if (id === undefined) return null;\n return fail(id, -32601, `Method not found: ${method}`);\n}\n\nexport async function handleMessage(msg: Json): Promise<Json | null> {\n return handle(msg);\n}\n\nexport function startStdio(): void {\n let buf = \"\";\n process.stdin.setEncoding(\"utf8\");\n process.stdin.on(\"data\", async (chunk: string) => {\n buf += chunk;\n while (true) {\n const nl = buf.indexOf(\"\\n\");\n if (nl < 0) break;\n const line = buf.slice(0, nl).trim();\n buf = buf.slice(nl + 1);\n if (!line) continue;\n let msg: Json;\n try {\n msg = JSON.parse(line) as Json;\n } catch {\n continue;\n }\n const reply = await handle(msg);\n if (reply) process.stdout.write(JSON.stringify(reply) + \"\\n\");\n }\n });\n}\n","import type { ModelDefinition } from \"./types.js\";\n\n// Synced with https://api.upres.ai/v1/openapi.json (spec v1.1.0).\n// A job names one of six models. Which backend serves a model is ours to\n// choose and can change without notice — that is how a failing vendor\n// stops being your outage.\nexport const MODELS: ModelDefinition[] = [\n {\n id: \"flare\",\n name: \"Flare\",\n description: \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"prism\",\n name: \"Prism\",\n description: \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"lumen\",\n name: \"Lumen\",\n description: \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\",\n category: \"image-upscale\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"mirage\",\n name: \"Mirage\",\n description: \"Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.\",\n category: \"image-enhance\",\n price: \"Included in plan quota\",\n inputTypes: [\"image/*\"],\n params: [\n { name: \"image\", type: \"string\", required: true, description: \"Image URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4, 8], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion\",\n name: \"Motion\",\n description: \"Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n {\n id: \"motion-x\",\n name: \"Motion X\",\n description: \"Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.\",\n category: \"video-upscale\",\n price: \"Counts against monthly video minutes\",\n inputTypes: [\"video/*\"],\n params: [\n { name: \"video\", type: \"string\", required: true, description: \"Video URL or file\" },\n { name: \"scale\", type: \"integer\", required: false, default: 4, options: [2, 4], description: \"Scale multiplier\" },\n ],\n },\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category !== \"video-upscale\");\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category === \"video-upscale\");\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,SAA4B;AAAA,EACvC;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;AAAA,IACtB,QAAQ;AAAA,MACN,EAAE,MAAM,SAAS,MAAM,UAAU,UAAU,MAAM,aAAa,oBAAoB;AAAA,MAClF,EAAE,MAAM,SAAS,MAAM,WAAW,UAAU,OAAO,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,aAAa,mBAAmB;AAAA,IAClH;AAAA,EACF;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY,CAAC,SAAS;A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AsB,cAAc,KAAiC;AACnE,SAAO,OAAO,GAAG;AACnB;AAEO,SAAS,aAAmB;AACjC,MAAI,MAAM;AACV,UAAQ,MAAM,YAAY,MAAM;AAChC,UAAQ,MAAM,GAAG,QAAQ,OAAO,UAAkB;AAChD,WAAO;AACP,WAAO,MAAM;AACX,YAAM,KAAK,IAAI,QAAQ,IAAI;AAC3B,UAAI,KAAK,EAAG;AACZ,YAAM,OAAO,IAAI,MAAM,GAAG,EAAE,EAAE,KAAK;AACnC,YAAM,IAAI,MAAM,KAAK,CAAC;AACtB,UAAI,CAAC,KAAM;AACX,UAAI;AACJ,UAAI;AACF,cAAM,KAAK,MAAM,IAAI;AAAA,MACvB,QAAQ;AACN;AAAA,MACF;AACA,YAAM,QAAQ,MAAM,OAAO,GAAG;AAC9B,UAAI,MAAO,SAAQ,OAAO,MAAM,KAAK,UAAU,KAAK,IAAI,IAAI;AAAA,IAC9D;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/mcp.ts","../src/models.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * UpRes MCP stdio server. Speaks JSON-RPC over stdin/stdout so Claude,\n * Cursor, and Hermes can upscale without a browser.\n *\n * UPRES_API_KEY=upres_... npx upres-cli mcp\n * claude mcp add upres -- npx -y upres-cli mcp\n */\nimport { AUDIO_MODELS, IMAGE_MODELS, MODELS, VIDEO_MODELS } from \"./models.js\";\n\nconst VERSION = \"0.3.0\";\nconst DEFAULT_BASE_URL = \"https://api.upres.ai/v1\";\n\ntype Json = Record<string, unknown>;\n\nfunction apiKey(): string {\n return process.env.UPRES_API_KEY ?? \"\";\n}\n\nfunction baseUrl(): string {\n return process.env.UPRES_BASE_URL ?? DEFAULT_BASE_URL;\n}\n\nasync function api<T>(method: string, endpoint: string, body?: unknown): Promise<T> {\n const key = apiKey();\n if (!key) {\n throw new Error(\"UPRES_API_KEY is not set. Get a key at https://upres.ai/account/api-keys\");\n }\n const res = await fetch(`${baseUrl()}${endpoint}`, {\n method,\n headers: {\n Authorization: `Bearer ${key}`,\n ...(body ? { \"Content-Type\": \"application/json\" } : {}),\n },\n body: body ? JSON.stringify(body) : undefined,\n });\n const data = (await res.json().catch(() => ({}))) as T & { error?: string };\n if (!res.ok) {\n throw new Error(data.error ?? `HTTP ${res.status}`);\n }\n return data;\n}\n\nconst TOOLS = [\n {\n name: \"upres_list_models\",\n description: \"List the 14 public UpRes aliases for image, video, and speech.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_get_credits\",\n description: \"Show recent job count for the authenticated UpRes API key as a quota proxy.\",\n inputSchema: { type: \"object\", properties: {}, additionalProperties: false },\n },\n {\n name: \"upres_upscale_image\",\n description:\n \"Submit an image job from a public URL. Upscale: flare, prism, lumen, mirage. Restore: hush, keen, visage, atelier. Scale is ignored when the alias does not enlarge.\",\n inputSchema: {\n type: \"object\",\n properties: {\n image_url: { type: \"string\", description: \"Public HTTPS URL of the image\" },\n model: {\n type: \"string\",\n enum: IMAGE_MODELS.map((m) => m.id),\n description: \"Image alias. Default flare.\",\n },\n scale: { type: \"integer\", enum: [2, 4, 8], description: \"Scale multiplier. Default 4. Ignored for hush, keen, and visage.\" },\n },\n required: [\"image_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_upscale_video\",\n description:\n \"Submit a video job from a public URL. motion and motion-x upscale. still denoises, cadence interpolates frames, atelier-x runs still then motion-x.\",\n inputSchema: {\n type: \"object\",\n properties: {\n video_url: { type: \"string\", description: \"Public HTTPS URL of the video\" },\n model: {\n type: \"string\",\n enum: VIDEO_MODELS.map((m) => m.id),\n description: \"Video alias. Default motion.\",\n },\n scale: { type: \"integer\", enum: [2, 4], description: \"Scale multiplier. Default 4. Ignored for still and cadence.\" },\n },\n required: [\"video_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_enhance_audio\",\n description: \"Submit a speech job from a public URL. voice denoises speech and extends it to 48 kHz. Music is not supported.\",\n inputSchema: {\n type: \"object\",\n properties: {\n audio_url: { type: \"string\", description: \"Public HTTPS URL of wav, mp3, m4a, or flac speech\" },\n model: {\n type: \"string\",\n enum: AUDIO_MODELS.map((m) => m.id),\n description: \"Audio alias. Default voice.\",\n },\n },\n required: [\"audio_url\"],\n additionalProperties: false,\n },\n },\n {\n name: \"upres_get_job\",\n description: \"Get status and result_url of an UpRes job by id.\",\n inputSchema: {\n type: \"object\",\n properties: {\n job_id: { type: \"string\", description: \"Job UUID returned by an upscale tool\" },\n },\n required: [\"job_id\"],\n additionalProperties: false,\n },\n },\n];\n\nfunction ok(id: unknown, result: unknown) {\n return { jsonrpc: \"2.0\", id, result };\n}\n\nfunction fail(id: unknown, code: number, message: string) {\n return { jsonrpc: \"2.0\", id, error: { code, message } };\n}\n\nfunction text(obj: unknown) {\n return { content: [{ type: \"text\", text: JSON.stringify(obj, null, 2) }] };\n}\n\nasync function callTool(name: string, args: Json): Promise<unknown> {\n switch (name) {\n case \"upres_list_models\":\n return text(\n MODELS.map((m) => ({\n id: m.id,\n name: m.name,\n category: m.category,\n description: m.description,\n })),\n );\n case \"upres_get_credits\": {\n const jobs = await api<{ data: { status: string }[] }>(\"GET\", \"/jobs?limit=100\");\n const data = jobs.data ?? [];\n return text({\n recent_jobs: data.length,\n completed: data.filter((j) => j.status === \"completed\").length,\n pricing: \"https://upres.ai/pricing\",\n });\n }\n case \"upres_upscale_image\": {\n const image_url = String(args.image_url ?? \"\");\n if (!image_url) throw new Error(\"image_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url,\n model: args.model ?? \"flare\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_upscale_video\": {\n const video_url = String(args.video_url ?? \"\");\n if (!video_url) throw new Error(\"video_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: video_url,\n model: args.model ?? \"motion\",\n scale: args.scale ?? 4,\n });\n return text(job);\n }\n case \"upres_enhance_audio\": {\n const audio_url = String(args.audio_url ?? \"\");\n if (!audio_url) throw new Error(\"audio_url is required\");\n const job = await api(\"POST\", \"/jobs\", {\n image_url: audio_url,\n model: args.model ?? \"voice\",\n });\n return text(job);\n }\n case \"upres_get_job\": {\n const job_id = String(args.job_id ?? \"\");\n if (!job_id) throw new Error(\"job_id is required\");\n const job = await api(\"GET\", `/jobs/${job_id}`);\n return text(job);\n }\n default:\n throw new Error(`Unknown tool: ${name}`);\n }\n}\n\nasync function handle(msg: Json): Promise<Json | null> {\n const id = msg.id;\n const method = String(msg.method ?? \"\");\n if (msg.jsonrpc !== \"2.0\") return fail(id, -32600, \"Invalid Request\");\n\n if (method === \"initialize\") {\n return ok(id, {\n protocolVersion: \"2024-11-05\",\n capabilities: { tools: {} },\n serverInfo: { name: \"upres\", version: VERSION },\n });\n }\n if (method === \"notifications/initialized\" || method === \"initialized\") return null;\n if (method === \"ping\") return ok(id, {});\n if (method === \"tools/list\") return ok(id, { tools: TOOLS });\n if (method === \"tools/call\") {\n const params = (msg.params ?? {}) as Json;\n const name = String(params.name ?? \"\");\n const args = (params.arguments ?? {}) as Json;\n try {\n return ok(id, await callTool(name, args));\n } catch (e) {\n return ok(id, {\n isError: true,\n content: [{ type: \"text\", text: (e as Error).message }],\n });\n }\n }\n if (id === undefined) return null;\n return fail(id, -32601, `Method not found: ${method}`);\n}\n\nexport async function handleMessage(msg: Json): Promise<Json | null> {\n return handle(msg);\n}\n\nexport function startStdio(): void {\n let buf = \"\";\n process.stdin.setEncoding(\"utf8\");\n process.stdin.on(\"data\", async (chunk: string) => {\n buf += chunk;\n while (true) {\n const nl = buf.indexOf(\"\\n\");\n if (nl < 0) break;\n const line = buf.slice(0, nl).trim();\n buf = buf.slice(nl + 1);\n if (!line) continue;\n let msg: Json;\n try {\n msg = JSON.parse(line) as Json;\n } catch {\n continue;\n }\n const reply = await handle(msg);\n if (reply) process.stdout.write(JSON.stringify(reply) + \"\\n\");\n }\n });\n}\n","import type { ModelDefinition } from \"./types.js\";\n\n// Synced with the public aliases in upres.ai server/contract/models.ts.\n// A job names one alias. Which backend serves it is ours to choose and can\n// change without notice — that is how a failing vendor stops being your outage.\n// Aliases with max scale 1 do not enlarge; the API stores scale 1 for them.\n\nfunction scaleParam(maxScale: number): ModelDefinition[\"params\"] {\n if (maxScale <= 1) return [];\n const options: number[] = [];\n for (let step = 2; step <= maxScale; step *= 2) options.push(step);\n return [\n {\n name: \"scale\",\n type: \"integer\",\n required: false,\n default: 4,\n options,\n description: \"Scale multiplier. Ignored when the alias does not enlarge.\",\n },\n ];\n}\n\nfunction model(\n id: string,\n name: string,\n description: string,\n category: ModelDefinition[\"category\"],\n inputTypes: string[],\n maxScale: number,\n): ModelDefinition {\n const fileParam =\n category.startsWith(\"video\")\n ? { name: \"video\", type: \"string\" as const, required: true, description: \"Video URL or file\" }\n : category.startsWith(\"audio\")\n ? { name: \"audio\", type: \"string\" as const, required: true, description: \"Audio URL or file\" }\n : { name: \"image\", type: \"string\" as const, required: true, description: \"Image URL or file\" };\n return {\n id,\n name,\n description,\n category,\n price: \"One credit per stage that runs\",\n inputTypes,\n params: [fileParam, ...scaleParam(maxScale)],\n };\n}\n\nexport const MODELS: ModelDefinition[] = [\n model(\"flare\", \"Flare\", \"Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"prism\", \"Prism\", \"Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.\", \"image-upscale\", [\"image/*\"], 4),\n model(\"lumen\", \"Lumen\", \"Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"mirage\", \"Mirage\", \"Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.\", \"image-upscale\", [\"image/*\"], 8),\n model(\"hush\", \"Hush\", \"Faithful denoise. Same size as the source, nothing invented.\", \"image-clean\", [\"image/*\"], 1),\n model(\"keen\", \"Keen\", \"Deblur and sharpen. Same size as the source, does not invent texture.\", \"image-restore\", [\"image/*\"], 1),\n model(\"visage\", \"Visage\", \"Restores faces and leaves the rest of the frame alone. Does not enlarge.\", \"image-restore\", [\"image/*\"], 1),\n model(\"atelier\", \"Atelier\", \"Hush, then Visage if the photo looks like a portrait, then Lumen. A skipped face stage is free.\", \"image-studio\", [\"image/*\"], 8),\n model(\"motion\", \"Motion\", \"Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"motion-x\", \"Motion X\", \"Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.\", \"video-upscale\", [\"video/*\"], 4),\n model(\"still\", \"Still\", \"Temporal video denoise. Resolution stays put.\", \"video-clean\", [\"video/*\"], 1),\n model(\"cadence\", \"Cadence\", \"Frame interpolation. Does not enlarge the picture.\", \"video-restore\", [\"video/*\"], 1),\n model(\"atelier-x\", \"Atelier X\", \"Still, then Motion X. Two credits.\", \"video-studio\", [\"video/*\"], 4),\n model(\"voice\", \"Voice\", \"Speech denoise and bandwidth extension to 48 kHz. Not for music.\", \"audio-clean\", [\"audio/*\"], 1),\n];\n\nexport const IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith(\"image\"));\nexport const VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith(\"video\"));\nexport const AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith(\"audio\"));\nexport const DEFAULT_IMAGE_MODEL = \"flare\";\nexport const DEFAULT_VIDEO_MODEL = \"motion\";\nexport const DEFAULT_AUDIO_MODEL = \"voice\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOA,SAAS,WAAW,UAA6C;AAC/D,MAAI,YAAY,EAAG,QAAO,CAAC;AAC3B,QAAM,UAAoB,CAAC;AAC3B,WAAS,OAAO,GAAG,QAAQ,UAAU,QAAQ,EAAG,SAAQ,KAAK,IAAI;AACjE,SAAO;AAAA,IACL;AAAA,MACE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,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G;AACZ,YAAM,OAAO,IAAI,MAAM,GAAG,EAAE,EAAE,KAAK;AACnC,YAAM,IAAI,MAAM,KAAK,CAAC;AACtB,UAAI,CAAC,KAAM;AACX,UAAI;AACJ,UAAI;AACF,cAAM,KAAK,MAAM,IAAI;AAAA,MACvB,QAAQ;AACN;AAAA,MACF;AACA,YAAM,QAAQ,MAAM,OAAO,GAAG;AAC9B,UAAI,MAAO,SAAQ,OAAO,MAAM,KAAK,UAAU,KAAK,IAAI,IAAI;AAAA,IAC9D;AAAA,EACF,CAAC;AACH;","names":[]}
package/dist/mcp.js CHANGED
@@ -1,85 +1,55 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/models.ts
4
+ function scaleParam(maxScale) {
5
+ if (maxScale <= 1) return [];
6
+ const options = [];
7
+ for (let step = 2; step <= maxScale; step *= 2) options.push(step);
8
+ return [
9
+ {
10
+ name: "scale",
11
+ type: "integer",
12
+ required: false,
13
+ default: 4,
14
+ options,
15
+ description: "Scale multiplier. Ignored when the alias does not enlarge."
16
+ }
17
+ ];
18
+ }
19
+ function model(id, name, description, category, inputTypes, maxScale) {
20
+ const fileParam = category.startsWith("video") ? { name: "video", type: "string", required: true, description: "Video URL or file" } : category.startsWith("audio") ? { name: "audio", type: "string", required: true, description: "Audio URL or file" } : { name: "image", type: "string", required: true, description: "Image URL or file" };
21
+ return {
22
+ id,
23
+ name,
24
+ description,
25
+ category,
26
+ price: "One credit per stage that runs",
27
+ inputTypes,
28
+ params: [fileParam, ...scaleParam(maxScale)]
29
+ };
30
+ }
4
31
  var MODELS = [
5
- {
6
- id: "flare",
7
- name: "Flare",
8
- description: "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.",
9
- category: "image-upscale",
10
- price: "Included in plan quota",
11
- inputTypes: ["image/*"],
12
- params: [
13
- { name: "image", type: "string", required: true, description: "Image URL or file" },
14
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
15
- ]
16
- },
17
- {
18
- id: "prism",
19
- name: "Prism",
20
- description: "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.",
21
- category: "image-upscale",
22
- price: "Included in plan quota",
23
- inputTypes: ["image/*"],
24
- params: [
25
- { name: "image", type: "string", required: true, description: "Image URL or file" },
26
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
27
- ]
28
- },
29
- {
30
- id: "lumen",
31
- name: "Lumen",
32
- description: "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.",
33
- category: "image-upscale",
34
- price: "Included in plan quota",
35
- inputTypes: ["image/*"],
36
- params: [
37
- { name: "image", type: "string", required: true, description: "Image URL or file" },
38
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
39
- ]
40
- },
41
- {
42
- id: "mirage",
43
- name: "Mirage",
44
- description: "Invents plausible new detail rather than recovering what was there. Most dramatic, least faithful. Good for art, wrong for documents.",
45
- category: "image-enhance",
46
- price: "Included in plan quota",
47
- inputTypes: ["image/*"],
48
- params: [
49
- { name: "image", type: "string", required: true, description: "Image URL or file" },
50
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4, 8], description: "Scale multiplier" }
51
- ]
52
- },
53
- {
54
- id: "motion",
55
- name: "Motion",
56
- description: "Fast 4K finish for AI-generated video (Sora, Kling, Runway). Frame-consistent, does not invent faces.",
57
- category: "video-upscale",
58
- price: "Counts against monthly video minutes",
59
- inputTypes: ["video/*"],
60
- params: [
61
- { name: "video", type: "string", required: true, description: "Video URL or file" },
62
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
63
- ]
64
- },
65
- {
66
- id: "motion-x",
67
- name: "Motion X",
68
- description: "Cinema-grade video upscale for film and commercials. Noticeably slower and dearer per second than Motion.",
69
- category: "video-upscale",
70
- price: "Counts against monthly video minutes",
71
- inputTypes: ["video/*"],
72
- params: [
73
- { name: "video", type: "string", required: true, description: "Video URL or file" },
74
- { name: "scale", type: "integer", required: false, default: 4, options: [2, 4], description: "Scale multiplier" }
75
- ]
76
- }
32
+ model("flare", "Flare", "Everyday photos, 2x-4x. Fastest and cheapest. Does not invent detail.", "image-upscale", ["image/*"], 4),
33
+ model("prism", "Prism", "Text, logos, screenshots and product shots. Keeps edges true, does not invent detail.", "image-upscale", ["image/*"], 4),
34
+ model("lumen", "Lumen", "Maximum detail recovery for print, up to 8x. Slower and dearer than Flare.", "image-upscale", ["image/*"], 8),
35
+ model("mirage", "Mirage", "Invents plausible new detail rather than recovering what was there. Good for art, wrong for documents.", "image-upscale", ["image/*"], 8),
36
+ model("hush", "Hush", "Faithful denoise. Same size as the source, nothing invented.", "image-clean", ["image/*"], 1),
37
+ model("keen", "Keen", "Deblur and sharpen. Same size as the source, does not invent texture.", "image-restore", ["image/*"], 1),
38
+ model("visage", "Visage", "Restores faces and leaves the rest of the frame alone. Does not enlarge.", "image-restore", ["image/*"], 1),
39
+ model("atelier", "Atelier", "Hush, then Visage if the photo looks like a portrait, then Lumen. A skipped face stage is free.", "image-studio", ["image/*"], 8),
40
+ model("motion", "Motion", "Fast 4K finish for AI-generated video. Frame-consistent, does not invent faces.", "video-upscale", ["video/*"], 4),
41
+ model("motion-x", "Motion X", "Cinema-grade video upscale. Noticeably slower and dearer per second than Motion.", "video-upscale", ["video/*"], 4),
42
+ model("still", "Still", "Temporal video denoise. Resolution stays put.", "video-clean", ["video/*"], 1),
43
+ model("cadence", "Cadence", "Frame interpolation. Does not enlarge the picture.", "video-restore", ["video/*"], 1),
44
+ model("atelier-x", "Atelier X", "Still, then Motion X. Two credits.", "video-studio", ["video/*"], 4),
45
+ model("voice", "Voice", "Speech denoise and bandwidth extension to 48 kHz. Not for music.", "audio-clean", ["audio/*"], 1)
77
46
  ];
78
- var IMAGE_MODELS = MODELS.filter((m) => m.category !== "video-upscale");
79
- var VIDEO_MODELS = MODELS.filter((m) => m.category === "video-upscale");
47
+ var IMAGE_MODELS = MODELS.filter((m) => m.category.startsWith("image"));
48
+ var VIDEO_MODELS = MODELS.filter((m) => m.category.startsWith("video"));
49
+ var AUDIO_MODELS = MODELS.filter((m) => m.category.startsWith("audio"));
80
50
 
81
51
  // src/mcp.ts
82
- var VERSION = "0.2.0";
52
+ var VERSION = "0.3.0";
83
53
  var DEFAULT_BASE_URL = "https://api.upres.ai/v1";
84
54
  function apiKey() {
85
55
  return process.env.UPRES_API_KEY ?? "";
@@ -109,7 +79,7 @@ async function api(method, endpoint, body) {
109
79
  var TOOLS = [
110
80
  {
111
81
  name: "upres_list_models",
112
- description: "List UpRes upscale models (flare, prism, lumen, mirage, motion, motion-x) with use cases.",
82
+ description: "List the 14 public UpRes aliases for image, video, and speech.",
113
83
  inputSchema: { type: "object", properties: {}, additionalProperties: false }
114
84
  },
115
85
  {
@@ -119,17 +89,17 @@ var TOOLS = [
119
89
  },
120
90
  {
121
91
  name: "upres_upscale_image",
122
- description: "Submit an image upscale job from a public URL. Models: flare, prism, lumen, mirage.",
92
+ description: "Submit an image job from a public URL. Upscale: flare, prism, lumen, mirage. Restore: hush, keen, visage, atelier. Scale is ignored when the alias does not enlarge.",
123
93
  inputSchema: {
124
94
  type: "object",
125
95
  properties: {
126
96
  image_url: { type: "string", description: "Public HTTPS URL of the image" },
127
97
  model: {
128
98
  type: "string",
129
- enum: ["flare", "prism", "lumen", "mirage"],
130
- description: "Image model. Default flare."
99
+ enum: IMAGE_MODELS.map((m) => m.id),
100
+ description: "Image alias. Default flare."
131
101
  },
132
- scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4." }
102
+ scale: { type: "integer", enum: [2, 4, 8], description: "Scale multiplier. Default 4. Ignored for hush, keen, and visage." }
133
103
  },
134
104
  required: ["image_url"],
135
105
  additionalProperties: false
@@ -137,22 +107,39 @@ var TOOLS = [
137
107
  },
138
108
  {
139
109
  name: "upres_upscale_video",
140
- description: "Submit a video upscale job from a public URL. Models: motion, motion-x.",
110
+ description: "Submit a video job from a public URL. motion and motion-x upscale. still denoises, cadence interpolates frames, atelier-x runs still then motion-x.",
141
111
  inputSchema: {
142
112
  type: "object",
143
113
  properties: {
144
114
  video_url: { type: "string", description: "Public HTTPS URL of the video" },
145
115
  model: {
146
116
  type: "string",
147
- enum: ["motion", "motion-x"],
148
- description: "Video model. Default motion."
117
+ enum: VIDEO_MODELS.map((m) => m.id),
118
+ description: "Video alias. Default motion."
149
119
  },
150
- scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4." }
120
+ scale: { type: "integer", enum: [2, 4], description: "Scale multiplier. Default 4. Ignored for still and cadence." }
151
121
  },
152
122
  required: ["video_url"],
153
123
  additionalProperties: false
154
124
  }
155
125
  },
126
+ {
127
+ name: "upres_enhance_audio",
128
+ description: "Submit a speech job from a public URL. voice denoises speech and extends it to 48 kHz. Music is not supported.",
129
+ inputSchema: {
130
+ type: "object",
131
+ properties: {
132
+ audio_url: { type: "string", description: "Public HTTPS URL of wav, mp3, m4a, or flac speech" },
133
+ model: {
134
+ type: "string",
135
+ enum: AUDIO_MODELS.map((m) => m.id),
136
+ description: "Audio alias. Default voice."
137
+ }
138
+ },
139
+ required: ["audio_url"],
140
+ additionalProperties: false
141
+ }
142
+ },
156
143
  {
157
144
  name: "upres_get_job",
158
145
  description: "Get status and result_url of an UpRes job by id.",
@@ -215,6 +202,15 @@ async function callTool(name, args) {
215
202
  });
216
203
  return text(job);
217
204
  }
205
+ case "upres_enhance_audio": {
206
+ const audio_url = String(args.audio_url ?? "");
207
+ if (!audio_url) throw new Error("audio_url is required");
208
+ const job = await api("POST", "/jobs", {
209
+ image_url: audio_url,
210
+ model: args.model ?? "voice"
211
+ });
212
+ return text(job);
213
+ }
218
214
  case "upres_get_job": {
219
215
  const job_id = String(args.job_id ?? "");
220
216
  if (!job_id) throw new Error("job_id is required");