mcpField
F
Figcraft - Code-driven SVG Diagram Generator

Figcraft - Code-driven SVG Diagram Generator

Local
github.com/zeqinleeDeveloper Tools28Updated 38w ago

About Figcraft - Code-driven SVG Diagram Generator

Figcraft is a TypeScript/Node.js library for building SVG diagrams from code, aimed at developers creating architecture diagrams, flowcharts, and neural-network diagrams. It includes layout helpers and exports to several image and document formats.

Key features

  1. 01Ten diagram shape types
  2. 02Customizable arrowheads
  3. 03Row, column, grid, and group layouts
  4. 04Markdown labels
  5. 05SVG, PNG, JPG, WebP, and PDF export

Use cases

  1. 01Create architecture diagrams in code
  2. 02Arrange flowchart elements automatically
  3. 03Export diagrams to image or PDF formats

MCP support

Figcraft provides an MCP integration through `figcraft-mcp`, allowing AI agents to generate diagrams from natural-language descriptions.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"figcraft": {
"command": "npx",
"args": [
"-y",
"figcraft-mcp"
]
}
}
}
Run commandnpx -y figcraft-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmfigcraft-mcp

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README
Figcraft logo

Figcraft

Code-driven SVG diagram library for TypeScript / Node.js

By XFlow · Write a few lines of TypeScript, get publication-ready architecture diagrams.

npm version license node PRs Welcome

Website · Documentation · Install · GitHub


Transformer architecture diagram
CNN image classification pipeline

Highlights

Feature
10 Shapesrect, circle, diamond, trapezoid, text, image, cylinder, cuboid, sphere, stack2D + 3D
11 Arrow Headstriangle, stealth, vee, circle, diamond, bar, dot + open variantsFully customizable
Smart Layoutrow() col() grid() group()Auto-alignment
Markdown Labels**bold** *italic* `code` $math$In any element
Multi-formatSVG, PNG, JPG, WebP, PDFfit auto-crop
MCPAI agents generate diagrams via natural languageClaude / Cursor
Zero BrowserRuns entirely in Node.jsServer-side ready

Install

npm install figcraft        # npm
pnpm add figcraft           # pnpm
yarn add figcraft           # yarn

Requires Node.js 18+

Quick Start

import { Figure } from 'figcraft'

const fig = new Figure(800, 400, { bg: '#fff' })

const a = fig.rect('Input', {
  pos: [50, 100], size: [120, 50],
  fill: '#e3f2fd', radius: 6
})

const b = fig.rect('Output', {
  pos: [250, 100], size: [120, 50],
  fill: '#c8e6c9', radius: 6
})

fig.arrow(a, b, { head: 'stealth', label: 'data' })

await fig.export('diagram.svg', { fit: true, margin: 20 })
npx tsx diagram.ts

Elements

TypeMethodDescription
Rectfig.rect()Rounded rectangle
Circlefig.circle()Circle
Diamondfig.diamond()Decision node
Trapezoidfig.trapezoid()Pooling / reduction
Textfig.text()Markdown text label
Imagefig.image()Embedded image
Cylinderfig.cylinder()3D cylinder (database)
Cuboidfig.cuboid()3D cuboid (tensor)
Spherefig.sphere()3D sphere
Stackfig.stack()Multi-layer stack

Arrows

fig.arrow(a, b)                                      // default
fig.arrow(a, b, { head: 'stealth', color: '#1565c0' }) // styled

// Anchors
fig.arrow(a, b, { from: 'right', to: 'left' })
fig.arrow(a, b, {
  from: { side: 'bottom', at: 30 },
  to: { side: 'top', at: 70 }
})

// Paths
fig.arrow(a, b, { path: 'curve', curve: 40 })
fig.arrow(a, b, { path: 'polyline', cornerRadius: 8 })

// Styles
fig.arrow(a, b, { style: 'dashed', bidirectional: true })

// Fan & Fork
fig.arrows(src, [a, b, c], { head: 'stealth' })  // fan-out
fig.fork(src, [a, b, c], { head: 'stealth' })     // shared trunk

Layout

fig.row([a, b, c], { gap: 40 })            // horizontal
fig.col([a, b, c], { gap: 30 })            // vertical
fig.grid([a, b, c, d, e, f], { cols: 3 })  // grid
fig.group([a, b, c], { label: 'Pipeline' }) // group box

Export

await fig.export('out.svg')                           // SVG vector
await fig.export('out.png', { fit: true, scale: 3 })  // high-res PNG
await fig.export('out.jpg', { quality: 95 })           // JPEG
await fig.export('out.webp')                           // WebP
await fig.export('out.pdf')                            // PDF

const svg = fig.render({ fit: true })                  // SVG string

MCP Integration

Let AI agents create diagrams for you. Add to Claude Code or Cursor config:

{
  "mcpServers": {
    "figcraft": {
      "command": "npx",
      "args": ["figcraft-mcp"]
    }
  }
}

Then just describe what you want in natural language.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Links

License

MIT — Made by XFlow

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.