# Figma MCP Server - Project Summary
## π Project Structure (Clean & Organized)
```
figma-mcp/
βββ π README.md # Main documentation
βββ π package.json # Dependencies and scripts
βββ π tsconfig.json # TypeScript configuration
βββ π .env # Environment variables (FIGMA_TOKEN)
βββ π« .gitignore # Git ignore rules
β
βββ π src/
β βββ index.ts # Main MCP server with 7 tools
β
βββ π tests/
β βββ README.md # Test documentation
β βββ test-tool.ts # HTML/CSS generation test
β βββ test-image.ts # Screenshot capture test
β βββ test-token.ts # Token validation test
β
βββ π docs/
β βββ README.md # Documentation index
β βββ TROUBLESHOOTING.md # Common issues & solutions
β βββ CSS-IMPROVEMENTS.md # CSS generation details
β βββ IMAGE-FEATURE.md # Screenshot feature guide
β
βββ π build/
β βββ index.js # Compiled JavaScript (generated)
β
βββ π .vscode/
βββ mcp.json # VS Code MCP configuration
```
## π οΈ Available Tools (7 Total)
1. **getFile** - Fetch complete Figma file data
2. **getNode** - Fetch specific node from file
3. **analyzeDesign** - Extract design properties
4. **generateCSS** - Generate CSS styles
5. **generateHTML** - Generate HTML structure
6. **generateFullDesign** - Complete HTML/CSS output
7. **getImage** - Capture screenshots (PNG/JPG/SVG/PDF)
## π Quick Start Commands
```bash
# Install dependencies
npm install
# Build the server
npm run build
# Start the MCP server
npm start
# Run tests
npx tsx tests/test-tool.ts # HTML/CSS generation
npx tsx tests/test-image.ts # Screenshot capture
npx tsx tests/test-token.ts # Token validation
```
## π Key Features
### β
Design-to-Code
- Extract complete HTML/CSS from Figma designs
- Normalized CSS class names (no invalid characters)
- Responsive styling and proper layout
- Typography and color conversion
### β
Screenshot Capture
- PNG, JPG, SVG, PDF formats
- Scalable (0.01x to 4x)
- Automatic download
- High-quality renders
### β
Design Analysis
- Component hierarchy inspection
- Style property extraction
- Color and typography analysis
- Dimension and positioning data
### β
AI Integration
- Works with Claude Desktop
- VS Code MCP support
- Stdio transport for communication
- Zod schema validation
## π§ Configuration
### Environment Variables (.env)
```bash
FIGMA_TOKEN=your_personal_access_token_here
```
### MCP Server Config (Claude Desktop)
```json
{
"mcpServers": {
"figma": {
"command": "node",
"args": ["C:\\path\\to\\figma-mcp\\build\\index.js"]
}
}
}
```
## π Documentation Structure
### Main Docs
- **README.md** - Complete feature overview and usage
- **tests/README.md** - Test scripts documentation
- **docs/README.md** - Documentation index
### Guides
- **TROUBLESHOOTING.md** - Common issues (auth, tokens, node access)
- **CSS-IMPROVEMENTS.md** - CSS generation technical details
- **IMAGE-FEATURE.md** - Screenshot feature comprehensive guide
## π― Common Workflows
### 1. Convert Design to HTML/CSS
```bash
# Edit tests/test-tool.ts with your fileKey and nodeId
npx tsx tests/test-tool.ts
# Output: output.html
```
### 2. Capture Design Screenshot
```bash
# Edit tests/test-image.ts with your fileKey and nodeId
npx tsx tests/test-image.ts
# Output: figma-screenshot-{nodeId}.png
```
### 3. Validate API Access
```bash
npx tsx tests/test-token.ts
# Checks: token validity, file access, node access
```
### 4. Use with Claude Desktop
1. Build: `npm run build`
2. Add to Claude config (see README)
3. Restart Claude Desktop
4. Use tools in conversation
## π Security Notes
- β
`.env` file is git-ignored
- β
Token never committed to repository
- β
Use Personal Access Tokens only
- β
Follow MCP authorization best practices
## π Supported Figma Properties
### Layout
- Width, height, positioning
- Padding, margins
- Border radius
### Colors
- Fill colors (solid)
- Stroke/border colors
- RGBA format output
### Typography
- Font family, size, weight
- Line height, alignment
- Text content
### Effects
- Drop shadows
- Box shadows
- Border styles
## π Common Issues & Solutions
### "Invalid token"
β Use Personal Access Token from Figma Settings
### Node not found
β Check node ID format (8384-4 or 8384:4 both work)
### CSS classes not working
β Already fixed! Classes are normalized (no colons)
See **docs/TROUBLESHOOTING.md** for detailed solutions.
## π¨ Design Philosophy
1. **Clean Structure** - Organized into logical directories
2. **Comprehensive Docs** - README for each major section
3. **Easy Testing** - Simple test scripts for all features
4. **Production Ready** - Proper TypeScript, error handling
5. **Well Documented** - Examples and guides for everything
## π Future Enhancements (Ideas)
- [ ] Batch export multiple nodes
- [ ] Component variation detection
- [ ] CSS variable extraction
- [ ] Tailwind CSS output option
- [ ] React/Vue component generation
- [ ] Design token extraction
- [ ] Animation/interaction export
- [ ] Accessibility analysis
## π€ Contributing
1. Fork the repository
2. Create feature branch
3. Add tests for new features
4. Update documentation
5. Submit pull request
## π License
MIT - See LICENSE file for details
---
**Last Updated:** November 14, 2025
**Version:** 1.0.0
**Status:** β
Production Ready