Android-first MCP server for reading Lanhu design specs and exporting UI restoration context
Project description
蓝湖设计 MCP
项目简介
面向 macOS 的蓝湖设计读取与细粒度 UI 资源导出 MCP 服务器。
功能
- 读取蓝湖设计项目,列出所有设计图
- 分析设计稿并返回平台调整后的 UI 结构(Android dp / iOS pt / Web px / 微信 rpx)
- 返回完整设计图与 Sketch、Figma、Photoshop 细粒度切图资源及多倍率地址
- 导出包含资产和分析的完整 Agent UI 还原上下文
- 托管 Chrome Profile 自动登录,无需手动复制 Cookie
系统要求
- macOS
- Google Chrome(已安装)
- Python 3.10 及以上
安装
pip install lanhu-design-mcp
首次登录
lanhu-design-mcp auth login
lanhu-design-mcp auth status
首次运行打开独立的本地 Chrome Profile,完成一次交互式 Lanhu 登录。后续 MCP 进程自动重用会话,正常设计工具调用不会打开可见浏览器。认证仅使用托管 Chrome Profile,不需要也不支持通过 Cookie 环境变量或 Cookie 文件配置凭据。
lanhu-design-mcp auth logout --confirm
MCP 配置
{
"mcpServers": {
"lanhu-design-mcp": {
"type": "stdio",
"command": "/Users/your-name/.local/bin/lanhu-design-mcp",
"args": []
}
}
}
将 /Users/your-name 替换为你的本机用户名。此配置适用于 cc-switch 导入。
工具
| 工具 | 说明 |
|---|---|
lanhu_health_check |
返回本地配置状态,不访问网络且不暴露凭据 |
lanhu_get_designs |
获取项目的所有设计图列表 |
lanhu_analyze_design |
分析指定设计稿并返回平台调整后的 UI 结构 |
lanhu_get_design_assets |
返回完整设计图与细粒度可下载切图资源 |
lanhu_export_ui_context |
返回包含资产和分析的完整 Agent UI 还原上下文 |
lanhu_auth_login |
打开专属 Chrome Profile 进行交互式 Lanhu 登录 |
lanhu_auth_status |
报告托管认证状态,不含凭据 |
lanhu_auth_logout |
登出并删除托管 Profile,需要 confirm=true |
使用规范
- 调用方应将返回的签名资源 URL 下载到本地项目,不要生成对远程 Lanhu 签名 URL 的长期依赖。
- 不得在日志、异常或 MCP 响应中记录或输出凭据信息。
- 登出必须调用
lanhu_auth_logout并传confirm=true,或 CLI--confirm,仅删除托管的标记 Profile。 - 托管 Chrome Profile 仅存在于本地;认证凭据从不通过 MCP 网络传输。
常见错误
| 状态 | 说明 | 处理 |
|---|---|---|
auth_required |
凭据无效或过期 | 运行 lanhu-design-mcp auth login |
unsupported_platform |
仅在 macOS 支持 | 使用 macOS 设备 |
dependency_missing |
Playwright Python 库或 Chrome 不可用 | pip install --upgrade lanhu-design-mcp |
profile_locked |
托管 Profile 被其他进程占用 | 等待完成后重试 |
cancelled |
登录窗口在认证完成前关闭 | 重新运行 lanhu-design-mcp auth login |
timed_out |
登录窗口 5 分钟内未完成认证 | 重新运行 lanhu-design-mcp auth login |
开发验证
git clone https://github.com/blantian/lanhu-design-mcp
cd lanhu-design-mcp
uv sync --dev
uv run pytest
许可证
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lanhu_design_mcp-0.2.0.tar.gz.
File metadata
- Download URL: lanhu_design_mcp-0.2.0.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
746fb58e39fba0070c6258daba408fa0f3a5059a255d14e8b65a1446a91455c2
|
|
| MD5 |
69d5c321d2950eb78fd9473fd4d468b5
|
|
| BLAKE2b-256 |
60a8cdd48f7de59a74c58de85c87fd777c475e1cffd42af69cd7c78279049c17
|
Provenance
The following attestation bundles were made for lanhu_design_mcp-0.2.0.tar.gz:
Publisher:
release.yml on blantian/lanhu-design-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lanhu_design_mcp-0.2.0.tar.gz -
Subject digest:
746fb58e39fba0070c6258daba408fa0f3a5059a255d14e8b65a1446a91455c2 - Sigstore transparency entry: 2201583916
- Sigstore integration time:
-
Permalink:
blantian/lanhu-design-mcp@b547d6b7dda94f9ba4784b29c2fc73c6f878dc7c -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/blantian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b547d6b7dda94f9ba4784b29c2fc73c6f878dc7c -
Trigger Event:
release
-
Statement type:
File details
Details for the file lanhu_design_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: lanhu_design_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7425376dc012c3b0c8e1eaee31f1f9c5e5f4ea5c6b2c4e50283f97af2de86360
|
|
| MD5 |
8c257b579b8e0d5391d7adb9d4d4a2f0
|
|
| BLAKE2b-256 |
115e56fd6db3d074c383daa52c3a105493f4257c46f2a2d6dadd1bfcc9818450
|
Provenance
The following attestation bundles were made for lanhu_design_mcp-0.2.0-py3-none-any.whl:
Publisher:
release.yml on blantian/lanhu-design-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lanhu_design_mcp-0.2.0-py3-none-any.whl -
Subject digest:
7425376dc012c3b0c8e1eaee31f1f9c5e5f4ea5c6b2c4e50283f97af2de86360 - Sigstore transparency entry: 2201584040
- Sigstore integration time:
-
Permalink:
blantian/lanhu-design-mcp@b547d6b7dda94f9ba4784b29c2fc73c6f878dc7c -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/blantian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b547d6b7dda94f9ba4784b29c2fc73c6f878dc7c -
Trigger Event:
release
-
Statement type: