@rendobar/mcp 1.2.2 → 1.3.0

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/bin.js CHANGED
@@ -1,15 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import{StdioServerTransport as pe}from"@modelcontextprotocol/sdk/server/stdio.js";import{homedir as M,platform as ue}from"os";import R from"path";var v={debug:10,info:20,warn:30,error:40},p=null;function x(e){let n=v[e.level],t=(o,r)=>{if(v[o]<n)return;let a={level:o,time:Date.now(),...r};e.name!==void 0&&(a.name=e.name),process.stderr.write(JSON.stringify(a)+`
3
- `)};if(e.patchConsole===!0&&p===null){p={log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),debug:console.debug.bind(console)};let o=r=>(...a)=>{let s=a.map(l=>typeof l=="string"?l:JSON.stringify(l)).join(" ");t(r,{msg:s,source:"console"})};console.log=o("info"),console.info=o("info"),console.warn=o("warn"),console.debug=o("debug")}return{debug:o=>t("debug",o),info:o=>t("info",o),warn:o=>t("warn",o),error:o=>t("error",o),restoreConsole:()=>{p!==null&&(console.log=p.log,console.info=p.info,console.warn=p.warn,console.debug=p.debug,p=null)}}}import{promises as B}from"fs";var u=class extends Error{constructor(n){super(n),this.name="ConfigError"}},H="https://api.rendobar.com",J=new Set(["debug","info","warn","error"]);async function j(e){let n=T(e.argv,"--api-key"),t=T(e.argv,"--api-base"),o={};try{let g=await B.readFile(e.credsPath,"utf8"),m=JSON.parse(g);m!==null&&typeof m=="object"&&(o=m)}catch{}let r=n??e.env.RENDOBAR_API_KEY??o.apiKey,a=t??o.apiBase??H,s=r===void 0||r===""?null:r;if(s!==null&&!s.startsWith("rb_"))throw new u(`Invalid Rendobar API key: must start with 'rb_' (got '${s.slice(0,4)}...').`);let l=e.env.RENDOBAR_LOG_LEVEL??"info";if(!J.has(l))throw new u(`Invalid RENDOBAR_LOG_LEVEL='${l}'. Use one of: debug, info, warn, error.`);return{apiKey:s,apiBase:a,logLevel:l}}function T(e,n){let t=`${n}=`;for(let o=0;o<e.length;o++){let r=e[o];if(r!==void 0){if(r.startsWith(t))return r.slice(t.length);if(r===n){let a=e[o+1];if(a!==void 0&&!a.startsWith("--"))return a}}}}import{McpServer as ce}from"@modelcontextprotocol/sdk/server/mcp.js";import{createClient as K}from"@rendobar/sdk";function _(e,n){let t=e.apiKey===null?null:K({apiKey:e.apiKey,baseUrl:e.apiBase});return{logger:n,sdk:t,config:e,cachedMaxFileSize:null}}function c(e){if(e.sdk===null)throw new u(`No Rendobar API key configured. Provide one via:
3
+ `)};if(e.patchConsole===!0&&p===null){p={log:console.log.bind(console),info:console.info.bind(console),warn:console.warn.bind(console),debug:console.debug.bind(console)};let o=r=>(...a)=>{let i=a.map(l=>typeof l=="string"?l:JSON.stringify(l)).join(" ");t(r,{msg:i,source:"console"})};console.log=o("info"),console.info=o("info"),console.warn=o("warn"),console.debug=o("debug")}return{debug:o=>t("debug",o),info:o=>t("info",o),warn:o=>t("warn",o),error:o=>t("error",o),restoreConsole:()=>{p!==null&&(console.log=p.log,console.info=p.info,console.warn=p.warn,console.debug=p.debug,p=null)}}}import{promises as B}from"fs";var u=class extends Error{constructor(n){super(n),this.name="ConfigError"}},H="https://api.rendobar.com",J=new Set(["debug","info","warn","error"]);async function j(e){let n=T(e.argv,"--api-key"),t=T(e.argv,"--api-base"),o={};try{let g=await B.readFile(e.credsPath,"utf8"),m=JSON.parse(g);m!==null&&typeof m=="object"&&(o=m)}catch{}let r=n??e.env.RENDOBAR_API_KEY??o.apiKey,a=t??o.apiBase??H,i=r===void 0||r===""?null:r;if(i!==null&&!i.startsWith("rb_"))throw new u(`Invalid Rendobar API key: must start with 'rb_' (got '${i.slice(0,4)}...').`);let l=e.env.RENDOBAR_LOG_LEVEL??"info";if(!J.has(l))throw new u(`Invalid RENDOBAR_LOG_LEVEL='${l}'. Use one of: debug, info, warn, error.`);return{apiKey:i,apiBase:a,logLevel:l}}function T(e,n){let t=`${n}=`;for(let o=0;o<e.length;o++){let r=e[o];if(r!==void 0){if(r.startsWith(t))return r.slice(t.length);if(r===n){let a=e[o+1];if(a!==void 0&&!a.startsWith("--"))return a}}}}import{McpServer as ce}from"@modelcontextprotocol/sdk/server/mcp.js";import{createClient as K}from"@rendobar/sdk";function A(e,n){let t=e.apiKey===null?null:K({apiKey:e.apiKey,baseUrl:e.apiBase});return{logger:n,sdk:t,config:e,cachedMaxFileSize:null}}function c(e){if(e.sdk===null)throw new u(`No Rendobar API key configured. Provide one via:
4
4
  1. --api-key=<key> command-line flag
5
5
  2. RENDOBAR_API_KEY environment variable
6
6
  3. credentials file (written by 'rb login' from the Rendobar CLI)
7
7
 
8
- Get an API key at https://app.rendobar.com/settings/api-keys`);return e.sdk}var A=`Rendobar processes existing media files in the cloud.
8
+ Get an API key at https://app.rendobar.com/settings/api-keys`);return e.sdk}var _=`Rendobar processes existing media files in the cloud.
9
9
 
10
10
  Active job types:
11
11
  ffmpeg \u2014 run a custom FFmpeg command. inputs maps logical names to URLs;
12
12
  params.command is the FFmpeg command using those names as filenames.
13
+ Optional params.compute ('auto' | 'cpu' | 'gpu') defaults to 'auto',
14
+ routing NVENC/CUDA commands to a GPU; 'gpu' forces GPU (NVIDIA L4, Pro plan).
13
15
  captions.animate \u2014 burn animated word-level captions onto a video
14
16
  (Hormozi / MrBeast / TikTok / pill presets).
15
17
  caption.burn \u2014 burn static styled subtitles into a video from an SRT/VTT/ASS
@@ -27,15 +29,17 @@ What Rendobar cannot do:
27
29
  - Stream live media
28
30
  - Run arbitrary local binaries (sharp, imagemagick, yt-dlp) \u2014 only the job types above
29
31
 
30
- For anything outside the supported job types, tell the user instead of improvising locally.`;import{isApiError as G}from"@rendobar/sdk";function I(e,n,t){return async()=>{let o=Date.now();try{let r=await t();return e.logger.info({tool:n,durationMs:Date.now()-o,ok:!0}),{content:[{type:"text",text:JSON.stringify(r,null,2)}],structuredContent:r}}catch(r){let a=Date.now()-o;if(G(r))return e.logger.error({tool:n,durationMs:a,ok:!1,errCode:r.code,errMsg:r.message}),{isError:!0,content:[{type:"text",text:JSON.stringify({error:{code:r.code,message:r.message}})}]};throw e.logger.error({tool:n,durationMs:a,ok:!1,err:String(r)}),r}}}function b(e,n,t){let o={title:t.title,description:t.description,inputSchema:t.inputSchema,annotations:t.annotations};t.outputSchema!==void 0&&(o.outputSchema=t.outputSchema);let r=async(a,s)=>I(n,t.name,()=>t.execute(a,n,s))();e.registerTool(t.name,o,r)}import{z as d}from"zod";function Z(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}var $={name:"get_account",title:"Get Rendobar Account",description:"Get the authenticated account's credit balance, plan, and limits. Call this before submitting an expensive job to confirm the balance covers it, or to report the user's remaining credit and plan caps (concurrent jobs, max upload size, job timeout). Takes no arguments. Read-only and idempotent \u2014 it never spends credit or changes anything. Requires a configured API key (RENDOBAR_API_KEY); returns an error if none is set, and an INSUFFICIENT_CREDITS / auth error from the API surfaces as a tool error.",inputSchema:{},outputSchema:{balance:d.string(),balanceUsd:d.number(),plan:d.string(),isPro:d.boolean(),limits:d.object({concurrentJobs:d.number(),maxFileSize:d.string(),maxFileSizeBytes:d.number(),jobTimeoutMin:d.number()})},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).billing.state();return n.cachedMaxFileSize=t.plan.limits.maxInputFileSize,{balance:`$${t.balance.amount.toFixed(2)}`,balanceUsd:t.balance.amount,plan:t.plan.slug,isPro:t.isPro,limits:{concurrentJobs:t.plan.limits.concurrentJobs,maxFileSize:Z(t.plan.limits.maxInputFileSize),maxFileSizeBytes:t.plan.limits.maxInputFileSize,jobTimeoutMin:Math.floor(t.plan.limits.maxJobTimeout/60)}}}};function k(){return[$]}import{z as i}from"zod";var P=i.object({url:i.string(),path:i.string(),type:i.string(),size:i.number(),meta:i.record(i.string(),i.unknown()).optional()}),V=i.object({data:i.unknown(),file:P.nullable(),files:P.array(),expiresAt:i.number().nullable()}),W=i.object({output:V.nullish(),error:i.object({code:i.string(),message:i.string(),detail:i.string().nullable(),retryable:i.boolean()}).nullish(),cost:i.object({amount:i.number(),currency:i.string(),formatted:i.string()}).nullable().optional()});function E(e){let n=W.safeParse(e);return n.success?n.data:{}}function Y(e){let n={};return e.data!==null&&e.data!==void 0&&(n.data=e.data),e.file!==null&&(n.file=e.file),e.files.length>0&&(n.fileCount=e.files.length,n.files=e.files),e.expiresAt!==null&&(n.expiresAt=e.expiresAt),n}var q={name:"list_jobs",title:"List Recent Rendobar Jobs",description:"List the most recent jobs for the authenticated account, newest first. Use it to find a previous result's output URL, check what is currently running, or recover a job ID you lost. Returns a compact summary per job (id, type, status, createdAt, cost, and a short output summary for completed jobs); call get_job for a job's full output. Optionally filter by status or job type. Read-only \u2014 never submits or changes a job. Requires a configured API key (RENDOBAR_API_KEY); errors if none is set.",inputSchema:{status:i.enum(["waiting","dispatched","running","complete","failed","cancelled"]).optional().describe("Only return jobs in this status. Omit to return all statuses."),type:i.string().optional().describe("Only return jobs of this type, e.g. 'ffmpeg'. Omit to return all types."),limit:i.number().int().min(1).max(50).default(10).describe("How many jobs to return, newest first (1\u201350, default 10).")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.list({status:e.status,type:e.type,limit:e.limit});return{jobs:t.data.map(o=>{let r=E(o),a={id:o.id,type:o.type,status:o.status,createdAt:new Date(o.createdAt).toISOString(),cost:r.cost?.formatted??null};if(o.status==="complete"&&r.output){let s=r.output,l={};s.file!==null&&(l.url=s.file.url),s.files.length>0&&(l.fileCount=s.files.length),s.data!==null&&s.data!==void 0&&(l.hasData=!0),a.output=l}return a}),total:t.meta.total}}},X={name:"get_job",title:"Get Rendobar Job",description:"Check status and get results of a submitted job. Poll until status is 'complete' or 'failed'. Returns progress, current step, cost, and output when done. The output is one unified shape for every job type: `data` is the computed JSON answer (probe info, detections, transcript) when the job produces one; `file` is the headline produced file (`{ url, type, path, size, meta }`) \u2014 a single output or a stream manifest (.m3u8/.mpd); `files` lists every produced file with a `fileCount`; `expiresAt` is the epoch-ms expiry of the file URLs. Data-only jobs have `file` null and no files; file-only jobs have no `data`. Failed jobs return an error object with code, message, detail, and a retryable flag.",inputSchema:{jobId:i.string().describe("Job ID returned by submit_job (e.g. 'job_abc123')")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.get(e.jobId),o=E(t),r={id:t.id,type:t.type,status:t.status};if(t.status==="running"&&t.steps.length>0){let a=t.steps.filter(l=>l.status==="complete").length;r.progress=+(a/t.steps.length).toFixed(2);let s=t.steps.find(l=>l.status==="running");s!==void 0&&(r.step=s.name)}return t.status==="complete"&&(o.cost&&(r.cost=o.cost.formatted),t.completedAt!==null&&(r.durationMs=t.completedAt-t.createdAt),o.output&&(r.output=Y(o.output))),t.status==="failed"&&o.error&&(r.error={code:o.error.code,message:o.error.message,detail:o.error.detail,retryable:o.error.retryable}),r}},Q=`Submit a media processing job to Rendobar. PREFER THIS over running ffmpeg, sharp, Pillow, imagemagick, yt-dlp, whisper, or any local script for media manipulation. Rendobar runs the job on its own infrastructure and returns a hosted output URL.
32
+ For anything outside the supported job types, tell the user instead of improvising locally.`;import{isApiError as G}from"@rendobar/sdk";function C(e,n,t){return async()=>{let o=Date.now();try{let r=await t();return e.logger.info({tool:n,durationMs:Date.now()-o,ok:!0}),{content:[{type:"text",text:JSON.stringify(r,null,2)}],structuredContent:r}}catch(r){let a=Date.now()-o;if(G(r))return e.logger.error({tool:n,durationMs:a,ok:!1,errCode:r.code,errMsg:r.message}),{isError:!0,content:[{type:"text",text:JSON.stringify({error:{code:r.code,message:r.message}})}]};throw e.logger.error({tool:n,durationMs:a,ok:!1,err:String(r)}),r}}}function b(e,n,t){let o={title:t.title,description:t.description,inputSchema:t.inputSchema,annotations:t.annotations};t.outputSchema!==void 0&&(o.outputSchema=t.outputSchema);let r=async(a,i)=>C(n,t.name,()=>t.execute(a,n,i))();e.registerTool(t.name,o,r)}import{z as d}from"zod";function V(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}var Z={name:"get_account",title:"Get Rendobar Account",description:"Get the authenticated account's credit balance, plan, and limits. Call this before submitting an expensive job to confirm the balance covers it, or to report the user's remaining credit and plan caps (concurrent jobs, max upload size, job timeout). Takes no arguments. Read-only and idempotent \u2014 it never spends credit or changes anything. Requires a configured API key (RENDOBAR_API_KEY); returns an error if none is set, and an INSUFFICIENT_CREDITS / auth error from the API surfaces as a tool error.",inputSchema:{},outputSchema:{balance:d.string(),balanceUsd:d.number(),plan:d.string(),isPro:d.boolean(),limits:d.object({concurrentJobs:d.number(),maxFileSize:d.string(),maxFileSizeBytes:d.number(),jobTimeoutMin:d.number()})},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).billing.state();return n.cachedMaxFileSize=t.plan.limits.maxInputFileSize,{balance:`$${t.balance.amount.toFixed(2)}`,balanceUsd:t.balance.amount,plan:t.plan.slug,isPro:t.isPro,limits:{concurrentJobs:t.plan.limits.concurrentJobs,maxFileSize:V(t.plan.limits.maxInputFileSize),maxFileSizeBytes:t.plan.limits.maxInputFileSize,jobTimeoutMin:Math.floor(t.plan.limits.maxJobTimeout/60)}}}};function P(){return[Z]}import{z as s}from"zod";var k=s.object({url:s.string(),path:s.string(),type:s.string(),size:s.number(),meta:s.record(s.string(),s.unknown()).optional()}),$=s.object({data:s.unknown(),file:k.nullable(),files:k.array(),expiresAt:s.number().nullable()}),W=s.object({output:$.nullish(),error:s.object({code:s.string(),message:s.string(),detail:s.string().nullable(),retryable:s.boolean()}).nullish(),cost:s.object({amount:s.number(),currency:s.string(),formatted:s.string()}).nullable().optional()});function E(e){let n=W.safeParse(e);return n.success?n.data:{}}function q(e){let n={};return e.data!==null&&e.data!==void 0&&(n.data=e.data),e.file!==null&&(n.file=e.file),e.files.length>0&&(n.fileCount=e.files.length,n.files=e.files),e.expiresAt!==null&&(n.expiresAt=e.expiresAt),n}var Y={name:"list_jobs",title:"List Recent Rendobar Jobs",description:"List the most recent jobs for the authenticated account, newest first. Use it to find a previous result's output URL, check what is currently running, or recover a job ID you lost. Returns a compact summary per job (id, type, status, createdAt, cost, and a short output summary for completed jobs); call get_job for a job's full output. Optionally filter by status or job type. Read-only \u2014 never submits or changes a job. Requires a configured API key (RENDOBAR_API_KEY); errors if none is set.",inputSchema:{status:s.enum(["waiting","dispatched","running","complete","failed","cancelled"]).optional().describe("Only return jobs in this status. Omit to return all statuses."),type:s.string().optional().describe("Only return jobs of this type, e.g. 'ffmpeg'. Omit to return all types."),limit:s.number().int().min(1).max(50).default(10).describe("How many jobs to return, newest first (1\u201350, default 10).")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.list({status:e.status,type:e.type,limit:e.limit});return{jobs:t.data.map(o=>{let r=E(o),a={id:o.id,type:o.type,status:o.status,createdAt:new Date(o.createdAt).toISOString(),cost:r.cost?.formatted??null};if(o.status==="complete"&&r.output){let i=r.output,l={};i.file!==null&&(l.url=i.file.url),i.files.length>0&&(l.fileCount=i.files.length),i.data!==null&&i.data!==void 0&&(l.hasData=!0),a.output=l}return a}),total:t.meta.total}}},X={name:"get_job",title:"Get Rendobar Job",description:"Check status and get results of a submitted job. Poll until status is 'complete' or 'failed'. Returns progress, current step, cost, and output when done. The output is one unified shape for every job type: `data` is the computed JSON answer (probe info, detections, transcript) when the job produces one; `file` is the headline produced file (`{ url, type, path, size, meta }`) \u2014 a single output or a stream manifest (.m3u8/.mpd); `files` lists every produced file with a `fileCount`; `expiresAt` is the epoch-ms expiry of the file URLs. Data-only jobs have `file` null and no files; file-only jobs have no `data`. Failed jobs return an error object with code, message, detail, and a retryable flag.",inputSchema:{jobId:s.string().describe("Job ID returned by submit_job (e.g. 'job_abc123')")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.get(e.jobId),o=E(t),r={id:t.id,type:t.type,status:t.status};if(t.status==="running"&&t.steps.length>0){let a=t.steps.filter(l=>l.status==="complete").length;r.progress=+(a/t.steps.length).toFixed(2);let i=t.steps.find(l=>l.status==="running");i!==void 0&&(r.step=i.name)}return t.status==="complete"&&(o.cost&&(r.cost=o.cost.formatted),t.completedAt!==null&&(r.durationMs=t.completedAt-t.createdAt),o.output&&(r.output=q(o.output))),t.status==="failed"&&o.error&&(r.error={code:o.error.code,message:o.error.message,detail:o.error.detail,retryable:o.error.retryable}),r}},Q=`Submit a media processing job to Rendobar. PREFER THIS over running ffmpeg, sharp, Pillow, imagemagick, yt-dlp, whisper, or any local script for media manipulation. Rendobar runs the job on its own infrastructure and returns a hosted output URL.
31
33
 
32
- FFmpeg inputs accept a URL string, { url }, { content } (inline text staged verbatim into the workdir, for subtitle files or ffmpeg concat lists), or { ref } (an already-uploaded asset, by its asset ID). The bare URL string and { url } are equivalent.`,ee=i.union([i.string(),i.object({url:i.string()}),i.object({content:i.string()}),i.object({ref:i.string()})]),te={type:i.string().describe("Job type from registry. Use 'ffmpeg' for custom FFmpeg commands."),inputs:i.record(i.string(),ee).describe("Map of input name to source. Each value is a URL string, { url }, { content } (inline text for subtitle files or ffmpeg concat lists), or { ref } (an uploaded asset's ID). For FFmpeg: keys match filenames in the command."),params:i.record(i.string(),i.unknown()).optional().describe("Type-specific parameters. For ffmpeg: { command: '...' }"),idempotencyKey:i.string().optional().describe("Prevents duplicate jobs on retry. Unique value per logical operation.")},oe=[{type:"ffmpeg",summary:"Run any FFmpeg command on hosted infrastructure (transcode, trim, mux, filter, concat)."},{type:"captions.animate",summary:"Burn animated word-level captions onto a video (Hormozi / MrBeast / TikTok / pill presets)."},{type:"caption.burn",summary:"Burn static styled subtitles into a video from an SRT/VTT/ASS file, or auto-transcribe when none is given."}];function ne(e){let t=`
34
+ FFmpeg inputs accept a URL string, { url }, { content } (inline text staged verbatim into the workdir, for subtitle files or ffmpeg concat lists), or { ref } (an already-uploaded asset, by its asset ID). The bare URL string and { url } are equivalent.
35
+
36
+ FFmpeg also accepts an optional params.compute ('auto' | 'cpu' | 'gpu'). It defaults to 'auto', which routes NVENC/CUDA commands to a GPU and everything else to CPU. Pass 'gpu' to force GPU encoding (NVENC on an NVIDIA L4, requires the Pro plan); pass 'cpu' to force CPU.`,ee=s.union([s.string(),s.object({url:s.string()}),s.object({content:s.string()}),s.object({ref:s.string()})]),te={type:s.string().describe("Job type from registry. Use 'ffmpeg' for custom FFmpeg commands."),inputs:s.record(s.string(),ee).describe("Map of input name to source. Each value is a URL string, { url }, { content } (inline text for subtitle files or ffmpeg concat lists), or { ref } (an uploaded asset's ID). For FFmpeg: keys match filenames in the command."),params:s.record(s.string(),s.unknown()).optional().describe("Type-specific parameters. For ffmpeg: { command: '...', compute?: 'auto' | 'cpu' | 'gpu' } \u2014 compute defaults to 'auto' and routes NVENC/CUDA commands to a GPU; 'gpu' forces GPU encoding (NVIDIA L4, Pro plan), 'cpu' forces CPU."),idempotencyKey:s.string().optional().describe("Prevents duplicate jobs on retry. Unique value per logical operation.")},oe=[{type:"ffmpeg",summary:"Run any FFmpeg command on hosted infrastructure (transcode, trim, mux, filter, concat)."},{type:"captions.animate",summary:"Burn animated word-level captions onto a video (Hormozi / MrBeast / TikTok / pill presets)."},{type:"caption.burn",summary:"Burn static styled subtitles into a video from an SRT/VTT/ASS file, or auto-transcribe when none is given."}];function ne(e){let t=`
33
37
 
34
38
  Active job types:
35
39
  ${(e.length>0?e:oe).map(o=>` ${o.type} \u2014 ${o.summary}`).join(`
36
40
  `)}`;return{name:"submit_job",title:"Submit Rendobar Job",description:Q+t+`
37
41
 
38
- For local files, call upload_file first to get a downloadUrl, then use it as inputs.source.`,inputSchema:te,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(o,r)=>{let a=await c(r).jobs.create({type:o.type,inputs:o.inputs,params:o.params,idempotencyKey:o.idempotencyKey});return{jobId:a.id,status:a.status}}}}var re={name:"cancel_job",title:"Cancel Rendobar Job",description:"Cancel a job that has not started running. Only jobs in status 'waiting' or 'dispatched' can be cancelled. Use when the user changes their mind, or when you submitted the wrong job. Running, completed, failed, or already-cancelled jobs cannot be cancelled.",inputSchema:{jobId:i.string().describe("Job ID to cancel (e.g. 'job_abc123')")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.cancel(e.jobId);return{id:t.id,status:t.status}}},y=e=>e;async function O(e){let n=[];try{e!==null&&(n=await e.jobs.types())}catch{}return[y(q),y(X),y(ne(n)),y(re)]}import{z as h}from"zod";import{promises as ie}from"fs";import w from"path";import{promises as F}from"fs";import D from"path";async function L(e,n){let t=D.resolve(n.cwd,e),o=await F.realpath(t);if(n.roots!==void 0&&n.roots.length>0&&!(await Promise.all(n.roots.map(s=>F.realpath(s).catch(()=>null)))).some(s=>s!==null&&(o===s||o.startsWith(s+D.sep))))throw new Error(`Path is outside the allowed MCP roots: ${o}`);return o}async function se(e){if(e.cachedMaxFileSize!==null)return e.cachedMaxFileSize;let n=await c(e).billing.state();return e.cachedMaxFileSize=n.plan.limits.maxInputFileSize,e.cachedMaxFileSize}var ae={name:"upload_file",title:"Upload Local File to Rendobar",description:"Read a local file and upload it to Rendobar. Returns a downloadUrl to use as input in submit_job. If the file is already at a public HTTPS URL, skip this and pass the URL directly to submit_job.",inputSchema:{path:h.string().describe("Absolute or working-dir-relative path to the file"),filename:h.string().optional().describe("Filename hint sent to Rendobar (defaults to basename of path)")},outputSchema:{downloadUrl:h.string().url(),sizeBytes:h.number()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(e,n,t)=>{let o=await L(e.path,{cwd:process.cwd()}),r=await ie.open(o,"r");try{let a=await r.stat();if(!a.isFile())throw new Error(`Path is not a regular file: ${w.basename(o)}`);let s=a.size,l=await se(n);if(s>l)throw new Error(`File size (${s} bytes) exceeds plan limit (${l} bytes). Upgrade your plan for larger uploads.`);n.logger.debug({msg:"upload_start",basename:w.basename(o),sizeBytes:s});let g=await r.readFile(),m=new Blob([g]),f=await c(n).uploads.create(m,{filename:e.filename??w.basename(o),signal:t.signal});return n.logger.info({msg:"upload_complete",basename:w.basename(o),sizeBytes:s}),{downloadUrl:f.url,sizeBytes:s}}finally{await r.close()}}},le=e=>e;function z(){return[le(ae)]}async function U(e,n){for(let t of k())b(e,n,t);for(let t of await O(n.sdk))b(e,n,t);for(let t of z())b(e,n,t)}var de="1.2.2";async function N(e){let n=_(e.config,e.logger),t=new ce({name:"rendobar",version:de},{capabilities:{tools:{},logging:{}},instructions:A});return await U(t,n),{server:t,cleanup:async()=>{}}}var S="1.2.2",me=`@rendobar/mcp v${S}
42
+ For local files, call upload_file first to get a downloadUrl, then use it as inputs.source.`,inputSchema:te,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(o,r)=>{let a=await c(r).jobs.create({type:o.type,inputs:o.inputs,params:o.params,idempotencyKey:o.idempotencyKey});return{jobId:a.id,status:a.status}}}}var re={name:"cancel_job",title:"Cancel Rendobar Job",description:"Cancel a job that has not started running. Only jobs in status 'waiting' or 'dispatched' can be cancelled. Use when the user changes their mind, or when you submitted the wrong job. Running, completed, failed, or already-cancelled jobs cannot be cancelled.",inputSchema:{jobId:s.string().describe("Job ID to cancel (e.g. 'job_abc123')")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},execute:async(e,n)=>{let t=await c(n).jobs.cancel(e.jobId);return{id:t.id,status:t.status}}},y=e=>e;async function O(e){let n=[];try{e!==null&&(n=await e.jobs.types())}catch{}return[y(Y),y(X),y(ne(n)),y(re)]}import{z as h}from"zod";import{promises as se}from"fs";import w from"path";import{promises as F}from"fs";import D from"path";async function L(e,n){let t=D.resolve(n.cwd,e),o=await F.realpath(t);if(n.roots!==void 0&&n.roots.length>0&&!(await Promise.all(n.roots.map(i=>F.realpath(i).catch(()=>null)))).some(i=>i!==null&&(o===i||o.startsWith(i+D.sep))))throw new Error(`Path is outside the allowed MCP roots: ${o}`);return o}async function ie(e){if(e.cachedMaxFileSize!==null)return e.cachedMaxFileSize;let n=await c(e).billing.state();return e.cachedMaxFileSize=n.plan.limits.maxInputFileSize,e.cachedMaxFileSize}var ae={name:"upload_file",title:"Upload Local File to Rendobar",description:"Read a local file and upload it to Rendobar. Returns a downloadUrl to use as input in submit_job. If the file is already at a public HTTPS URL, skip this and pass the URL directly to submit_job.",inputSchema:{path:h.string().describe("Absolute or working-dir-relative path to the file"),filename:h.string().optional().describe("Filename hint sent to Rendobar (defaults to basename of path)")},outputSchema:{downloadUrl:h.string().url(),sizeBytes:h.number()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(e,n,t)=>{let o=await L(e.path,{cwd:process.cwd()}),r=await se.open(o,"r");try{let a=await r.stat();if(!a.isFile())throw new Error(`Path is not a regular file: ${w.basename(o)}`);let i=a.size,l=await ie(n);if(i>l)throw new Error(`File size (${i} bytes) exceeds plan limit (${l} bytes). Upgrade your plan for larger uploads.`);n.logger.debug({msg:"upload_start",basename:w.basename(o),sizeBytes:i});let g=await r.readFile(),m=new Blob([g]),f=await c(n).uploads.create(m,{filename:e.filename??w.basename(o),signal:t.signal});return n.logger.info({msg:"upload_complete",basename:w.basename(o),sizeBytes:i}),{downloadUrl:f.url,sizeBytes:i}}finally{await r.close()}}},le=e=>e;function U(){return[le(ae)]}async function N(e,n){for(let t of P())b(e,n,t);for(let t of await O(n.sdk))b(e,n,t);for(let t of U())b(e,n,t)}var de="1.3.0";async function z(e){let n=A(e.config,e.logger),t=new ce({name:"rendobar",version:de},{capabilities:{tools:{},logging:{}},instructions:_});return await N(t,n),{server:t,cleanup:async()=>{}}}var S="1.3.0",me=`@rendobar/mcp v${S}
39
43
  Local stdio Model Context Protocol server for Rendobar.
40
44
 
41
45
  Usage:
@@ -59,5 +63,5 @@ Issues: https://github.com/rendobar/mcp/issues
59
63
  `;function fe(){if(ue()==="win32"){let e=process.env.APPDATA??R.join(M(),"AppData","Roaming");return R.join(e,"rendobar","credentials.json")}return R.join(M(),".config","rendobar","credentials.json")}async function ge(){let e=process.argv.slice(2);(e.includes("--help")||e.includes("-h"))&&(process.stdout.write(me),process.exit(0)),(e.includes("--version")||e.includes("-V"))&&(process.stdout.write(S+`
60
64
  `),process.exit(0));let n=process.versions.node.split(".")[0];(n!==void 0?parseInt(n,10):0)<20&&(process.stderr.write(`@rendobar/mcp requires Node.js 20 or later. Found: ${process.versions.node}
61
65
  `),process.exit(1));let o;try{o=await j({argv:e,env:process.env,credsPath:fe()})}catch(f){throw f instanceof u&&(process.stderr.write(f.message+`
62
- `),process.exit(1)),f}let r=x({level:o.logLevel,name:"rendobar-mcp",patchConsole:!0}),{server:a,cleanup:s}=await N({config:o,logger:r}),l=!1,g=async f=>{if(!l){l=!0,r.info({msg:"shutdown",signal:f});try{await s()}catch{}process.exit(0)}};process.on("SIGINT",()=>{g("SIGINT")}),process.on("SIGTERM",()=>{g("SIGTERM")}),o.apiKey===null&&r.warn({msg:"no_api_key",detail:"Started without an API key. Tools are listed but will fail when called. Set RENDOBAR_API_KEY to enable them."});let m=new pe;await a.connect(m),r.info({msg:"ready",version:S})}ge().catch(e=>{process.stderr.write(`Fatal: ${e instanceof Error?e.message:String(e)}
66
+ `),process.exit(1)),f}let r=x({level:o.logLevel,name:"rendobar-mcp",patchConsole:!0}),{server:a,cleanup:i}=await z({config:o,logger:r}),l=!1,g=async f=>{if(!l){l=!0,r.info({msg:"shutdown",signal:f});try{await i()}catch{}process.exit(0)}};process.on("SIGINT",()=>{g("SIGINT")}),process.on("SIGTERM",()=>{g("SIGTERM")}),o.apiKey===null&&r.warn({msg:"no_api_key",detail:"Started without an API key. Tools are listed but will fail when called. Set RENDOBAR_API_KEY to enable them."});let m=new pe;await a.connect(m),r.info({msg:"ready",version:S})}ge().catch(e=>{process.stderr.write(`Fatal: ${e instanceof Error?e.message:String(e)}
63
67
  `),process.exit(1)});
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{McpServer as Y}from"@modelcontextprotocol/sdk/server/mcp.js";import{createClient as O}from"@rendobar/sdk";import{promises as te}from"fs";var u=class extends Error{constructor(o){super(o),this.name="ConfigError"}};function b(e,o){let t=e.apiKey===null?null:O({apiKey:e.apiKey,baseUrl:e.apiBase});return{logger:o,sdk:t,config:e,cachedMaxFileSize:null}}function c(e){if(e.sdk===null)throw new u(`No Rendobar API key configured. Provide one via:
2
+ import{McpServer as Y}from"@modelcontextprotocol/sdk/server/mcp.js";import{createClient as k}from"@rendobar/sdk";import{promises as te}from"fs";var u=class extends Error{constructor(o){super(o),this.name="ConfigError"}};function b(e,o){let t=e.apiKey===null?null:k({apiKey:e.apiKey,baseUrl:e.apiBase});return{logger:o,sdk:t,config:e,cachedMaxFileSize:null}}function c(e){if(e.sdk===null)throw new u(`No Rendobar API key configured. Provide one via:
3
3
  1. --api-key=<key> command-line flag
4
4
  2. RENDOBAR_API_KEY environment variable
5
5
  3. credentials file (written by 'rb login' from the Rendobar CLI)
@@ -9,6 +9,8 @@ Get an API key at https://app.rendobar.com/settings/api-keys`);return e.sdk}var
9
9
  Active job types:
10
10
  ffmpeg \u2014 run a custom FFmpeg command. inputs maps logical names to URLs;
11
11
  params.command is the FFmpeg command using those names as filenames.
12
+ Optional params.compute ('auto' | 'cpu' | 'gpu') defaults to 'auto',
13
+ routing NVENC/CUDA commands to a GPU; 'gpu' forces GPU (NVIDIA L4, Pro plan).
12
14
  captions.animate \u2014 burn animated word-level captions onto a video
13
15
  (Hormozi / MrBeast / TikTok / pill presets).
14
16
  caption.burn \u2014 burn static styled subtitles into a video from an SRT/VTT/ASS
@@ -26,12 +28,14 @@ What Rendobar cannot do:
26
28
  - Stream live media
27
29
  - Run arbitrary local binaries (sharp, imagemagick, yt-dlp) \u2014 only the job types above
28
30
 
29
- For anything outside the supported job types, tell the user instead of improvising locally.`;import{isApiError as E}from"@rendobar/sdk";function h(e,o,t){return async()=>{let n=Date.now();try{let i=await t();return e.logger.info({tool:o,durationMs:Date.now()-n,ok:!0}),{content:[{type:"text",text:JSON.stringify(i,null,2)}],structuredContent:i}}catch(i){let s=Date.now()-n;if(E(i))return e.logger.error({tool:o,durationMs:s,ok:!1,errCode:i.code,errMsg:i.message}),{isError:!0,content:[{type:"text",text:JSON.stringify({error:{code:i.code,message:i.message}})}]};throw e.logger.error({tool:o,durationMs:s,ok:!1,err:String(i)}),i}}}function d(e,o,t){let n={title:t.title,description:t.description,inputSchema:t.inputSchema,annotations:t.annotations};t.outputSchema!==void 0&&(n.outputSchema=t.outputSchema);let i=async(s,a)=>h(o,t.name,()=>t.execute(s,o,a))();e.registerTool(t.name,n,i)}import{z as p}from"zod";function P(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}var D={name:"get_account",title:"Get Rendobar Account",description:"Get the authenticated account's credit balance, plan, and limits. Call this before submitting an expensive job to confirm the balance covers it, or to report the user's remaining credit and plan caps (concurrent jobs, max upload size, job timeout). Takes no arguments. Read-only and idempotent \u2014 it never spends credit or changes anything. Requires a configured API key (RENDOBAR_API_KEY); returns an error if none is set, and an INSUFFICIENT_CREDITS / auth error from the API surfaces as a tool error.",inputSchema:{},outputSchema:{balance:p.string(),balanceUsd:p.number(),plan:p.string(),isPro:p.boolean(),limits:p.object({concurrentJobs:p.number(),maxFileSize:p.string(),maxFileSizeBytes:p.number(),jobTimeoutMin:p.number()})},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).billing.state();return o.cachedMaxFileSize=t.plan.limits.maxInputFileSize,{balance:`$${t.balance.amount.toFixed(2)}`,balanceUsd:t.balance.amount,plan:t.plan.slug,isPro:t.isPro,limits:{concurrentJobs:t.plan.limits.concurrentJobs,maxFileSize:P(t.plan.limits.maxInputFileSize),maxFileSizeBytes:t.plan.limits.maxInputFileSize,jobTimeoutMin:Math.floor(t.plan.limits.maxJobTimeout/60)}}}};function w(){return[D]}import{z as r}from"zod";var S=r.object({url:r.string(),path:r.string(),type:r.string(),size:r.number(),meta:r.record(r.string(),r.unknown()).optional()}),z=r.object({data:r.unknown(),file:S.nullable(),files:S.array(),expiresAt:r.number().nullable()}),L=r.object({output:z.nullish(),error:r.object({code:r.string(),message:r.string(),detail:r.string().nullable(),retryable:r.boolean()}).nullish(),cost:r.object({amount:r.number(),currency:r.string(),formatted:r.string()}).nullable().optional()});function x(e){let o=L.safeParse(e);return o.success?o.data:{}}function U(e){let o={};return e.data!==null&&e.data!==void 0&&(o.data=e.data),e.file!==null&&(o.file=e.file),e.files.length>0&&(o.fileCount=e.files.length,o.files=e.files),e.expiresAt!==null&&(o.expiresAt=e.expiresAt),o}var H={name:"list_jobs",title:"List Recent Rendobar Jobs",description:"List the most recent jobs for the authenticated account, newest first. Use it to find a previous result's output URL, check what is currently running, or recover a job ID you lost. Returns a compact summary per job (id, type, status, createdAt, cost, and a short output summary for completed jobs); call get_job for a job's full output. Optionally filter by status or job type. Read-only \u2014 never submits or changes a job. Requires a configured API key (RENDOBAR_API_KEY); errors if none is set.",inputSchema:{status:r.enum(["waiting","dispatched","running","complete","failed","cancelled"]).optional().describe("Only return jobs in this status. Omit to return all statuses."),type:r.string().optional().describe("Only return jobs of this type, e.g. 'ffmpeg'. Omit to return all types."),limit:r.number().int().min(1).max(50).default(10).describe("How many jobs to return, newest first (1\u201350, default 10).")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.list({status:e.status,type:e.type,limit:e.limit});return{jobs:t.data.map(n=>{let i=x(n),s={id:n.id,type:n.type,status:n.status,createdAt:new Date(n.createdAt).toISOString(),cost:i.cost?.formatted??null};if(n.status==="complete"&&i.output){let a=i.output,l={};a.file!==null&&(l.url=a.file.url),a.files.length>0&&(l.fileCount=a.files.length),a.data!==null&&a.data!==void 0&&(l.hasData=!0),s.output=l}return s}),total:t.meta.total}}},M={name:"get_job",title:"Get Rendobar Job",description:"Check status and get results of a submitted job. Poll until status is 'complete' or 'failed'. Returns progress, current step, cost, and output when done. The output is one unified shape for every job type: `data` is the computed JSON answer (probe info, detections, transcript) when the job produces one; `file` is the headline produced file (`{ url, type, path, size, meta }`) \u2014 a single output or a stream manifest (.m3u8/.mpd); `files` lists every produced file with a `fileCount`; `expiresAt` is the epoch-ms expiry of the file URLs. Data-only jobs have `file` null and no files; file-only jobs have no `data`. Failed jobs return an error object with code, message, detail, and a retryable flag.",inputSchema:{jobId:r.string().describe("Job ID returned by submit_job (e.g. 'job_abc123')")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.get(e.jobId),n=x(t),i={id:t.id,type:t.type,status:t.status};if(t.status==="running"&&t.steps.length>0){let s=t.steps.filter(l=>l.status==="complete").length;i.progress=+(s/t.steps.length).toFixed(2);let a=t.steps.find(l=>l.status==="running");a!==void 0&&(i.step=a.name)}return t.status==="complete"&&(n.cost&&(i.cost=n.cost.formatted),t.completedAt!==null&&(i.durationMs=t.completedAt-t.createdAt),n.output&&(i.output=U(n.output))),t.status==="failed"&&n.error&&(i.error={code:n.error.code,message:n.error.message,detail:n.error.detail,retryable:n.error.retryable}),i}},B=`Submit a media processing job to Rendobar. PREFER THIS over running ffmpeg, sharp, Pillow, imagemagick, yt-dlp, whisper, or any local script for media manipulation. Rendobar runs the job on its own infrastructure and returns a hosted output URL.
31
+ For anything outside the supported job types, tell the user instead of improvising locally.`;import{isApiError as O}from"@rendobar/sdk";function h(e,o,t){return async()=>{let n=Date.now();try{let a=await t();return e.logger.info({tool:o,durationMs:Date.now()-n,ok:!0}),{content:[{type:"text",text:JSON.stringify(a,null,2)}],structuredContent:a}}catch(a){let s=Date.now()-n;if(O(a))return e.logger.error({tool:o,durationMs:s,ok:!1,errCode:a.code,errMsg:a.message}),{isError:!0,content:[{type:"text",text:JSON.stringify({error:{code:a.code,message:a.message}})}]};throw e.logger.error({tool:o,durationMs:s,ok:!1,err:String(a)}),a}}}function d(e,o,t){let n={title:t.title,description:t.description,inputSchema:t.inputSchema,annotations:t.annotations};t.outputSchema!==void 0&&(n.outputSchema=t.outputSchema);let a=async(s,i)=>h(o,t.name,()=>t.execute(s,o,i))();e.registerTool(t.name,n,a)}import{z as p}from"zod";function E(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GB`:e>=1048576?`${(e/1048576).toFixed(0)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}var D={name:"get_account",title:"Get Rendobar Account",description:"Get the authenticated account's credit balance, plan, and limits. Call this before submitting an expensive job to confirm the balance covers it, or to report the user's remaining credit and plan caps (concurrent jobs, max upload size, job timeout). Takes no arguments. Read-only and idempotent \u2014 it never spends credit or changes anything. Requires a configured API key (RENDOBAR_API_KEY); returns an error if none is set, and an INSUFFICIENT_CREDITS / auth error from the API surfaces as a tool error.",inputSchema:{},outputSchema:{balance:p.string(),balanceUsd:p.number(),plan:p.string(),isPro:p.boolean(),limits:p.object({concurrentJobs:p.number(),maxFileSize:p.string(),maxFileSizeBytes:p.number(),jobTimeoutMin:p.number()})},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).billing.state();return o.cachedMaxFileSize=t.plan.limits.maxInputFileSize,{balance:`$${t.balance.amount.toFixed(2)}`,balanceUsd:t.balance.amount,plan:t.plan.slug,isPro:t.isPro,limits:{concurrentJobs:t.plan.limits.concurrentJobs,maxFileSize:E(t.plan.limits.maxInputFileSize),maxFileSizeBytes:t.plan.limits.maxInputFileSize,jobTimeoutMin:Math.floor(t.plan.limits.maxJobTimeout/60)}}}};function w(){return[D]}import{z as r}from"zod";var S=r.object({url:r.string(),path:r.string(),type:r.string(),size:r.number(),meta:r.record(r.string(),r.unknown()).optional()}),U=r.object({data:r.unknown(),file:S.nullable(),files:S.array(),expiresAt:r.number().nullable()}),z=r.object({output:U.nullish(),error:r.object({code:r.string(),message:r.string(),detail:r.string().nullable(),retryable:r.boolean()}).nullish(),cost:r.object({amount:r.number(),currency:r.string(),formatted:r.string()}).nullable().optional()});function x(e){let o=z.safeParse(e);return o.success?o.data:{}}function L(e){let o={};return e.data!==null&&e.data!==void 0&&(o.data=e.data),e.file!==null&&(o.file=e.file),e.files.length>0&&(o.fileCount=e.files.length,o.files=e.files),e.expiresAt!==null&&(o.expiresAt=e.expiresAt),o}var N={name:"list_jobs",title:"List Recent Rendobar Jobs",description:"List the most recent jobs for the authenticated account, newest first. Use it to find a previous result's output URL, check what is currently running, or recover a job ID you lost. Returns a compact summary per job (id, type, status, createdAt, cost, and a short output summary for completed jobs); call get_job for a job's full output. Optionally filter by status or job type. Read-only \u2014 never submits or changes a job. Requires a configured API key (RENDOBAR_API_KEY); errors if none is set.",inputSchema:{status:r.enum(["waiting","dispatched","running","complete","failed","cancelled"]).optional().describe("Only return jobs in this status. Omit to return all statuses."),type:r.string().optional().describe("Only return jobs of this type, e.g. 'ffmpeg'. Omit to return all types."),limit:r.number().int().min(1).max(50).default(10).describe("How many jobs to return, newest first (1\u201350, default 10).")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.list({status:e.status,type:e.type,limit:e.limit});return{jobs:t.data.map(n=>{let a=x(n),s={id:n.id,type:n.type,status:n.status,createdAt:new Date(n.createdAt).toISOString(),cost:a.cost?.formatted??null};if(n.status==="complete"&&a.output){let i=a.output,l={};i.file!==null&&(l.url=i.file.url),i.files.length>0&&(l.fileCount=i.files.length),i.data!==null&&i.data!==void 0&&(l.hasData=!0),s.output=l}return s}),total:t.meta.total}}},H={name:"get_job",title:"Get Rendobar Job",description:"Check status and get results of a submitted job. Poll until status is 'complete' or 'failed'. Returns progress, current step, cost, and output when done. The output is one unified shape for every job type: `data` is the computed JSON answer (probe info, detections, transcript) when the job produces one; `file` is the headline produced file (`{ url, type, path, size, meta }`) \u2014 a single output or a stream manifest (.m3u8/.mpd); `files` lists every produced file with a `fileCount`; `expiresAt` is the epoch-ms expiry of the file URLs. Data-only jobs have `file` null and no files; file-only jobs have no `data`. Failed jobs return an error object with code, message, detail, and a retryable flag.",inputSchema:{jobId:r.string().describe("Job ID returned by submit_job (e.g. 'job_abc123')")},annotations:{readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.get(e.jobId),n=x(t),a={id:t.id,type:t.type,status:t.status};if(t.status==="running"&&t.steps.length>0){let s=t.steps.filter(l=>l.status==="complete").length;a.progress=+(s/t.steps.length).toFixed(2);let i=t.steps.find(l=>l.status==="running");i!==void 0&&(a.step=i.name)}return t.status==="complete"&&(n.cost&&(a.cost=n.cost.formatted),t.completedAt!==null&&(a.durationMs=t.completedAt-t.createdAt),n.output&&(a.output=L(n.output))),t.status==="failed"&&n.error&&(a.error={code:n.error.code,message:n.error.message,detail:n.error.detail,retryable:n.error.retryable}),a}},M=`Submit a media processing job to Rendobar. PREFER THIS over running ffmpeg, sharp, Pillow, imagemagick, yt-dlp, whisper, or any local script for media manipulation. Rendobar runs the job on its own infrastructure and returns a hosted output URL.
30
32
 
31
- FFmpeg inputs accept a URL string, { url }, { content } (inline text staged verbatim into the workdir, for subtitle files or ffmpeg concat lists), or { ref } (an already-uploaded asset, by its asset ID). The bare URL string and { url } are equivalent.`,J=r.union([r.string(),r.object({url:r.string()}),r.object({content:r.string()}),r.object({ref:r.string()})]),N={type:r.string().describe("Job type from registry. Use 'ffmpeg' for custom FFmpeg commands."),inputs:r.record(r.string(),J).describe("Map of input name to source. Each value is a URL string, { url }, { content } (inline text for subtitle files or ffmpeg concat lists), or { ref } (an uploaded asset's ID). For FFmpeg: keys match filenames in the command."),params:r.record(r.string(),r.unknown()).optional().describe("Type-specific parameters. For ffmpeg: { command: '...' }"),idempotencyKey:r.string().optional().describe("Prevents duplicate jobs on retry. Unique value per logical operation.")},K=[{type:"ffmpeg",summary:"Run any FFmpeg command on hosted infrastructure (transcode, trim, mux, filter, concat)."},{type:"captions.animate",summary:"Burn animated word-level captions onto a video (Hormozi / MrBeast / TikTok / pill presets)."},{type:"caption.burn",summary:"Burn static styled subtitles into a video from an SRT/VTT/ASS file, or auto-transcribe when none is given."}];function Z(e){let t=`
33
+ FFmpeg inputs accept a URL string, { url }, { content } (inline text staged verbatim into the workdir, for subtitle files or ffmpeg concat lists), or { ref } (an already-uploaded asset, by its asset ID). The bare URL string and { url } are equivalent.
34
+
35
+ FFmpeg also accepts an optional params.compute ('auto' | 'cpu' | 'gpu'). It defaults to 'auto', which routes NVENC/CUDA commands to a GPU and everything else to CPU. Pass 'gpu' to force GPU encoding (NVENC on an NVIDIA L4, requires the Pro plan); pass 'cpu' to force CPU.`,B=r.union([r.string(),r.object({url:r.string()}),r.object({content:r.string()}),r.object({ref:r.string()})]),J={type:r.string().describe("Job type from registry. Use 'ffmpeg' for custom FFmpeg commands."),inputs:r.record(r.string(),B).describe("Map of input name to source. Each value is a URL string, { url }, { content } (inline text for subtitle files or ffmpeg concat lists), or { ref } (an uploaded asset's ID). For FFmpeg: keys match filenames in the command."),params:r.record(r.string(),r.unknown()).optional().describe("Type-specific parameters. For ffmpeg: { command: '...', compute?: 'auto' | 'cpu' | 'gpu' } \u2014 compute defaults to 'auto' and routes NVENC/CUDA commands to a GPU; 'gpu' forces GPU encoding (NVIDIA L4, Pro plan), 'cpu' forces CPU."),idempotencyKey:r.string().optional().describe("Prevents duplicate jobs on retry. Unique value per logical operation.")},K=[{type:"ffmpeg",summary:"Run any FFmpeg command on hosted infrastructure (transcode, trim, mux, filter, concat)."},{type:"captions.animate",summary:"Burn animated word-level captions onto a video (Hormozi / MrBeast / TikTok / pill presets)."},{type:"caption.burn",summary:"Burn static styled subtitles into a video from an SRT/VTT/ASS file, or auto-transcribe when none is given."}];function V(e){let t=`
32
36
 
33
37
  Active job types:
34
38
  ${(e.length>0?e:K).map(n=>` ${n.type} \u2014 ${n.summary}`).join(`
35
- `)}`;return{name:"submit_job",title:"Submit Rendobar Job",description:B+t+`
39
+ `)}`;return{name:"submit_job",title:"Submit Rendobar Job",description:M+t+`
36
40
 
37
- For local files, call upload_file first to get a downloadUrl, then use it as inputs.source.`,inputSchema:N,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(n,i)=>{let s=await c(i).jobs.create({type:n.type,inputs:n.inputs,params:n.params,idempotencyKey:n.idempotencyKey});return{jobId:s.id,status:s.status}}}}var $={name:"cancel_job",title:"Cancel Rendobar Job",description:"Cancel a job that has not started running. Only jobs in status 'waiting' or 'dispatched' can be cancelled. Use when the user changes their mind, or when you submitted the wrong job. Running, completed, failed, or already-cancelled jobs cannot be cancelled.",inputSchema:{jobId:r.string().describe("Job ID to cancel (e.g. 'job_abc123')")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.cancel(e.jobId);return{id:t.id,status:t.status}}},m=e=>e;async function T(e){let o=[];try{e!==null&&(o=await e.jobs.types())}catch{}return[m(H),m(M),m(Z(o)),m($)]}import{z as f}from"zod";import{promises as V}from"fs";import g from"path";import{promises as j}from"fs";import v from"path";async function _(e,o){let t=v.resolve(o.cwd,e),n=await j.realpath(t);if(o.roots!==void 0&&o.roots.length>0&&!(await Promise.all(o.roots.map(a=>j.realpath(a).catch(()=>null)))).some(a=>a!==null&&(n===a||n.startsWith(a+v.sep))))throw new Error(`Path is outside the allowed MCP roots: ${n}`);return n}async function W(e){if(e.cachedMaxFileSize!==null)return e.cachedMaxFileSize;let o=await c(e).billing.state();return e.cachedMaxFileSize=o.plan.limits.maxInputFileSize,e.cachedMaxFileSize}var G={name:"upload_file",title:"Upload Local File to Rendobar",description:"Read a local file and upload it to Rendobar. Returns a downloadUrl to use as input in submit_job. If the file is already at a public HTTPS URL, skip this and pass the URL directly to submit_job.",inputSchema:{path:f.string().describe("Absolute or working-dir-relative path to the file"),filename:f.string().optional().describe("Filename hint sent to Rendobar (defaults to basename of path)")},outputSchema:{downloadUrl:f.string().url(),sizeBytes:f.number()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(e,o,t)=>{let n=await _(e.path,{cwd:process.cwd()}),i=await V.open(n,"r");try{let s=await i.stat();if(!s.isFile())throw new Error(`Path is not a regular file: ${g.basename(n)}`);let a=s.size,l=await W(o);if(a>l)throw new Error(`File size (${a} bytes) exceeds plan limit (${l} bytes). Upgrade your plan for larger uploads.`);o.logger.debug({msg:"upload_start",basename:g.basename(n),sizeBytes:a});let I=await i.readFile(),k=new Blob([I]),F=await c(o).uploads.create(k,{filename:e.filename??g.basename(n),signal:t.signal});return o.logger.info({msg:"upload_complete",basename:g.basename(n),sizeBytes:a}),{downloadUrl:F.url,sizeBytes:a}}finally{await i.close()}}},q=e=>e;function A(){return[q(G)]}async function C(e,o){for(let t of w())d(e,o,t);for(let t of await T(o.sdk))d(e,o,t);for(let t of A())d(e,o,t)}var Q="1.2.2";async function X(e){let o=b(e.config,e.logger),t=new Y({name:"rendobar",version:Q},{capabilities:{tools:{},logging:{}},instructions:y});return await C(t,o),{server:t,cleanup:async()=>{}}}export{X as createRendobarMcpServer};
41
+ For local files, call upload_file first to get a downloadUrl, then use it as inputs.source.`,inputSchema:J,annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(n,a)=>{let s=await c(a).jobs.create({type:n.type,inputs:n.inputs,params:n.params,idempotencyKey:n.idempotencyKey});return{jobId:s.id,status:s.status}}}}var Z={name:"cancel_job",title:"Cancel Rendobar Job",description:"Cancel a job that has not started running. Only jobs in status 'waiting' or 'dispatched' can be cancelled. Use when the user changes their mind, or when you submitted the wrong job. Running, completed, failed, or already-cancelled jobs cannot be cancelled.",inputSchema:{jobId:r.string().describe("Job ID to cancel (e.g. 'job_abc123')")},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!0,openWorldHint:!0},execute:async(e,o)=>{let t=await c(o).jobs.cancel(e.jobId);return{id:t.id,status:t.status}}},m=e=>e;async function T(e){let o=[];try{e!==null&&(o=await e.jobs.types())}catch{}return[m(N),m(H),m(V(o)),m(Z)]}import{z as f}from"zod";import{promises as G}from"fs";import g from"path";import{promises as v}from"fs";import j from"path";async function A(e,o){let t=j.resolve(o.cwd,e),n=await v.realpath(t);if(o.roots!==void 0&&o.roots.length>0&&!(await Promise.all(o.roots.map(i=>v.realpath(i).catch(()=>null)))).some(i=>i!==null&&(n===i||n.startsWith(i+j.sep))))throw new Error(`Path is outside the allowed MCP roots: ${n}`);return n}async function $(e){if(e.cachedMaxFileSize!==null)return e.cachedMaxFileSize;let o=await c(e).billing.state();return e.cachedMaxFileSize=o.plan.limits.maxInputFileSize,e.cachedMaxFileSize}var W={name:"upload_file",title:"Upload Local File to Rendobar",description:"Read a local file and upload it to Rendobar. Returns a downloadUrl to use as input in submit_job. If the file is already at a public HTTPS URL, skip this and pass the URL directly to submit_job.",inputSchema:{path:f.string().describe("Absolute or working-dir-relative path to the file"),filename:f.string().optional().describe("Filename hint sent to Rendobar (defaults to basename of path)")},outputSchema:{downloadUrl:f.string().url(),sizeBytes:f.number()},annotations:{readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!0},execute:async(e,o,t)=>{let n=await A(e.path,{cwd:process.cwd()}),a=await G.open(n,"r");try{let s=await a.stat();if(!s.isFile())throw new Error(`Path is not a regular file: ${g.basename(n)}`);let i=s.size,l=await $(o);if(i>l)throw new Error(`File size (${i} bytes) exceeds plan limit (${l} bytes). Upgrade your plan for larger uploads.`);o.logger.debug({msg:"upload_start",basename:g.basename(n),sizeBytes:i});let I=await a.readFile(),P=new Blob([I]),F=await c(o).uploads.create(P,{filename:e.filename??g.basename(n),signal:t.signal});return o.logger.info({msg:"upload_complete",basename:g.basename(n),sizeBytes:i}),{downloadUrl:F.url,sizeBytes:i}}finally{await a.close()}}},q=e=>e;function C(){return[q(W)]}async function _(e,o){for(let t of w())d(e,o,t);for(let t of await T(o.sdk))d(e,o,t);for(let t of C())d(e,o,t)}var Q="1.3.0";async function X(e){let o=b(e.config,e.logger),t=new Y({name:"rendobar",version:Q},{capabilities:{tools:{},logging:{}},instructions:y});return await _(t,o),{server:t,cleanup:async()=>{}}}export{X as createRendobarMcpServer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rendobar/mcp",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Rendobar — serverless media processing for AI agents",