MasterGo Magic MCP 是一款独立的 MCP(模型上下文协议)服务,用于连接 MasterGo 设计工具和 AI 模型。它允许 AI 模型直接从 MasterGo 设计文件中检索 DSL 数据。
npx @mastergo/magic-mcp --token=YOUR_TOKEN [--url=API_URL] [--rule=RULE_NAME] [--debug]
--token=YOUR_TOKEN
(必填): MasterGo API 令牌,用于身份验证--url=API_URL
(可选): API 基本 URL,默认为 http://localhost:3000--rule=RULE_NAME
(可选): 添加要应用的设计规则,可多次使用--debug
(可选): 启用调试模式以获取详细的错误信息您也可以使用空格分隔的参数格式:
npx @mastergo/magic-mcp --token YOUR_TOKEN --url API_URL --rule RULE_NAME --debug
在 VSCode 扩展市场搜索 LINGMA 并安装。
登录后,在聊天框点击[MCP tools]。
点击顶部的[MCP Square]进入MCP市场,找到MasterGo设计协作工具并安装。
安装完成后,返回[MCP Servers],编辑我们的MCP服务,将其替换为您的MasterGo token。
最后,在聊天界面将聊天模式切换到agent模式。
Cursor MCP 使用指南参考:https://docs.cursor.com/context/model-context-protocol#using-mcp-tools-in-agent
{
"mcpServers": {
"mastergo-magic-mcp": {
"command": "npx",
"args": [
"-y",
"@mastergo/magic-mcp",
"--token=<MG_MCP_TOKEN>",
"--url=https://mastergo.com"
],
"env": {}
}
}
}

{
"mcpServers": {
"@master/mastergo-magic-mcp": {
"command": "npx",
"args": [
"-y",
"@mastergo/magic-mcp",
"--token=<MG_MCP_TOKEN>",
"--url=https://mastergo.com"
],
"env": {}
}
}
}

src
目录包含 MasterGo Magic MCP 服务的核心实现:
index.ts
:应用程序的入口点,初始化 MCP 服务器并注册所有工具http-util.ts
:用于处理 MasterGo API 的 HTTP 请求的工具函数types.d.ts
:项目的 TypeScript 类型定义包含 MCP 工具的实现:
base-tool.ts
:所有 MCP 工具的基类get-dsl.ts
:从 MasterGo 设计文件中检索 DSL(领域特定语言)数据的工具get-component-link.ts
:从链接中检索组件文档的工具get-meta.ts
:用于检索元数据信息的工具get-component-workflow.ts
:为 Vue 和 React 组件提供结构化组件开发工作流程的工具,生成工作流程文件和组件规范包含附加文档的 Markdown 文件:
meta.md
:关于元数据结构和用法的文档component-workflow.md
:组件开发工作流程文档,指导结构化组件开发流程yarn
和 yarn build
来安装依赖项并构建代码bin/cli.js
的绝对路径"mastergo-mcp-local": {
"command": "node",
"args": [
"absolute/path/to/bin/cli.js",
"--token=mg_xxxxxx",
"--url=https://mastergo.com",
"--debug"
],
"env": {}
},

执行成功后,您可以基于本地运行结果进行调试。您可以根据您的修改构建您自己的 MCP 服务。
我们欢迎您的代码贡献,并期待与您一起构建 MasterGo 的 MCP 服务。
ISC