@seed-design/mcp 0.1.9-20250806062026 → 0.1.10
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/bin/index.mjs +24 -7
- package/package.json +4 -5
- package/src/bin/index.ts +1 -1
- package/src/config.ts +32 -8
package/bin/index.mjs
CHANGED
|
@@ -6,7 +6,8 @@ import { v4 } from 'uuid';
|
|
|
6
6
|
import WebSocket$1 from 'ws';
|
|
7
7
|
import { createRestNormalizer, figma, react, getFigmaColorVariableNames } from '@seed-design/figma';
|
|
8
8
|
import { z } from 'zod';
|
|
9
|
-
import
|
|
9
|
+
import fs from 'node:fs';
|
|
10
|
+
import path from 'node:path';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Custom logging module that writes to stderr instead of stdout
|
|
@@ -677,17 +678,33 @@ function registerPrompts(server) {
|
|
|
677
678
|
});
|
|
678
679
|
}
|
|
679
680
|
|
|
680
|
-
var version = "0.1.
|
|
681
|
+
var version = "0.1.10";
|
|
681
682
|
|
|
682
683
|
// Config loader
|
|
683
684
|
async function loadConfig(configPath) {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
685
|
+
try {
|
|
686
|
+
const resolvedPath = path.resolve(process.cwd(), configPath);
|
|
687
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
688
|
+
logger.error(`Config file not found: ${resolvedPath}`);
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
// Handle different file types
|
|
692
|
+
if (resolvedPath.endsWith(".json")) {
|
|
693
|
+
const content = fs.readFileSync(resolvedPath, "utf-8");
|
|
694
|
+
return JSON.parse(content);
|
|
695
|
+
}
|
|
696
|
+
if (resolvedPath.endsWith(".js") || resolvedPath.endsWith(".mjs") || resolvedPath.endsWith(".ts") || resolvedPath.endsWith(".mts")) {
|
|
697
|
+
// For JS/MJS/TS/MTS files, we can dynamically import with Bun
|
|
698
|
+
// Bun has built-in TypeScript support without requiring transpilation
|
|
699
|
+
const config = await import(resolvedPath);
|
|
700
|
+
return config.default || config;
|
|
701
|
+
}
|
|
702
|
+
logger.error(`Unsupported config file format: ${resolvedPath}`);
|
|
703
|
+
return null;
|
|
704
|
+
} catch (error) {
|
|
705
|
+
logger.error(`Failed to load config file: ${error instanceof Error ? error.message : String(error)}`);
|
|
688
706
|
return null;
|
|
689
707
|
}
|
|
690
|
-
return searchResult.config;
|
|
691
708
|
}
|
|
692
709
|
|
|
693
710
|
// Initialize CLI
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -23,10 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
26
|
-
"@seed-design/figma": "0.1.
|
|
26
|
+
"@seed-design/figma": "0.1.10",
|
|
27
27
|
"cac": "^6.7.14",
|
|
28
|
-
"cosmiconfig": "^9.0.0",
|
|
29
|
-
"typescript": "^5.9.2",
|
|
30
28
|
"uuid": "^11.1.0",
|
|
31
29
|
"ws": "^8.18.1",
|
|
32
30
|
"yargs": "^18.0.0",
|
|
@@ -35,7 +33,8 @@
|
|
|
35
33
|
"devDependencies": {
|
|
36
34
|
"@types/bun": "^1.2.10",
|
|
37
35
|
"@types/ws": "^8.18.1",
|
|
38
|
-
"@types/yargs": "^17.0.33"
|
|
36
|
+
"@types/yargs": "^17.0.33",
|
|
37
|
+
"typescript": "^5.8.3"
|
|
39
38
|
},
|
|
40
39
|
"publishConfig": {
|
|
41
40
|
"access": "public"
|
package/src/bin/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { logger } from "../logger";
|
|
|
7
7
|
import { createFigmaWebSocketClient } from "../websocket";
|
|
8
8
|
import { registerEditingTools, registerTools } from "../tools";
|
|
9
9
|
import { registerPrompts } from "../prompts";
|
|
10
|
-
import { version } from "../../package.json"
|
|
10
|
+
import { version } from "../../package.json" assert { type: "json" };
|
|
11
11
|
import type { Server, ServerWebSocket } from "bun";
|
|
12
12
|
import { loadConfig, type McpConfig } from "../config";
|
|
13
13
|
|
package/src/config.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CreatePipelineConfig } from "@seed-design/figma/codegen/targets/react";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
2
4
|
import { logger } from "./logger";
|
|
3
|
-
import { cosmiconfig } from "cosmiconfig";
|
|
4
5
|
|
|
5
6
|
// Define config type
|
|
6
7
|
export interface McpConfig {
|
|
@@ -8,16 +9,39 @@ export interface McpConfig {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
// Config loader
|
|
11
|
-
export async function loadConfig(configPath: string)
|
|
12
|
-
|
|
12
|
+
export async function loadConfig(configPath: string) {
|
|
13
|
+
try {
|
|
14
|
+
const resolvedPath = path.resolve(process.cwd(), configPath);
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
if (!fs.existsSync(resolvedPath)) {
|
|
17
|
+
logger.error(`Config file not found: ${resolvedPath}`);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
// Handle different file types
|
|
22
|
+
if (resolvedPath.endsWith(".json")) {
|
|
23
|
+
const content = fs.readFileSync(resolvedPath, "utf-8");
|
|
24
|
+
return JSON.parse(content);
|
|
25
|
+
}
|
|
18
26
|
|
|
27
|
+
if (
|
|
28
|
+
resolvedPath.endsWith(".js") ||
|
|
29
|
+
resolvedPath.endsWith(".mjs") ||
|
|
30
|
+
resolvedPath.endsWith(".ts") ||
|
|
31
|
+
resolvedPath.endsWith(".mts")
|
|
32
|
+
) {
|
|
33
|
+
// For JS/MJS/TS/MTS files, we can dynamically import with Bun
|
|
34
|
+
// Bun has built-in TypeScript support without requiring transpilation
|
|
35
|
+
const config = await import(resolvedPath);
|
|
36
|
+
return config.default || config;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
logger.error(`Unsupported config file format: ${resolvedPath}`);
|
|
40
|
+
return null;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
logger.error(
|
|
43
|
+
`Failed to load config file: ${error instanceof Error ? error.message : String(error)}`,
|
|
44
|
+
);
|
|
19
45
|
return null;
|
|
20
46
|
}
|
|
21
|
-
|
|
22
|
-
return searchResult.config;
|
|
23
47
|
}
|