| name | mastergo-mcp-reader |
| description | Read and structure MasterGo design data through configured MCP tools for Android feature implementation. Use when user provides a MasterGo link and asks to extract specs, page structure, component details, spacing, states, copy, and interaction rules, then convert them into dev-ready tasks/checklists. |
MasterGo MCP Reader
Workflow
- Confirm inputs:
- MasterGo file URL
- target pages/frame ids (if provided)
- platform (Android by default)
- Parse identifiers from URL first:
fileId: from /file/<fileId>
layerId: from layer_id= query param
page_id: optional, useful for page scoping but getDsl prefers fileId + layerId
- Example:
https://mastergo.com/file/166007320435232?...&layer_id=1200%3A06725 → fileId=166007320435232, layerId=1200:06725
- Prefer local MCP stdio fetch first with this command:
npx -y @mastergo/magic-mcp --token=<MG_MCP_TOKEN> --url=https://mastergo.com
- After MCP initialize, call
mcp__getDsl with fileId + layerId (preferred) or shortLink.
- If the MCP server starts but the current runtime has no callable
mcp__getDsl tool, use direct HTTP as an equivalent fallback:
GET https://mastergo.com/mcp/dsl?fileId=<fileId>&layerId=<layerId>
GET https://mastergo.com/mcp/meta?fileId=<fileId>&layerId=<layerId>
- Required header:
X-MG-UserAccessToken: <MG_MCP_TOKEN>
- This returns the same design source data shape used by the MCP service and is acceptable as an “equivalent MCP path” fallback.
- Save raw DSL JSON before summarizing when the payload is non-trivial:
- Keep the original response for re-parsing and text recovery.
- Then extract nodes, styles, text, layoutStyle, fill/stroke/effect, borderRadius, and interaction fields.
- Normalize output into these sections:
- 页面清单(page/frame)
- 组件清单(组件名、层级、状态)
- 视觉规格(尺寸、间距、颜色、字号)
- 文案规格(标题、按钮、toast、错误文案)
- 交互流程(入口、分支、成功/失败/回退)
- 研发注意项(系统能力、边界、降级策略)
- Produce implementation-ready artifacts:
- Android任务拆分(P0/P1)
- 验收清单(QA steps)
- 待确认问题(ambiguities)
Direct Fetch Examples
PowerShell: fetch DSL directly
$token = "<MG_MCP_TOKEN>"
$fileId = "166007320435232"
$layerId = "1200:06725"
$headers = @{
"X-MG-UserAccessToken" = $token
"Accept" = "application/json"
"Content-Type" = "application/json"
}
$r = Invoke-WebRequest \
-Uri "https://mastergo.com/mcp/dsl?fileId=$fileId&layerId=$layerId" \
-Headers $headers \
-Method GET \
-TimeoutSec 60
Set-Content -Path .\mastergo-dsl.json -Value $r.Content -NoNewline
PowerShell: fetch meta directly
$token = "<MG_MCP_TOKEN>"
$fileId = "166007320435232"
$layerId = "1200:06725"
$headers = @{
"X-MG-UserAccessToken" = $token
"Accept" = "application/json"
"Content-Type" = "application/json"
}
$r = Invoke-WebRequest \
-Uri "https://mastergo.com/mcp/meta?fileId=$fileId&layerId=$layerId" \
-Headers $headers \
-Method GET \
-TimeoutSec 60
$r.Content
curl: fetch DSL directly
curl -G "https://mastergo.com/mcp/dsl" \
-H "X-MG-UserAccessToken: <MG_MCP_TOKEN>" \
-H "Accept: application/json" \
--data-urlencode "fileId=166007320435232" \
--data-urlencode "layerId=1200:06725" \
-o mastergo-dsl.json
curl: fetch meta directly
curl -G "https://mastergo.com/mcp/meta" \
-H "X-MG-UserAccessToken: <MG_MCP_TOKEN>" \
-H "Accept: application/json" \
--data-urlencode "fileId=166007320435232" \
--data-urlencode "layerId=1200:06725"
Output Template
Use this output structure for each feature:
- 功能概览
- 页面与状态机
- 字段与文案表
- 交互与错误处理
- Android实现清单(类/页面/埋点)
- 测试用例
- 未决问题
Rules
- Prefer source-of-truth from MCP design data over screenshots.
- Treat direct
/mcp/dsl and /mcp/meta responses as valid fallback source-of-truth when stdio MCP is not callable from the current runtime.
- Keep exact text/copy from design; do not paraphrase product copy unless asked.
- Expect possible console encoding issues for Chinese text when printing DSL in Windows shells; if text looks garbled, rely on raw saved JSON, UTF-8 re-read, or browser text cross-check before finalizing copy.
- Mark uncertain values explicitly as
TODO(DesignConfirm).
- If both MCP stdio and direct
/mcp/* fetch fail, fallback to browser snapshot/manual extraction and label as fallback.
- For Android delivery, map design nodes to current code entry points before proposing new pages.