@mastergo/magic-mcp 0.0.5 → 0.0.7-beta.0

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/README.md CHANGED
@@ -1,19 +1,23 @@
1
1
  # MasterGo Magic MCP
2
+
2
3
  [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/mastergo-design/mastergo-magic-mcp)
3
4
 
4
5
  MasterGo Magic MCP is a standalone MCP (Model Context Protocol) service designed to connect MasterGo design tools with AI models. It enables AI models to directly retrieve DSL data from MasterGo design files.
5
6
 
6
7
  ## Key Features
8
+
7
9
  - Retrieves DSL data from MasterGo design files
8
10
  - Runs directly with npx
9
11
  - No external dependencies required, only Node.js environment needed
10
12
 
11
13
  ## Tutorial
14
+
12
15
  - https://mastergo.com/file/155675508499265?page_id=158:0002
13
16
 
14
17
  ## Usage
15
18
 
16
19
  ### Obtaining MG_MCP_TOKEN
20
+
17
21
  1. Visit https://mastergo.com
18
22
  2. Enter personal settings
19
23
  3. Click the Security Settings tab
@@ -21,21 +25,33 @@ MasterGo Magic MCP is a standalone MCP (Model Context Protocol) service designed
21
25
  5. Click to generate the token
22
26
 
23
27
  ### Command Line Options
28
+
24
29
  ```
25
- npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug]
30
+ npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug] [--no-rule]
26
31
  ```
27
32
 
28
33
  #### Parameters:
34
+
29
35
  - `--token=YOUR_TOKEN` (required): MasterGo API token for authentication
30
36
  - `--url=API_URL` (optional): API base URL, defaults to http://localhost:3000
31
37
  - `--rule=RULE_NAME` (optional): Add design rules to apply, can be used multiple times
32
38
  - `--debug` (optional): Enable debug mode for detailed error information
39
+ - `--no-rule` (optional): Disable default rules
33
40
 
34
41
  You can also use space-separated format for parameters:
42
+
35
43
  ```
36
44
  npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debug
37
45
  ```
38
46
 
47
+ #### Environment Variables
48
+
49
+ Alternatively, you can use environment variables instead of command line arguments:
50
+
51
+ - `MG_MCP_TOKEN` or `MASTERGO_API_TOKEN`: MasterGo API token
52
+ - `API_BASE_URL`: API base URL
53
+ - `RULES`: JSON array of rules (e.g., `'["rule1", "rule2"]'`)
54
+
39
55
  ### Installing via Smithery
40
56
 
41
57
  To install MasterGo Magic for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@mastergo-design/mastergo-magic-mcp):
@@ -45,6 +61,7 @@ npx -y @smithery/cli install @mastergo-design/mastergo-magic-mcp --client claude
45
61
  ```
46
62
 
47
63
  ### LINGMA Usage
64
+
48
65
  Search for LINGMA in the VSCode extension marketplace and install it.
49
66
 
50
67
  <img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174245589.png" alt="image-20250507174245589" style="zoom:25%;" />
@@ -66,8 +83,13 @@ Finally, switch the chat mode to agent mode in the chat interface.
66
83
  <img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507175107044.png" alt="image-20250507175107044" style="zoom:25%;" />
67
84
 
68
85
  ### cursor Usage
86
+
69
87
  Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-protocol#using-mcp-tools-in-agent
70
88
 
89
+ You can configure the MCP server using either command line arguments or environment variables:
90
+
91
+ **Option 1: Using command line arguments**
92
+
71
93
  ```json
