CLI Usage

Beyond running as an MCP server, figma-developer-mcp can be used directly from the command line to fetch simplified Figma design data. This is useful for scripting, piping design data into other tools, or quick one-off lookups during development.

Running figma-developer-mcp with no subcommand starts the MCP server as usual. The fetch subcommand below is what enables direct CLI usage.

fetch

Pull simplified design data for a Figma file or node and print it to stdout. Uses the same simplification pipeline as the MCP server's get_figma_data tool, so the output is identical.

npx figma-developer-mcp fetch "https://figma.com/design/ABC123/My-File?node-id=1-2" \
--figma-api-key=figd_xxxxxx

Output is YAML by default. Pass --json for JSON.

Authentication works the same as the server — provide a Figma API key or OAuth token via flag or environment variable. See Configuration for details on authentication and .env files.

Flags

The fetch subcommand accepts a Figma URL as a positional argument, plus the following flags:

FlagDescription
--file-keyFigma file key (overrides the URL)
--node-idNode ID in 1234:5678 format (overrides the URL)
--depthLimit tree traversal depth
--jsonOutput JSON instead of YAML
--figma-api-keyFigma API key (Personal Access Token)
--figma-oauth-tokenFigma OAuth Bearer token
--envPath to .env file

When both a URL and explicit flags are provided, the flags take precedence. This lets you override just the node ID while still pulling the file key from a URL, for example.

Examples

Fetch a specific node as YAML

npx figma-developer-mcp fetch "https://figma.com/design/ABC123/My-File?node-id=1-2" \
--figma-api-key=figd_xxxxxx

Fetch as JSON and pipe to jq

npx figma-developer-mcp fetch "https://figma.com/design/ABC123/My-File?node-id=1-2" \
--figma-api-key=figd_xxxxxx --json | jq '.nodes[0]'

Use explicit flags instead of a URL

npx figma-developer-mcp fetch --file-key ABC123 --node-id 1:2 \
--figma-api-key=figd_xxxxxx

Limit traversal depth

npx figma-developer-mcp fetch "https://figma.com/design/ABC123/My-File" \
--figma-api-key=figd_xxxxxx --depth 3

Save output to a file

npx figma-developer-mcp fetch "https://figma.com/design/ABC123/My-File?node-id=1-2" \
--figma-api-key=figd_xxxxxx > design-data.yaml