@codify-ai/mcp-client 1.0.28 → 1.0.29

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 (3) hide show
  1. package/README.md +27 -17
  2. package/dist/index.js +0 -13
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -24,8 +24,6 @@
24
24
  - 🛠️ **全能工具箱**:包含代码获取、设计稿生成、双向同步等 10+ 个专业工具
25
25
  - 📦 **资源访问**:通过 URI `Codify://get_code/{content_id}` 访问代码
26
26
 
27
-
28
-
29
27
  ## 快速开始
30
28
 
31
29
  ### 1. 配置 MCP
@@ -58,8 +56,7 @@
58
56
 
59
57
  在IDE / CLI 中,您可以:
60
58
 
61
-
62
- ### 方式 1:将设计稿给其他人(研发)拉取代码到本地
59
+ #### 方式 1:将设计稿给其他人(研发)拉取代码到本地
63
60
 
64
61
  在 Codify 插件中选中一个元素,复制的指令然后给到其他人来获取代码。
65
62
 
@@ -69,8 +66,6 @@
69
66
  codify://getCode/{contentId}
70
67
  ```
71
68
 
72
-
73
-
74
69
  #### 方式 2:使用 AI 工具进行设计稿与代码的双向交互
75
70
 
76
71
  直接在对话框输入指令,AI 会自动识别并调用工具:
@@ -86,86 +81,101 @@ codify://getCode/{contentId}
86
81
 
87
82
  在对话中通过或直接输入 URI 引用:
88
83
 
89
- - `codify://generation-rules`
84
+ - `codify://generation-rules`
90
85
  - 逆向转译与代码规范:
91
- 你需要让 LLM 严格遵守转译代码规范才能完美的将它转译为 MasterGo 设计稿。当你需要将你已有的前端项目转换为设计稿的时候,必须让 LLM 读取此文档。
86
+ 你需要让 LLM 严格遵守转译代码规范才能完美的将它转译为 MasterGo 设计稿。当你需要将你已有的前端项目转换为设计稿的时候,必须让 LLM 读取此文档。
92
87
 
93
- - `codify://design-philosophy`
88
+ - `codify://design-philosophy`
94
89
  - 核心设计哲学:
95
- Codify为你总结了一套非常实用的UI设计哲学,它能够让LLM在生成页面的时候,保持优秀的设计审美。
96
-
97
-
98
-
99
-
90
+ Codify为你总结了一套非常实用的UI设计哲学,它能够让LLM在生成页面的时候,保持优秀的设计审美。
100
91
 
101
92
  ## 可用工具
102
93
 
103
94
  ### 🔍 获取与比对
104
95
 
105
96
  #### **get_selection_code**
97
+
106
98
  获取 MasterGo 中当前选中图层(或指定图层)的代码。支持根节点完整保存,以及子节点自动合并到本地基准 HTML 文件。
99
+
107
100
  - **参数**: `projectDir` (必填), `targetNodeId` (可选), `syncToBase` (可选, 默认 true)
108
101
  - **示例**: "获取当前选中图层的代码"
109
102
 
110
103
  #### **get_design_diff**
104
+
111
105
  获取最新设计稿代码与本地 `.codify` 目录中旧代码的差异 (Diff)。用于全量或局部同步。
106
+
112
107
  - **参数**: `projectDir` (必填), `targetNodeId` (可选), `filePath` (可选)
113
108
  - **示例**: "对比最新设计稿,看看有哪些改动"
114
109
 
115
110
  #### **get_code_list**
111
+
116
112
  列出所有可用的代码列表。
113
+
117
114
  - **参数**: 无
118
115
  - **示例**: "查看我可以拉取的代码列表"
119
116
 
120
117
  #### **get_code**
118
+
121
119
  通过 `contentId` 获取特定代码并保存到本地。
120
+
122
121
  - **参数**: `contentId` (必填), `projectDir` (必填), `outDir` (必填), `documentId` (可选)
123
122
  - **示例**: "从频道 demo-123 获取代码"
124
123
 
125
124
  ### 🎨 生成与设计
126
125
 
127
126
  #### **design**
127
+
128
128
  根据自然语言需求生成符合 Codify 规范的 HTML+CSS 代码。
129
+
129
130
  - **参数**: `requirement` (必填)
130
131
  - **示例**: "帮我设计一个深色模式的登录页面"
131
132
 
132
133
  #### **agent_create_page**
134
+
133
135
  将生成的 HTML 代码发送到 MasterGo 插件并创建新页面。
136
+
134
137
  - **参数**: `code` (可选), `filePath` (可选), `projectDir` (必填), `saveCodeToLocal` (可选)
135
138
  - **示例**: "在 MasterGo 中创建一个新页面,代码在 ./temp.html"
