@vprop/mcp 1.0.5 → 1.0.6

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 +12 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2,8 +2,7 @@
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { readFileSync } from "node:fs";
5
- import { extname } from "node:path";
6
- import { randomUUID } from "node:crypto";
5
+ import { extname, basename } from "node:path";
7
6
  import { z } from "zod";
8
7
  const BASE_URL = process.env.VPROP_BASE_URL ?? "https://vprop.ai/api/v1";
9
8
  function getApiKey() {
@@ -169,7 +168,7 @@ server.registerTool("upload_listing_image", {
169
168
  if (!content_type) {
170
169
  throw new Error(`Unsupported extension '${ext}'. Use .jpg, .jpeg, .png, or .webp`);
171
170
  }
172
- const filename = file_path.split("/").pop() ?? "image.jpg";
171
+ const filename = basename(file_path) || "image.jpg";
173
172
  // Read file before any API call — if the file is missing or unreadable
174
173
  // we fail here without touching remote state.
175
174
  const fileData = readFileSync(file_path);
@@ -184,11 +183,16 @@ server.registerTool("upload_listing_image", {
184
183
  await uploadBuffer(upload_url, fileData, content_type);
185
184
  }
186
185
  catch (err) {
187
- await vpropFetch(`/listings/${listing_id}/images/${image_id}`, {
188
- method: "DELETE",
189
- }).catch(() => { });
186
+ let cleanedUp = false;
187
+ try {
188
+ await vpropFetch(`/listings/${listing_id}/images/${image_id}`, { method: "DELETE" });
189
+ cleanedUp = true;
190
+ }
191
+ catch { }
190
192
  throw new Error(`Upload failed: ${err instanceof Error ? err.message : String(err)}. ` +
191
- `The image record (${image_id}) has been cleaned up.`);
193
+ (cleanedUp
194
+ ? `The image record (${image_id}) has been cleaned up.`
195
+ : `The image record (${image_id}) may still exist — call delete_listing_image to remove it.`));
192
196
  }
193
197
  return toText({ image_id, image_url, expires_at });
194
198
  });
@@ -274,7 +278,7 @@ server.registerTool("upload_agent_photo", {
274
278
  if (!content_type) {
275
279
  throw new Error(`Unsupported extension '${ext}'. Use .jpg, .jpeg, .png, or .webp`);
276
280
  }
277
- const filename = file_path.split("/").pop() ?? "photo.jpg";
281
+ const filename = basename(file_path) || "photo.jpg";
278
282
  // Read file before any API call — the presigned-URL endpoint immediately
279
283
  // stamps agents.photo in the DB, so a missing/unreadable file must be
280
284
  // caught here before we mutate remote state.
@@ -321,7 +325,6 @@ server.registerTool("create_project", {
321
325
  : undefined;
322
326
  return toText(await vpropFetch("/projects", {
323
327
  method: "POST",
324
- headers: { "Idempotency-Key": randomUUID() },
325
328
  body: JSON.stringify({ listing_id, agent_id, title, cta, options, metadata }),
326
329
  }));
327
330
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vprop/mcp",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "MCP server for the vProp Public API — generate real-estate listing videos with AI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "scripts": {
14
14
  "build": "tsc",
15
- "prepare": "tsc",
15
+ "prepack": "tsc",
16
16
  "dev": "node --experimental-strip-types src/index.ts",
17
17
  "start": "node dist/index.js"
18
18
  },