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
通过 Smithery 自动为 Claude Desktop 安装 MasterGo Magic:
npx -y @smithery/cli install @mastergo-design/mastergo-magic-mcp --client claude
在 VSCode 扩展市场中搜索 LINGMA 并安装。
登录后,点击聊天框中的 [MCP 工具]。
点击顶部的 [MCP 广场] 进入 MCP 市场,找到 MasterGo 设计协作工具并安装。
安装后,返回 [MCP 服务器],编辑我们的 MCP 服务,将其替换为您自己的 MasterGo 令牌。
最后,在聊天界面中将聊天模式切换为代理模式。
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