Skip to main content
Glama

Figma MCP Server

by 1yhy
style.ts1.17 kB
import { Node as FigmaDocumentNode } from "@figma/rest-api-spec"; import { SimplifiedFill } from "~/services/simplify-node-response.js"; import { generateCSSShorthand, isVisible, parsePaint } from "~/utils/common.js"; import { hasValue, isStrokeWeights } from "~/utils/identity.js"; export type SimplifiedStroke = { colors: SimplifiedFill[]; strokeWeight?: string; strokeDashes?: number[]; strokeWeights?: string; }; export function buildSimplifiedStrokes(n: FigmaDocumentNode): SimplifiedStroke { let strokes: SimplifiedStroke = { colors: [] }; if (hasValue("strokes", n) && Array.isArray(n.strokes) && n.strokes.length) { strokes.colors = n.strokes.filter(isVisible).map(parsePaint); } if (hasValue("strokeWeight", n) && typeof n.strokeWeight === "number" && n.strokeWeight > 0) { strokes.strokeWeight = `${n.strokeWeight}px`; } if (hasValue("strokeDashes", n) && Array.isArray(n.strokeDashes) && n.strokeDashes.length) { strokes.strokeDashes = n.strokeDashes; } if (hasValue("individualStrokeWeights", n, isStrokeWeights)) { strokes.strokeWeight = generateCSSShorthand(n.individualStrokeWeights); } return strokes; }

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/1yhy/Figma-Context-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server