72
94
  {
73
95
  "mcpServers": {
@@ -85,7 +107,27 @@ Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-
85
107
  }
86
108
  ```
87
109
 
110
+ **Option 2: Using environment variables**
111
+
112
+ ```json
113
+ {
114
+ "mcpServers": {
115
+ "mastergo-magic-mcp": {
116
+ "command": "npx",
117
+ "args": ["-y", "@mastergo/magic-mcp"],
118
+ "env": {
119
+ "MG_MCP_TOKEN": "<YOUR_TOKEN>",
120
+ "API_BASE_URL": "https://mastergo.com"
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+
88
127
  ### cline Usage
128
+
129
+ **Option 1: Using command line arguments**
130
+
89
131
  ```json
90
132
  {
91
133
  "mcpServers": {
@@ -103,8 +145,27 @@ Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-
103
145
  }
104
146
  ```
105
147
 
148
+ **Option 2: Using environment variables**
149
+
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "@master/mastergo-magic-mcp": {
154
+ "command": "npx",
155
+ "args": ["-y", "@mastergo/magic-mcp"],
156
+ "env": {
157
+ "MG_MCP_TOKEN": "<YOUR_TOKEN>",
158
+ "API_BASE_URL": "https://mastergo.com"
159
+ }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
106
165
  ## Project Structure
166
+
107
167
  ### src Directory
168
+
108
169
  The `src` directory contains the core implementation of the MasterGo Magic MCP service:
109
170
 
110
171
  - `index.ts`: Entry point of the application that initializes the MCP server and registers all tools
@@ -112,6 +173,7 @@ The `src` directory contains the core implementation of the MasterGo Magic MCP s
112
173
  - `types.d.ts`: TypeScript type definitions for the project
113
174
 
114
175
  #### src/tools
176
+
115
177
  Contains implementations of MCP tools:
116
178
 
117
179
  - `base-tool.ts`: Base class for all MCP tools
@@ -121,12 +183,14 @@ Contains implementations of MCP tools:
121
183
  - `get-component-workflow.ts`: Tool providing structured component development workflow for Vue and React components, generating workflow files and component specifications
122
184
 
123
185
  #### src/markdown
186
+
124
187
  Contains markdown files with additional documentation:
125
188
 
126
189
  - `meta.md`: Documentation about metadata structure and usage
127
190
  - `component-workflow.md`: Component development workflow documentation guiding structured component development process
128
191
 
129
192
  ## Local Development
193
+
130
194
  1. Run `yarn` and `yarn build` to install dependencies and build the code
131
195
  2. Find the absolute path of `bin/cli.js`
132
196
  3. Add local MCP configuration with your token
@@ -143,6 +207,7 @@ Contains markdown files with additional documentation:
143
207
  "env": {}
144
208
  },
145
209
  ```
210
+
146
211
  4. Restart your editor to ensure the local MCP is enabled
147
212
 
148
213
  After successful execution, you can debug based on the local running results. You can build your own MCP service based on your modifications.
@@ -150,4 +215,5 @@ After successful execution, you can debug based on the local running results. Yo
150
215
  We welcome your code contributions and look forward to building MasterGo's MCP service together.
151
216
 
152
217
  ## License
218
+
153
219
  ISC
package/README.zh-CN.md CHANGED
@@ -27,7 +27,7 @@ MasterGo Magic MCP 是一个独立的 MCP(Model Context Protocol)服务,
27
27
  ### 命令行选项
28
28
 
29
29
  ```
30
- npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug]
30
+ npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug] [--no-rule]
31
31
  ```
32
32
 
33
33
  #### 参数:
@@ -36,6 +36,7 @@ npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [-
36
36
  - `--url=API_URL` (可选): API 基础 URL,默认为 http://localhost:3000
37
37
  - `--rule=RULE_NAME` (可选): 添加要应用的设计规则,可多次使用
38
38
  - `--debug` (可选): 启用调试模式,提供详细错误信息
39
+ - `--no-rule` (可选): 禁用默认规则
39
40
 
40
41
  你也可以使用空格分隔的参数格式:
41
42
 
@@ -43,6 +44,14 @@ npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [-
43
44
  npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debug
44
45
  ```
45
46
 
47
+ #### 环境变量
48
+
49
+ 您也可以使用环境变量代替命令行参数:
50
+
51
+ - `MG_MCP_TOKEN` 或 `MASTERGO_API_TOKEN`: MasterGo API 令牌
52
+ - `API_BASE_URL`: API 基础 URL
53
+ - `RULES`: 规则的 JSON 数组 (例如: `'["rule1", "rule2"]'`)
54
+
46
55
  ### LINGMA 使用方法
47
56
 
48
57
  在 vscode 拓展市场中搜索 LINGMA -> 然后安装该拓展
@@ -69,6 +78,10 @@ npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debu
69
78
 
70
79
  Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-protocol#using-mcp-tools-in-agent
71
80
 
81
+ 您可以使用命令行参数或环境变量来配置 MCP 服务:
82
+
83
+ **方式一:使用命令行参数**
84
+
72
85
  ```json
73
86
  {
74
87
  "mcpServers": {
@@ -86,8 +99,27 @@ Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-pr
86
99
  }
87
100
  ```
88
101
 
102
+ **方式二:使用环境变量**
103
+
104
+ ```json
105
+ {
106
+ "mcpServers": {
107
+ "mastergo-magic-mcp": {
108
+ "command": "npx",
109
+ "args": ["-y", "@mastergo/magic-mcp"],
110
+ "env": {
111
+ "MG_MCP_TOKEN": "<YOUR_TOKEN>",
112
+ "API_BASE_URL": "https://mastergo.com"
113
+ }
114
+ }
115
+ }
116
+ }
117
+ ```
118
+
89
119
  ### cline 使用方法
90
120
 
121
+ **方式一:使用命令行参数**
122
+
91
123
  ```json
92
124
  {
93
125
  "mcpServers": {
@@ -105,6 +137,23 @@ Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-pr
105
137
  }
106
138
  ```
107
139
 
140
+ **方式二:使用环境变量**
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "@master/mastergo-magic-mcp": {
146
+ "command": "npx",
147
+ "args": ["-y", "@mastergo/magic-mcp"],
148
+ "env": {
149
+ "MG_MCP_TOKEN": "<YOUR_TOKEN>",
150
+ "API_BASE_URL": "https://mastergo.com"
151
+ }
152
+ }
153
+ }
154
+ }
155
+ ```
156
+
108
157
  ## 项目结构
109
158
 
110
159
  ### src 目录