@mastergo/magic-mcp 0.0.4-beta.8 → 0.0.4
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 +30 -15
- package/README.zh-CN.md +32 -8
- package/bin/cli.js +2 -2
- package/dist/index.js +28 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
# MasterGo Magic MCP
|
|
2
|
+
[](https://deepwiki.com/mastergo-design/mastergo-magic-mcp)
|
|
2
3
|
|
|
3
4
|
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.
|
|
4
5
|
|
|
5
6
|
## Key Features
|
|
6
|
-
|
|
7
7
|
- Retrieves DSL data from MasterGo design files
|
|
8
8
|
- Runs directly with npx
|
|
9
9
|
- No external dependencies required, only Node.js environment needed
|
|
10
10
|
|
|
11
11
|
## Tutorial
|
|
12
|
-
|
|
13
12
|
- https://mastergo.com/file/155675508499265?page_id=158:0002
|
|
14
13
|
|
|
15
14
|
## Usage
|
|
16
15
|
|
|
17
16
|
### Obtaining MG_MCP_TOKEN
|
|
18
|
-
|
|
19
17
|
1. Visit https://mastergo.com
|
|
20
18
|
2. Enter personal settings
|
|
21
19
|
3. Click the Security Settings tab
|
|
@@ -23,26 +21,51 @@ MasterGo Magic MCP is a standalone MCP (Model Context Protocol) service designed
|
|
|
23
21
|
5. Click to generate the token
|
|
24
22
|
|
|
25
23
|
### Command Line Options
|
|
26
|
-
|
|
27
24
|
```
|
|
28
25
|
npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug]
|
|
29
26
|
```
|
|
30
27
|
|
|
31
28
|
#### Parameters:
|
|
32
|
-
|
|
33
29
|
- `--token=YOUR_TOKEN` (required): MasterGo API token for authentication
|
|
34
30
|
- `--url=API_URL` (optional): API base URL, defaults to http://localhost:3000
|
|
35
31
|
- `--rule=RULE_NAME` (optional): Add design rules to apply, can be used multiple times
|
|
36
32
|
- `--debug` (optional): Enable debug mode for detailed error information
|
|
37
33
|
|
|
38
34
|
You can also use space-separated format for parameters:
|
|
39
|
-
|
|
40
35
|
```
|
|
41
36
|
npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debug
|
|
42
37
|
```
|
|
43
38
|
|
|
44
|
-
###
|
|
39
|
+
### Installing via Smithery
|
|
40
|
+
|
|
41
|
+
To install MasterGo Magic for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@mastergo-design/mastergo-magic-mcp):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx -y @smithery/cli install @mastergo-design/mastergo-magic-mcp --client claude
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### LINGMA Usage
|
|
48
|
+
Search for LINGMA in the VSCode extension marketplace and install it.
|
|
49
|
+
|
|
50
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174245589.png" alt="image-20250507174245589" style="zoom:25%;" />
|
|
51
|
+
|
|
52
|
+
After logging in, click on [MCP tools] in the chat box.
|
|
53
|
+
|
|
54
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174511910.png" alt="image-20250507174511910" style="zoom:25%;" />
|
|
55
|
+
|
|
56
|
+
Click on [MCP Square] at the top to enter the MCP marketplace, find the MasterGo design collaboration tool and install it.
|
|
45
57
|
|
|
58
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174840456.png" alt="image-20250507174840456" style="zoom:25%;" />
|
|
59
|
+
|
|
60
|
+
After installation, go back to [MCP Servers], and edit our MCP service to replace it with your own MasterGo token.
|
|
61
|
+
|
|
62
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507175005364.png" alt="image-20250507175005364" style="zoom:25%;" />
|
|
63
|
+
|
|
64
|
+
Finally, switch the chat mode to agent mode in the chat interface.
|
|
65
|
+
|
|
66
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507175107044.png" alt="image-20250507175107044" style="zoom:25%;" />
|
|
67
|
+
|
|
68
|
+
### cursor Usage
|
|
46
69
|
Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-protocol#using-mcp-tools-in-agent
|
|
47
70
|
|
|
48
71
|
```json
|
|
@@ -63,7 +86,6 @@ Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-
|
|
|
63
86
|
```
|
|
64
87
|
|
|
65
88
|
### cline Usage
|
|
66
|
-
|
|
67
89
|
```json
|
|
68
90
|
{
|
|
69
91
|
"mcpServers": {
|
|
@@ -82,9 +104,7 @@ Cursor Mcp usage guide reference: https://docs.cursor.com/context/model-context-
|
|
|
82
104
|
```
|
|
83
105
|
|
|
84
106
|
## Project Structure
|
|
85
|
-
|
|
86
107
|
### src Directory
|
|
87
|
-
|
|
88
108
|
The `src` directory contains the core implementation of the MasterGo Magic MCP service:
|
|
89
109
|
|
|
90
110
|
- `index.ts`: Entry point of the application that initializes the MCP server and registers all tools
|
|
@@ -92,7 +112,6 @@ The `src` directory contains the core implementation of the MasterGo Magic MCP s
|
|
|
92
112
|
- `types.d.ts`: TypeScript type definitions for the project
|
|
93
113
|
|
|
94
114
|
#### src/tools
|
|
95
|
-
|
|
96
115
|
Contains implementations of MCP tools:
|
|
97
116
|
|
|
98
117
|
- `base-tool.ts`: Base class for all MCP tools
|
|
@@ -102,14 +121,12 @@ Contains implementations of MCP tools:
|
|
|
102
121
|
- `get-component-workflow.ts`: Tool providing structured component development workflow for Vue and React components, generating workflow files and component specifications
|
|
103
122
|
|
|
104
123
|
#### src/markdown
|
|
105
|
-
|
|
106
124
|
Contains markdown files with additional documentation:
|
|
107
125
|
|
|
108
126
|
- `meta.md`: Documentation about metadata structure and usage
|
|
109
127
|
- `component-workflow.md`: Component development workflow documentation guiding structured component development process
|
|
110
128
|
|
|
111
129
|
## Local Development
|
|
112
|
-
|
|
113
130
|
1. Run `yarn` and `yarn build` to install dependencies and build the code
|
|
114
131
|
2. Find the absolute path of `bin/cli.js`
|
|
115
132
|
3. Add local MCP configuration with your token
|
|
@@ -126,7 +143,6 @@ Contains markdown files with additional documentation:
|
|
|
126
143
|
"env": {}
|
|
127
144
|
},
|
|
128
145
|
```
|
|
129
|
-
|
|
130
146
|
4. Restart your editor to ensure the local MCP is enabled
|
|
131
147
|
|
|
132
148
|
After successful execution, you can debug based on the local running results. You can build your own MCP service based on your modifications.
|
|
@@ -134,5 +150,4 @@ After successful execution, you can debug based on the local running results. Yo
|
|
|
134
150
|
We welcome your code contributions and look forward to building MasterGo's MCP service together.
|
|
135
151
|
|
|
136
152
|
## License
|
|
137
|
-
|
|
138
153
|
ISC
|
package/README.zh-CN.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# MasterGo Magic MCP
|
|
2
2
|
|
|
3
|
+
[](https://deepwiki.com/mastergo-design/mastergo-magic-mcp)
|
|
4
|
+
|
|
3
5
|
MasterGo Magic MCP 是一个独立的 MCP(Model Context Protocol)服务,旨在连接 MasterGo 设计工具与 AI 模型。它使 AI 模型能够直接从 MasterGo 设计文件中获取 DSL 数据。
|
|
4
6
|
|
|
5
7
|
## 主要特性
|
|
@@ -8,7 +10,7 @@ MasterGo Magic MCP 是一个独立的 MCP(Model Context Protocol)服务,
|
|
|
8
10
|
- 可直接通过 npx 运行
|
|
9
11
|
- 仅需 Node.js 环境,无需其他外部依赖
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
## 教程
|
|
12
14
|
|
|
13
15
|
- https://mastergo.com/file/155675508499265?page_id=158:0002
|
|
14
16
|
|
|
@@ -41,6 +43,28 @@ npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [-
|
|
|
41
43
|
npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debug
|
|
42
44
|
```
|
|
43
45
|
|
|
46
|
+
### LINGMA 使用方法
|
|
47
|
+
|
|
48
|
+
在 vscode 拓展市场中搜索 LINGMA -> 然后安装该拓展
|
|
49
|
+
|
|
50
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174245589.png" alt="image-20250507174245589" style="zoom:25%;" />
|
|
51
|
+
|
|
52
|
+
登录后 -> 在聊天框中点击 [MCP tools]
|
|
53
|
+
|
|
54
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174511910.png" alt="image-20250507174511910" style="zoom:25%;" />
|
|
55
|
+
|
|
56
|
+
点击顶部 [MCP Sqaure] 进入mcp市场,在市场中找到 Mastergo设计协作工具并安装
|
|
57
|
+
|
|
58
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507174840456.png" alt="image-20250507174840456" style="zoom:25%;" />
|
|
59
|
+
|
|
60
|
+
安装完成后,需要回到 [MCP Servers], 并编辑我们的mcp服务,将自己的mastergo token 替换上去
|
|
61
|
+
|
|
62
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507175005364.png" alt="image-20250507175005364" style="zoom:25%;" />
|
|
63
|
+
|
|
64
|
+
最后在聊天界面中将聊天模式切换为agent模式。
|
|
65
|
+
|
|
66
|
+
<img src="https://github.com/mastergo-design/mastergo-magic-mcp/blob/main/images/image-20250507175107044.png" alt="image-20250507175107044" style="zoom:25%;" />
|
|
67
|
+
|
|
44
68
|
### Cursor 使用方法
|
|
45
69
|
|
|
46
70
|
Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-protocol#using-mcp-tools-in-agent
|
|
@@ -108,11 +132,11 @@ Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-pr
|
|
|
108
132
|
- `meta.md`:关于元数据结构和用法的文档
|
|
109
133
|
- `component-workflow.md`:组件开发工作流程文档,指导结构化组件开发过程
|
|
110
134
|
|
|
111
|
-
##
|
|
135
|
+
## 本地开发
|
|
112
136
|
|
|
113
|
-
1.
|
|
114
|
-
2.
|
|
115
|
-
3. 在MCP配置中添加本地MCP配置,其中token
|
|
137
|
+
1. 运行 `yarn` 和 `yarn build`,安装依赖并构建代码
|
|
138
|
+
2. 查看 `bin/cli.js` 的绝对路径
|
|
139
|
+
3. 在 MCP 配置中添加本地 MCP 配置,其中 token 为您获取的 token
|
|
116
140
|
|
|
117
141
|
```json
|
|
118
142
|
"mastergo-mcp-local": {
|
|
@@ -127,11 +151,11 @@ Cursor Mcp 使用指南参考:https://docs.cursor.com/context/model-context-pr
|
|
|
127
151
|
},
|
|
128
152
|
```
|
|
129
153
|
|
|
130
|
-
4. 重启编辑器,确认本地
|
|
154
|
+
4. 重启编辑器,确认本地 MCP 已开启
|
|
131
155
|
|
|
132
|
-
运行成功后,就可以基于本地运行的结果进行调试。您可以基于自己的修改构建自己的MCP服务。
|
|
156
|
+
运行成功后,就可以基于本地运行的结果进行调试。您可以基于自己的修改构建自己的 MCP 服务。
|
|
133
157
|
|
|
134
|
-
欢迎您为我们提供代码贡献,并期待大家一起共建MasterGo的MCP服务。
|
|
158
|
+
欢迎您为我们提供代码贡献,并期待大家一起共建 MasterGo 的 MCP 服务。
|
|
135
159
|
|
|
136
160
|
## 许可证
|
|
137
161
|
|
package/bin/cli.js
CHANGED
|
@@ -36,7 +36,7 @@ for (let i = 0; i < args.length; i++) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// Check required arguments
|
|
39
|
-
if (!token) {
|
|
39
|
+
if (!token && !process.env.MASTERGO_API_TOKEN) {
|
|
40
40
|
console.error("Error: Missing MasterGo API Token");
|
|
41
41
|
console.error(
|
|
42
42
|
"Usage: npx mastergo-magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME]"
|
|
@@ -47,8 +47,8 @@ if (!token) {
|
|
|
47
47
|
|
|
48
48
|
// Set environment variables
|
|
49
49
|
const env = {
|
|
50
|
-
...process.env,
|
|
51
50
|
MASTERGO_API_TOKEN: token,
|
|
51
|
+
...process.env,
|
|
52
52
|
API_BASE_URL: baseUrl,
|
|
53
53
|
DEBUG: debug ? "true" : "false",
|
|
54
54
|
// Add RULES environment variable as stringified array
|