lanhu-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@lanhu-mcpGet the CSS styles for the login button in the Home artboard"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Lanhu MCP Server
A Model Context Protocol (MCP) server for Lanhu (蓝湖) design collaboration platform.
Enable LLMs and AI coding assistants to directly inspect design artboards, extract pixel-perfect CSS properties and layer hierarchies, and download exportable assets—with zero vision token overhead.
💡 Why Lanhu MCP?
When implementing UI designs with AI coding agents (Claude, Cursor, Copilot, Antigravity, etc.), passing screenshots often results in:
High token cost for vision models
Imprecise positioning, guessed margins, and approximate colors
Hallucinated font sizes and line heights
Inability to automatically extract and download SVG/image assets
Lanhu MCP Server parses Lanhu's structured design specs directly into typed data trees:
⚡ Zero Vision Token Overhead: Pure JSON structured data instead of heavy screenshots.
📐 Pixel-Perfect Accuracy: Exact layer bounds (
x,y,width,height), colors (HEX/RGBA), typography (fontSize,fontWeight,fontFamily,lineHeight), border radius, fills, borders, and shadows.🎨 Smart Asset Extraction: Automatically discovers slice assets, provides direct CDN download links, and supports lossless conversion to modern WebP or SVG formats.
🔄 Resilient Authentication: Persistent session management with automated headless token refresh via Playwright.
Related MCP server: Lanhu MCP Server
✨ Key Features
Team & Project Exploration: Query teams, workspace design files, and search projects seamlessly.
Artboard Inspection: List artboards (
screens), preview thumbnails, and search screens by name.Deep Layer Annotations: Recursively retrieve complete layer trees with comprehensive CSS/UI styling attributes.
Asset Pipeline: Download SVG vectors and bitmap images directly to your local workspace.
Automated Session Keeper: Headless Playwright script keeps your Lanhu session alive in the background without repeated manual logins.
📋 Requirements
Python:
>= 3.10Package Manager: uv (strongly recommended)
MCP Client: Cursor, Claude Desktop, Claude Code, Antigravity, Windsurf, Cline, Codex, VS Code, or any other MCP-compatible tool.
🚀 Quick Start
1. Run with uvx (No installation needed)
You can run lanhu-mcp directly without cloning the repository:
uvx --from git+https://github.com/xinayida/lanhu-mcp.git lanhu-mcp2. Run from Source
# Clone the repository
git clone https://github.com/xinayida/lanhu-mcp.git
cd lanhu-mcp
# Sync environment and dependencies
uv sync
# Run the server (stdio mode)
uv run lanhu-mcp🔐 Authentication
Lanhu MCP connects to lanhuapp.com using browser session cookies. It reads from ~/.lanhu/cookie (file permission 0600).
Method 1: Automated Login & Refresh (Recommended)
Run the included Playwright automation script:
uv run scripts/refresh_cookie.pyIf already logged in: Headlessly verifies session, refreshes token, and writes to
~/.lanhu/cookie.If session expired: Automatically opens a Chrome window for a one-time login (SMS code or password). Once authenticated, it saves the session and closes the browser.
Tip for Scheduled Tasks: Run with
--headless-onlyin cron jobs to periodically renew the cookie without popping up windows:uv run scripts/refresh_cookie.py --headless-only
Method 2: Dynamic Set via Chat Tool
Call the MCP tool directly inside your AI chat:
lanhu_set_cookie(cookie="session=...; user_token=...")To get your cookie manually:
Open lanhuapp.com in Chrome and open DevTools (
F12).Go to Network tab, click any request to
lanhuapp.com.In Request Headers, copy the full
Cookiestring containingsessionanduser_token.
Method 3: Environment Variable
Create .env in the project root or pass LANHU_COOKIE:
cp .env.example .env
# Edit .env and set LANHU_COOKIE=session=...; user_token=...🛠️ MCP Client Configuration
Add lanhu-mcp to your favorite MCP client:
Go to Cursor Settings -> MCP -> Add new MCP Server:
Name:
lanhuType:
commandCommand:
uvx --from git+https://github.com/xinayida/lanhu-mcp.git lanhu-mcp
Or configure via ~/.cursor/mcp.json:
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]
}
}
}Add to your claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]
}
}
}Use the Claude Code CLI:
claude mcp add lanhu uvx --from git+https://github.com/xinayida/lanhu-mcp.git lanhu-mcpAdd to your Antigravity configuration or settings.json:
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]
}
}
}Add to your cline_mcp_settings.json:
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"],
"disabled": false,
"autoApprove": []
}
}
}Add using the Codex CLI:
codex mcp add lanhu uvx "--from" "git+https://github.com/xinayida/lanhu-mcp.git" "lanhu-mcp"Or edit ~/.codex/config.toml:
[mcp_servers.lanhu]
command = "uvx"
args = ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]Add via VS Code MCP extension or settings:
{
"mcpServers": {
"lanhu": {
"command": "uvx",
"args": ["--from", "git+https://github.com/xinayida/lanhu-mcp.git", "lanhu-mcp"]
}
}
}🧰 Available Tools
Tool Name | Description | Key Parameters |
| Update authentication cookie and persist to |
|
| Retrieve user teams list (also acts as auth health check) | (none) |
| Fetch design projects in a specific team |
|
| Search projects in team by keyword |
|
| List all artboards/screens under a project with dimensions & thumbnails |
|
| Search artboards by keyword |
|
| ⭐ Core Tool: Retrieve complete layer tree, CSS styles, typography & assets |
|
| Get exportable image/icon assets with download URLs |
|
| Download asset to local disk (supports WebP lossless / SVG / PNG) |
|
🧭 Typical AI Pair-Programming Workflow
When asking your AI agent to implement a UI from Lanhu:
User: "Please implement the checkout screen from our Lanhu project and download necessary icons."The agent will autonomously execute the following chain:
graph LR
A[1. lanhu_get_teams] --> B[2. lanhu_get_projects]
B --> C[3. lanhu_get_screens]
C --> D[4. lanhu_get_annotations]
D --> E[5. Generate Code CSS/HTML/React/Flutter]
D --> F[6. lanhu_download_asset]Example Tool Invocation
# 1. Fetch team list
teams = lanhu_get_teams()
team_id = teams[0]["id"]
# 2. Get project list
projects = lanhu_get_projects(team_id=team_id)
project_id = projects[0]["id"]
# 3. Get artboards list
screens = lanhu_get_screens(project_id=project_id, team_id=team_id)
image_id = screens[0]["id"]
# 4. Extract full annotations
annotations = lanhu_get_annotations(
project_id=project_id,
image_id=image_id,
team_id=team_id
)
# 5. Download icons/slices
assets = lanhu_get_assets(project_id=project_id, image_id=image_id, team_id=team_id)
lanhu_download_asset(
asset_id=assets[0]["id"],
asset_name=assets[0]["name"],
download_url=assets[0]["download_url"],
format="webp" # or "svg"
)📦 Annotation Data Structure
Calling lanhu_get_annotations returns structured JSON:
{
"id": "651234567890abcdef",
"name": "Checkout Page",
"width": 375.0,
"height": 812.0,
"thumbnail_url": "https://...",
"layers": [
{
"id": "layer_01",
"name": "Submit Button",
"type": "rect",
"bounds": { "x": 16.0, "y": 740.0, "width": 343.0, "height": 48.0 },
"border_radius": 8.0,
"opacity": 1.0,
"visible": true,
"fills": [
{ "type": "color", "color": "#0066FF", "opacity": 1.0 }
],
"shadows": [
{ "x": 0.0, "y": 4.0, "blur": 12.0, "spread": 0.0, "color": "#0066FF33" }
],
"children": [
{
"id": "layer_02",
"name": "Button Label",
"type": "text",
"text": "Confirm & Pay",
"bounds": { "x": 140.0, "y": 754.0, "width": 95.0, "height": 20.0 },
"font": {
"size": 16.0,
"weight": "600",
"family": "PingFang SC",
"line_height": 20.0,
"letter_spacing": 0.0,
"color": "#FFFFFF",
"text_align": "center"
}
}
]
}
],
"assets": [
{
"id": "asset_01:svg",
"name": "icon_cart",
"format": "svg",
"download_url": "https://..."
}
]
}⚙️ Environment Variables
Variable | Default | Description |
| (empty) | Raw cookie string fallback ( |
|
| Directory where downloaded assets are stored |
|
| API HTTP request timeout in seconds |
|
| Logging level ( |
⚠️ Disclaimer
This project is an independent open-source tool developed for educational, testing, and AI productivity research purposes. It interacts with Lanhu through reverse-engineered web interfaces. Please adhere to Lanhu's Terms of Service when using this tool. The authors are not responsible for any misuse.
📄 License
This project is licensed under the MIT License.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides AI coding agents with access to Figma design data through the Figma API. Enables accurate one-shot implementation of designs in any framework by translating Figma files into simplified layout and styling information.81MIT
- AlicenseAqualityAmaintenanceEnables 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.3849105MIT
- AlicenseNot gradedqualityAmaintenanceConverts Lanhu design URLs into AI-ready implementation context including HTML+CSS (Tailwind), image downloads, design tokens, and guidance.12733MIT
- AlicenseNot gradedqualityDmaintenanceEnables coding agents like Cursor to access Figma design data, fetch layout and styling information, and implement designs in any framework.57,771MIT
Related MCP Connectors
UI design from prompts, screenshots, and URLs for AI coding agents and theme tokens.
A design-style library for AI agents: search real styles, fetch a ready-to-apply design spec.
Turn any live website into brand colors, fonts, design tokens, SVGs, Lottie and paste-ready code.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/xinayida/lanhu-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server