@obrahaus/fileforge-mcp 2.2.0 → 2.2.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.
Files changed (2) hide show
  1. package/dist/index.js +7 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68,14 +68,17 @@ var ToolError = class extends Error {
68
68
  }
69
69
  };
70
70
  function friendlyApiError(status, body, ctx) {
71
- const code = body?.error ?? body?.code ?? `http_${status}`;
72
- const apiMsg = body?.message ?? `request failed with HTTP ${status}`;
71
+ const err = body?.error;
72
+ const nested = err && typeof err === "object" ? err : void 0;
73
+ const str = (v) => typeof v === "string" ? v : void 0;
74
+ const code = str(nested?.code) ?? str(err) ?? str(body?.code) ?? `http_${status}`;
75
+ const apiMsg = str(nested?.message) ?? str(body?.message) ?? `request failed with HTTP ${status}`;
73
76
  switch (code) {
74
77
  case "unauthorized":
75
78
  return new ToolError(code, "FileForge rejected the API key (401). Check FILEFORGE_API_KEY is a valid, non-revoked ff_live_ key.");
76
79
  case "forbidden":
77
80
  case "pro_option":
78
- return new ToolError(code, `${apiMsg} This requires a Forge Pro plan. Use a Pro API key or drop the Pro-only option/target.`);
81
+ return new ToolError(code, `${apiMsg.replace(/\s*$/, "")}. This needs a Forge Pro plan \u2014 use a Pro API key, or drop the Pro-only option/target.`);
79
82
  case "unsupported_pair":
80
83
  return new ToolError(code, ctx?.validTargets?.length ? `${apiMsg} Valid targets for this source: ${ctx.validTargets.join(", ")}. Call list_formats to confirm.` : `${apiMsg} Call list_formats to see valid target formats for this source.`);
81
84
  case "unknown_preset":
@@ -1345,7 +1348,7 @@ function registerConvertFiles(server, ctx) {
1345
1348
 
1346
1349
  // src/server.ts
1347
1350
  var SERVER_NAME = "fileforge";
1348
- var SERVER_VERSION = "2.2.0";
1351
+ var SERVER_VERSION = "2.2.1";
1349
1352
  function buildServer(ctx) {
1350
1353
  const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });
1351
1354
  registerListFormats(server, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obrahaus/fileforge-mcp",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol server for FileForge — let AI agents convert files (images, audio, video, documents, archives) without learning the REST API.",
6
6
  "type": "module",