@seed-design/mcp 0.1.9-20250806055925 → 0.1.9

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 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 { cosmiconfig } from 'cosmiconfig';
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.9-20250806034801";
681
+ var version = "0.1.9";
681
682
 
682
683
  // Config loader
683
684
  async function loadConfig(configPath) {
684
- const explorer = cosmiconfig("mcp");
685
- const searchResult = await explorer.load(configPath);
686
- if (!searchResult) {
687
- logger.error(`Config file not found: ${configPath}`);
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.9-20250806055925",
3
+ "version": "0.1.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/daangn/seed-design.git",
@@ -23,9 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@modelcontextprotocol/sdk": "^1.10.2",
26
- "@seed-design/figma": "0.1.8",
26
+ "@seed-design/figma": "0.1.9",
27
27
  "cac": "^6.7.14",
28
- "cosmiconfig": "^9.0.0",
29
28
  "uuid": "^11.1.0",
30
29
  "ws": "^8.18.1",
31
30
  "yargs": "^18.0.0",
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): Promise<McpConfig | null> {
12
- const explorer = cosmiconfig("mcp");
12
+ export async function loadConfig(configPath: string) {
13
+ try {
14
+ const resolvedPath = path.resolve(process.cwd(), configPath);
13
15
 
14
- const searchResult = await explorer.load(configPath);
16
+ if (!fs.existsSync(resolvedPath)) {
17
+ logger.error(`Config file not found: ${resolvedPath}`);
18
+ return null;
19
+ }
15
20
 
16
- if (!searchResult) {
17
- logger.error(`Config file not found: ${configPath}`);
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
  }