A Model Context Protocol (MCP) server that enables Claude to interact with Adobe XD files, extract design information, and generate pixel-perfect React components from your designs.
- Document Analysis: Extract comprehensive information from XD files including artboards, components, and assets
- React Component Generation: Convert XD designs to React components with multiple styling options
- Color Extraction: Extract color palettes in various formats (CSS, JSON, Tailwind)
- Multiple Style Systems: Support for styled-components, Tailwind CSS, and CSS modules
- TypeScript Support: Generate type-safe React components
- Layout & Spacing Analysis: Automatically detect spacing patterns and generate spacing tokens
- Design Token Generation: Extract complete design systems (colors, spacing, typography) in multiple formats
- UI Pattern Detection: Intelligently identify buttons, cards, and other UI components
- Typography System Extraction: Analyze and organize all text styles into a reusable type system
- Layout System Detection: Detect flexbox/grid patterns and generate implementation CSS
- Element Style Extraction: Get detailed CSS and Tailwind classes for any element
- Artboard Preview Export: View design previews directly in the terminal
- Node.js (v16 or higher)
- npm or yarn
- Claude Desktop application
- Clone the repository:
git clone https://github.com/yourusername/adobe-xd-mcp.git
cd adobe-xd-mcp- Install dependencies:
npm install- Build the server:
npm run buildAdd the server to your Claude Code configuration:
Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
Edit: %APPDATA%\Claude\claude_desktop_config.json
Edit: ~/.claude.json
Add the following configuration:
{
"mcpServers": {
"adobe-xd": {
"command": "node",
"args": ["/absolute/path/to/adobe-xd-mcp/dist/index.js"]
}
}
}Note: Replace /absolute/path/to/adobe-xd-mcp with the actual path to your installation directory.
Get comprehensive information about an XD document.
Returns:
- Document name and metadata
- List of artboards with dimensions and element counts
- Components and their structures
- Color palette
Convert XD artboards/components to React code.
Parameters:
path: Path to XD file (required)artboardName: Specific artboard to convert (optional)componentName: Specific component to convert (optional)outputDir: Output directory (optional)styleSystem: "styled-components", "tailwind", or "css-modules" (default: tailwind)typescript: Generate TypeScript (default: true)
Extract color palette in various formats.
Parameters:
path: Path to XD file (required)format: "css", "json", or "tailwind" (default: css)outputFile: Save to file (optional)
Get detailed information about a specific artboard including all element positions, sizes, and styles.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)
Get detailed CSS properties and Tailwind classes for elements.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)elementName: Specific element name (optional)
Returns:
- CSS properties for each element
- Suggested Tailwind classes
- Positioning and sizing information
Analyze spacing between elements for pixel-perfect implementation.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)
Returns:
- Spacing tokens with usage frequency
- Suggested semantic names (xs, sm, md, lg, xl)
- Layout direction (horizontal/vertical/mixed)
- Gap values
- Suggested CSS (flexbox/grid)
Generate complete design system tokens.
Parameters:
path: Path to XD file (required)format: "json", "css", "tailwind", or "typescript" (default: json)outputFile: Save to file (optional)
Returns:
- Spacing tokens
- Color tokens with usage counts
- Typography system
- Border radius values
- Ready-to-use code in your chosen format
Automatically identify common UI components.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)
Returns:
- Detected patterns (button, card, input, etc.)
- Confidence scores
- Bounding boxes
- Suggested component names
Extract and organize all typography styles.
Parameters:
path: Path to XD file (required)
Returns:
- All unique font combinations
- Usage frequency for each style
- Suggested semantic names (display, h1-h5, body, etc.)
- Font properties (family, size, weight, line-height, letter-spacing)
Detect layout patterns and generate implementation CSS.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)
Returns:
- Layout direction
- Detected gaps
- Alignment patterns
- Suggested CSS (display, flex-direction, gap, justify-content, etc.)
Export artboard as base64-encoded image for viewing.
Parameters:
path: Path to XD file (required)artboardName: Name of artboard (required)
"Get information about the XD file at /path/to/design.xd"
"Generate a React component from the LoginScreen artboard in /path/to/design.xd using TypeScript and Tailwind CSS"
"Generate design tokens from /path/to/design.xd in Tailwind format and save to tokens.js"
"Analyze the spacing in the HomePage artboard from /path/to/design.xd"
Returns spacing tokens like:
{
"spacingTokens": [
{ "value": 8, "usage": 15, "suggestedName": "sm" },
{ "value": 16, "usage": 12, "suggestedName": "base" },
{ "value": 24, "usage": 8, "suggestedName": "lg" }
],
"layoutAnalysis": {
"direction": "vertical",
"gaps": [16, 24, 16],
"suggestedCSS": {
"display": "flex",
"flexDirection": "column",
"gap": "16px"
}
}
}"Detect UI patterns in the Dashboard artboard from /path/to/design.xd"
Returns identified components:
{
"patterns": [
{
"type": "button",
"confidence": 0.8,
"suggestedComponent": "Button",
"bounds": { "x": 100, "y": 200, "width": 120, "height": 40 }
},
{
"type": "card",
"confidence": 0.6,
"suggestedComponent": "Card",
"bounds": { "x": 0, "y": 0, "width": 300, "height": 400 }
}
]
}"Extract the typography system from /path/to/design.xd"
Returns:
{
"styles": [
{
"fontSize": 48,
"fontFamily": "Inter",
"fontWeight": 700,
"lineHeight": 1.2,
"usage": 5,
"suggestedName": "display"
},
{
"fontSize": 16,
"fontFamily": "Inter",
"fontWeight": 400,
"lineHeight": 1.5,
"usage": 45,
"suggestedName": "body"
}
]
}"Get the styles for the 'Primary Button' element in the Components artboard"
Returns CSS and Tailwind classes:
{
"elements": [
{
"name": "Primary Button",
"type": "rectangle",
"css": {
"width": "120px",
"height": "40px",
"backgroundColor": "#5ead0c",
"borderRadius": "8px"
},
"tailwindClasses": ["bg-[#5ead0c]", "rounded-lg"]
}
]
}-
Analyze the Design
"Analyze layout spacing in my HomePage artboard" -
Generate Design Tokens
"Generate design tokens in TypeScript format" -
Detect UI Patterns
"Detect UI patterns in the HomePage artboard" -
Extract Typography
"Extract typography system from the design" -
Get Specific Element Styles
"Get styles for the header navigation" -
Generate Component Code
"Generate React component for the HomePage using the detected patterns"
adobe-xd-mcp/
├── src/
│ ├── index.ts # MCP server setup
│ ├── tools/
│ │ └── xd-tools.ts # Main XD processing logic
│ ├── parsers/
│ │ └── xd-parser.ts # XD file parsing
│ ├── generators/
│ │ └── react-generator.ts # React code generation
│ └── analyzers/
│ └── design-system-analyzer.ts # Design system analysis
├── dist/ # Compiled output
├── package.json
└── tsconfig.json
npm run devnpm run build- Ensure the path in
claude_desktop_config.jsonis absolute - Restart Claude Desktop after configuration changes
- Check that the build completed successfully
- Verify Node.js version is 16 or higher
- Ensure the XD file path is correct and accessible
- Verify the XD file is not corrupted
- Check file permissions
- Try re-saving the XD file
- Note: Supports both legacy (single artwork.agc) and modern (per-artboard graphicContent.agc) XD file formats
- Verify the artboard name exists in the XD file (case-insensitive)
- Ensure the output directory is writable
- Check for naming conflicts with existing files
- Verify sufficient disk space
- Ensure the XD file contains actual design elements
- Check that artboards have named elements
- Verify text elements have font properties set
- Name Your Elements: Named elements in XD produce better, more semantic code
- Use Consistent Spacing: Regular spacing values produce cleaner spacing tokens
- Organize with Components: XD components map well to React components
- Group Related Elements: Grouped elements are easier to identify as UI patterns
- Use Text Styles: Consistent text styling produces better typography systems
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
For issues and feature requests, please use the GitHub issue tracker.
- Added layout and spacing analysis
- Added design token generation (CSS, Tailwind, TypeScript)
- Added UI pattern detection
- Added typography system extraction
- Added layout system detection
- Added element style extraction with Tailwind classes
- Added artboard preview export
- Enhanced XD parser to support both legacy and modern XD file formats
- XD file parsing (legacy format)
- React component generation
- Color extraction
- Basic design analysis