@nbakka/mcp-appium 2.0.56 → 2.0.57
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/lib/server.js +5 -4
- package/package.json +1 -1
package/lib/server.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createMcpServer = void 0;
|
|
4
4
|
const fs = require('fs').promises;
|
|
5
5
|
const os = require('os');
|
|
6
|
+
const fsSync = require('fs');
|
|
6
7
|
const path = require('path');
|
|
7
8
|
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
8
9
|
const zod_1 = require("zod");
|
|
@@ -575,7 +576,7 @@ tool(
|
|
|
575
576
|
await Promise.all(
|
|
576
577
|
files.map(file => fs.unlink(path.join(exportPath, file)))
|
|
577
578
|
);
|
|
578
|
-
console.log("
|
|
579
|
+
console.log("Cleared existing files in figma folder");
|
|
579
580
|
} catch (err) {
|
|
580
581
|
// Folder doesn't exist or is empty, no need to clear
|
|
581
582
|
if (err.code !== 'ENOENT') {
|
|
@@ -608,11 +609,11 @@ tool(
|
|
|
608
609
|
try {
|
|
609
610
|
// Load OpenAI API key from Desktop/openai.json
|
|
610
611
|
const openaiConfigPath = path.join(os.homedir(), "Desktop", "openai.json");
|
|
611
|
-
const configContent = fs.
|
|
612
|
+
const configContent = await fs.readFile(openaiConfigPath, "utf-8");
|
|
612
613
|
const { apiKey } = JSON.parse(configContent);
|
|
613
614
|
|
|
614
615
|
const figmaDir = path.join(os.homedir(), "Desktop", "figma");
|
|
615
|
-
const files = fs.
|
|
616
|
+
const files = await fs.readdir(figmaDir);
|
|
616
617
|
const pdfFiles = files.filter(file => file.toLowerCase().endsWith('.pdf'));
|
|
617
618
|
|
|
618
619
|
if (pdfFiles.length === 0) throw new Error("No PDF files found in figma folder");
|
|
@@ -623,7 +624,7 @@ tool(
|
|
|
623
624
|
const client = new OpenAI({ apiKey });
|
|
624
625
|
|
|
625
626
|
const file = await client.files.create({
|
|
626
|
-
file:
|
|
627
|
+
file: fsSync.createReadStream(pdfPath),
|
|
627
628
|
purpose: "user_data",
|
|
628
629
|
});
|
|
629
630
|
|