Lanhu MCP Server
Enables AI to directly read and analyze Lanhu design drafts and requirement documents to generate HTML, CSS, and structural analyses. It allows users to extract design slices and process prototype pages directly within AI clients.
README
<div align="center">
🎨 Lanhu MCP Server
The official MCP server for Lanhu (蓝湖) — Bridge AI coding assistants with your design system
</div>
Overview
Lanhu MCP Server (mcp-lanhu) is a Model Context Protocol (MCP) server that connects AI coding assistants — such as Cursor, Windsurf, Claude Desktop, and Claude Code — directly to your Lanhu (蓝湖) design projects. It enables AI to read design specs, extract HTML/CSS, parse PRD documents, and download image assets without leaving the editor.
One command, zero config — just
npx -y mcp-lanhuand paste your Lanhu link in chat.
Why Lanhu MCP?
- Design-to-code in seconds: AI reads your Lanhu design and generates pixel-accurate HTML + CSS, complete with design tokens (colors, fonts, shadows, gradients).
- PRD-aware coding: Feed your product requirements document (PRD) or Axure prototype to AI for context-aware implementation.
- Asset pipeline: Extract slices, icons, and images directly from Lanhu — no manual export needed.
- Works with any MCP client: Cursor, Windsurf, Claude Desktop, Claude Code, and any future MCP-compatible IDE.
- Stdio transport: Standard MCP stdio protocol — lightweight, fast, and universally compatible.
概述
Lanhu MCP Server(mcp-lanhu)是一个 Model Context Protocol (MCP) 服务器,让 Cursor、Windsurf、Claude Desktop、Claude Code 等 AI 编程助手直接连接你的蓝湖设计项目。AI 可以读取设计稿、提取 HTML/CSS、解析需求文档(PRD)、下载切图资源,全程无需离开编辑器。
一行命令,零配置 — 只需
npx -y mcp-lanhu,在对话中粘贴蓝湖链接即可使用。
为什么选择 Lanhu MCP?
- 设计稿秒变代码:AI 读取蓝湖设计稿,生成像素级精准的 HTML + CSS,包含完整的 Design Tokens(颜色、字体、阴影、渐变)。
- 需求文档驱动开发:将 PRD 或 Axure 原型交给 AI,实现需求感知的智能编码。
- 自动化资源管线:直接从蓝湖提取切图、图标和图片,无需手动导出。
- 兼容所有 MCP 客户端:Cursor、Windsurf、Claude Desktop、Claude Code,以及任何未来的 MCP 兼容 IDE。
- Stdio 传输协议:标准 MCP stdio 协议,轻量、高效、通用兼容。
安装 / Quick Start
无需 clone 代码,直接在 AI 客户端配置中使用 npx 自动安装运行。
Cursor / Windsurf
编辑 .cursor/mcp.json(或 .windsurf/mcp.json):
{
"mcpServers": {
"lanhu": {
"command": "npx",
"args": ["-y", "mcp-lanhu"],
"env": { "LANHU_COOKIE": "your_cookie_here" }
}
}
}
Claude Desktop
编辑 claude_desktop_config.json:
{
"mcpServers": {
"lanhu": {
"command": "npx",
"args": ["-y", "mcp-lanhu"],
"env": { "LANHU_COOKIE": "your_cookie_here" }
}
}
}
Claude Code
claude mcp add lanhu -- npx -y mcp-lanhu
然后在环境变量或 .env 文件中设置 LANHU_COOKIE。
本地开发 / Local Development
{
"mcpServers": {
"lanhu": {
"command": "node",
"args": [
"--env-file=/absolute/path/to/lanhu-mcp/.env",
"/absolute/path/to/lanhu-mcp/dist/server.js"
],
"cwd": "/absolute/path/to/lanhu-mcp"
}
}
}
先执行 npm run build 生成 dist/。可选配置项(日志级别、超时等)见 config.example.env。
获取 Cookie
- 登录 蓝湖
- 打开浏览器开发者工具(F12)→ Network 标签
- 复制任意请求的
Cookie请求头
配置完成后重启客户端,在对话中粘贴蓝湖链接即可使用。
Tools / 工具一览
| Tool | Description | 说明 |
|---|---|---|
lanhu_analyze_designs |
Design → HTML + CSS + Design Tokens | 设计图 → HTML+CSS + 设计令牌 |
lanhu_analyze_pages |
PRD / Axure → Structured analysis | PRD/原型 → 结构化分析 |
lanhu_list_designs |
List all design images in a project | 列出项目设计图 |
lanhu_list_pages |
List all pages in a PRD document | 列出 PRD 页面 |
lanhu_get_slices |
Extract icon & image assets (slices) | 提取切图资源 |
lanhu_resolve_invite_link |
Resolve Lanhu invite/share links | 解析蓝湖邀请链接 |
Use Cases / 使用场景
- Frontend development: Paste a Lanhu design link → AI generates responsive components matching the design spec.
- 前端开发:粘贴蓝湖设计链接 → AI 生成与设计稿匹配的响应式组件。
- Design QA: Compare implementation against design tokens (spacing, colors, typography).
- 设计走查:对比实现与设计令牌(间距、颜色、字体)。
- PRD implementation: Feed PRD pages to AI for requirement-aware feature development.
- 需求实现:将 PRD 页面交给 AI,实现需求驱动的功能开发。
- Asset export: Batch-extract icons and images without opening Lanhu manually.
- 资源导出:批量提取图标和图片,无需手动打开蓝湖。
Compatibility / 兼容性
| MCP Client | Supported | Transport |
|---|---|---|
| Cursor | ✅ | stdio |
| Windsurf | ✅ | stdio |
| Claude Desktop | ✅ | stdio |
| Claude Code | ✅ | stdio |
| Any MCP-compatible IDE | ✅ | stdio |
开发 / Development
git clone https://github.com/MrDgbot/lanhu-mcp.git && cd lanhu-mcp
npm install && cp config.example.env .env # 填入 LANHU_COOKIE
npm run dev # 开发模式(热重载)
npm run build # 构建生产版本
npm test # 运行测试
常见问题 / FAQ
Q: 什么是 MCP?/ What is MCP? A: Model Context Protocol 是一个开放标准,让 AI 助手安全连接外部数据源和工具。
Q: 支持哪些蓝湖套餐?/ Which Lanhu plans are supported? A: 任何可以网页访问的蓝湖账号均可使用,服务器通过浏览器 Cookie 认证。
Q: 支持 SSE/HTTP 传输吗?/ Does it work with SSE/HTTP transport? A: 目前仅支持 stdio,SSE 支持已在计划中。
Q: 不用 Cursor 也能用吗?/ Can I use it without Cursor? A: 可以 — 支持所有 MCP 客户端,包括 Claude Desktop、Claude Code、Windsurf 等。
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。