136
139
 
137
140
  #### **agent_create_component**
141
+
138
142
  创建一个 MasterGo 母版组件或组件集(变体)。
143
+
139
144
  - **参数**: `code` (必填)
140
145
  - **示例**: "将这段 HTML 创建为 MasterGo 组件"
141
146
 
142
147
  ### 🛠️ 操作与更新
143
148
 
144
149
  #### **agent_update_node**
150
+
145
151
  将修改后的 HTML 代码发回 MasterGo 进行局部更新。**注意:必须包含 `data-node-id`。**
152
+
146
153
  - **参数**: `code` (必填), `targetNodeId` (可选), `documentId` (可选)
147
154
  - **示例**: "更新选中的按钮颜色为蓝色"
148
155
 
149
156
  #### **agent_sync_design**
157
+
150
158
  将本地完整的静态 HTML 文件内容全量同步覆盖到 MasterGo 画布。
159
+
151
160
  - **参数**: `filePath` (必填), `targetNodeId` (必填, 根节点 ID), `documentId` (可选)
152
161
  - **示例**: "同步本地 index.html 到设计稿根节点"
153
162
 
154
163
  #### **agent_remove_node**
164
+
155
165
  在 MasterGo 中删除指定的或当前选中的图层。
166
+
156
167
  - **参数**: `targetNodeId` (可选), `documentId` (可选)
157
168
  - **示例**: "删除选中的图层"
158
169
 
159
-
160
-
161
170
  ### 👤 系统信息
162
171
 
163
172
  #### **get_user_info**
173
+
164
174
  查看当前登录用户信息、团队信息以及配额使用情况。
175
+
165
176
  - **参数**: 无
166
177
  - **示例**: "查看我的配额还剩多少"
167
178
 
168
-
169
179
  ## 许可证
170
180
 
171
181
  MIT
package/dist/index.js CHANGED
@@ -92,7 +92,6 @@ async function writeResource(resData, targetDir, folderName, ext) {
92
92
  const response = await axios.get(content, { responseType: "arraybuffer" });
93
93
  await fs.writeFile(filePath, response.data);
94
94
  } catch (err) {
95
- console.error(`[Codify MCP] 资源下载失败 ${content}:`, err.message);
96
95
  }
97
96
  } else if (typeof content === "string" && content.startsWith("data:image/")) {
98
97
  const parts = content.split(";base64,");
@@ -424,9 +423,6 @@ const getSelectionCodeTool = {
424
423
  parentId
425
424
  } = nodeInfo;
426
425
  if (targetNodeId === rootId) {
427
- console.log(
428
- `[getSelectionCode] 当前节点ID: ${targetNodeId}, 根节点ID: ${rootId}`
429
- );
430
426
  const saveResult = await saveCodeAndResources({
431
427
  baseDir,
432
428
  documentId,
@@ -451,9 +447,6 @@ const getSelectionCodeTool = {
451
447
  ]
452
448
  };
453
449
  } else {
454
- console.log(
455
- `[getSelectionCode] 当前节点ID: ${targetNodeId}, 根节点ID: ${rootId}`
456
- );
457
450
  let mergedToFilePath = "";
458
451
  if (syncToBase && documentId && documentPageId) {
459
452
  const targetPageDir = path.join(
@@ -473,9 +466,6 @@ const getSelectionCodeTool = {
473
466
  };
474
467
  rootFile = await findRootFile();
475
468
  if (!rootFile && _depth === 0) {
476
- console.log(
477
- `[getSelectionCode] 基准文件不存在,自动拉取根节点: ${rootId}`
478
- );
479
469
  await getSelectionCodeTool.handler({
480
470
  projectDir,
481
471
  targetNodeId: rootId,
@@ -507,7 +497,6 @@ const getSelectionCodeTool = {
507
497
  mergedToFilePath = rootFilePath;
508
498
  }
509
499
  } catch (err) {
510
- console.error("合并到基准文件操作出错:", err);
511
500
  }
512
501
  }
513
502
  }
@@ -859,8 +848,6 @@ registerAllTools(mcpServer);
859
848
  try {
860
849
  const transport = new StdioServerTransport();
861
850
  await mcpServer.connect(transport);
862
- console.error(`[Codify MCP] Client connected to ${SERVER_URL}`);
863
851
  } catch (error) {
864
- console.error(`[Codify MCP] Connection failed:`, error.message);
865
852
  process.exit(1);
866
853
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codify-ai/mcp-client",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Codify MCP 客户端 - 连接到远程 Codify MCP 服务器,供 CLI 或 Cursor 等 IDE 使用",
5
5
  "type": "module",
6
6
  "bin": {