Repository avatar
Other Tools
v0.1.3
active

kerfkit

io.github.junixlabs/kerfkit

Check and fix SVG/DXF laser cutting files, work out kerf and slot widths, make slot gauges.

Documentation

kerfkit

Laser cutting file checker and fixer: validate and repair SVG/DXF for laser cutters (open paths, double lines, tiny segments, kerf and slot fit), generate slot gauges and test sheets. CLI, Python, MCP server and Claude plugin.

CI License: MIT Python 3.10+ MCP server

Catch the problems that waste a sheet before you press start: a file that imports 33 % too small, an outline that is not closed, a line the laser cuts twice, slots drawn for 3.0 mm ply when yours measures 3.2. Then fix the safe ones automatically and work out the slot width for your sheet and kerf.

kerfkit check, fix and slot in a terminal

Before: kerfkit check finds 4 failuresAfter: kerfkit fix, re-checked: pass
a messy panel with an open hole, a double line, a stray node and pixel unitsthe same panel fixed: mm units, red hairline cuts, black engrave

Files: examples/messy-panel.svg → examples/messy-panel.fixed.svg

Install

pip install git+https://github.com/junixlabs/kerfkit           # CLI + Python
pip install "kerfkit[dxf] @ git+https://github.com/junixlabs/kerfkit"   # + DXF input

Or run it without installing anything permanent, with uv:

uvx --from git+https://github.com/junixlabs/kerfkit kerfkit check my-file.svg

Python 3.10+. Dependencies: numpy, shapely, svgpathtools (and ezdxf for DXF). Runs on CPU, no browser, no network.

30-second tour

kerfkit check panel.svg                            # every check, pass / warn / fail, locations in mm
kerfkit check panel.svg --thickness 3 --kerf 0.15  # + slot widths against your sheet
kerfkit fix panel.svg -o panel.fixed.svg           # safe repairs, clean mm SVG out
kerfkit slot --thickness 3.2 --kerf 0.15           # "Draw slots 3.050 mm wide"
kerfkit refit shelf.svg -o shelf.3.2.svg --thickness 3.2 --kerf 0.15
kerfkit testsheet -o test.svg --thickness 3        # slot gauge + key + kerf square
kerfkit kerf square 20.16 19.84                    # "kerf = 0.160 mm"

check exits 1 when anything fails, so it works as a pre-flight step in scripts and CI.

What it checks

CheckWhat it catches
unitswidth/height in px or missing (imports 75 % or 133 % off between 72 and 96 DPI apps), mismatched viewBox scale
layerscolour → layer mapping (red cut, blue score, black/blue fill engrave), filled or thick cut lines, lines named "engrave" but drawn in cut red. A per-colour table is in the JSON
text-outlinedlive <text>, clones (<use>), embedded objects; raster images
tiny-strayspaths shorter than 0.5 mm: stray nodes the laser fires on
tiny-segmentszero-length segments, and files made of thousands of sub-0.05 mm segments (node cleanup)
closed-pathsopen outlines (gap > 0.01 mm), told apart from slits/living hinges inside a part and deliberate holding bridges
open-fragmentsoutlines made of loose pieces that only close end to end
self-intersectionoutlines that cross themselves
no-duplicatesdouble and overlapping cut lines (> 0.5 mm within 0.02 mm), including a path retracing itself
islands, parts-overlaploose pieces inside cut-outs, parts cutting through each other
min-featurenecks and strips narrower than the minimum bridge (default 1.2 mm)
min-holecut-outs narrower than 1.0 mm
fits-bedparts or layout bigger than your bed (--bed 400x300)
slot-widthslots not at thickness − kerf + clearance (--thickness 3 --kerf 0.15)
finger-depthfinger notches not one sheet deep (--profile box)

Profiles (--profile) switch checks on for a kind of job: generic (default), strict (requires the colour convention), box, tray, kerf-test, ornament (one piece + hanging hole), name, silhouette, engrave (engrave-only files are valid), layered, refit. Every threshold is a parameter.

What fix changes, and what it never touches

Changes (each can be switched off): real size in mm · zero-length segments and stray nodes removed · colours mapped to cut / score / engrave (override with --map 'stroke:#e8251b=cut') · fill-only shapes turned into cut outlines when that is unambiguous · double cuts merged · open ends joined where each end has exactly one partner within --gap-max (0.2 mm) · optional kerf compensation (--kerf 0.15: outlines out, holes in by half the kerf).

Never touched: thin bridges, small holes, self-intersections, islands, slot widths. Those are design decisions; check reports them with locations and you decide.

Kerf and slots

Slots are drawn on their centre line and the beam removes half the kerf on each side, so:

draw slot = measured thickness − kerf + clearance

kerfkit slot --thickness 3.0 --kerf 0.1 → draw 2.90 mm. Add --drawn 3.0 to judge a slot already in a file (tight / ok / loose), --dowel 3 to size a dowel hole.

Find your kerf from one test cut (kerfkit testsheet):

  • Kerf square: a 20 mm square hole; measure the hole and the square that drops out. kerfkit kerf square HOLE SQUARE gives (hole − square) / 2, which cancels most caliper error.
  • Slot gauge: five notches around thickness − kerf, each labelled with the kerf to use if it is the snug one. Push the key (cut from the same sheet) into each.
  • Also: kerf part DRAWN MEASURED, kerf hole DRAWN MEASURED, kerf comb TOTAL MEASURED --cuts N.

kerfkit refit FILE -o OUT --thickness 3.2 --kerf 0.15 redraws every closed rectangular slot at the new width, keeping its centre, angle and length. The model is not scaled.

Python

from kerfkit import check_file, fix_svg, slot_width, refit_slots, test_sheet

rep = check_file("panel.svg", thickness_mm=3.0, kerf_mm=0.15, bed_mm=[400, 300])
print(rep["pass"], [c["id"] for c in rep["checks"] if c["status"] == "fail"])

result = fix_svg("panel.svg", gap_max=0.2)
open("panel.fixed.svg", "w").write(result.svg)

slot_width(3.2, kerf=0.15, clearance=0.05)   # 3.1

Use it from Claude or any MCP client

kerfkit ships a stdio MCP server, kerfkit-mcp, with seven tools: check_laser_file, fix_laser_svg, slot_width, kerf_from_test, refit_slots, make_slot_gauge, make_test_sheet. It reads and writes local files only and makes no network calls.

Claude Code plugin (MCP server + skill in one step):

/plugin marketplace add junixlabs/kerfkit
/plugin install kerfkit@junixlabs

Then /kerfkit:check my-box.svg 3 0.15 checks a file (thickness 3 mm, kerf 0.15 mm), and /kerfkit:fix my-box.svg writes a repaired copy next to it. /kerfkit:feedback drafts a GitHub issue.

The plugin also lists an optional second server, fit: the remote MocMakes Fit MCP server (sign-in with OAuth via /mcp), with the /kerfkit:fit-projects and /kerfkit:fit-build commands for your own Fit projects. It is only contacted if you authenticate it; kerfkit's own tools stay local and need no account.

Claude Desktop, one click: download kerfkit-mcp-<version>.mcpb from the latest release and open it (needs a host that supports MCP bundles; it installs the Python dependencies with uv). kerfkit is also listed in the Official MCP Registry as io.github.junixlabs/kerfkit.

Try it on Glama: glama.ai/mcp/servers/junixlabs/kerfkit lists the tools and the server's quality score, and lets you test it in the MCP Inspector before you install anything.

kerfkit MCP server on Glama

Claude Code, MCP only:

claude mcp add kerfkit -- uvx --with ezdxf --from git+https://github.com/junixlabs/kerfkit kerfkit-mcp

Claude Desktop, Cursor, VS Code, other MCP clients (mcpServers JSON):

{
  "mcpServers": {
    "kerfkit": {
      "command": "uvx",
      "args": ["--with", "ezdxf", "--from", "git+https://github.com/junixlabs/kerfkit", "kerfkit-mcp"]
    }
  }
}

Skill only: copy skills/kerfkit/ into ~/.claude/skills/. It teaches the assistant the workflow (check → fix → re-check → slot width → test cut) and the formulas, and uses the CLI.

Then ask things like "check ~/Downloads/box.svg for my 3 mm ply, kerf 0.15" or "make me a slot gauge for 6 mm MDF".

FAQ

How do I check an SVG before laser cutting? kerfkit check file.svg. It reports units, layers, open paths, double lines, stray nodes, thin bridges, small holes and bed fit, each with the location in mm. Add --thickness and --kerf to check slot widths too.

How do I find my laser's kerf? Cut kerfkit testsheet -o test.svg --thickness 3 and measure the 20 mm square hole and the square that drops out: kerfkit kerf square 20.16 19.84 → 0.16 mm. On 3 mm plywood it is usually 0.1 to 0.2 mm.

Why are my slots too loose? The slot was drawn at the nominal thickness and the beam widened it by the kerf, or your sheet is thinner than the label. Measure the sheet, then kerfkit slot --thickness 2.9 --kerf 0.15 --drawn 3.0 tells you how loose and what width to draw; kerfkit refit redraws closed slots for you.

Why are my slots too tight? Usually the sheet is thicker than the file assumed: plywood sold as 3 mm can measure anywhere from 2.7 to 3.2 mm. Same commands as above.

Why does my SVG import at the wrong size? Its width and height are in pixels or missing, and apps disagree on 72 vs 96 pixels per inch (75 % / 133 %). kerfkit check flags it, kerfkit fix writes real millimetres.

Which colours does it expect? Red #FF0000 hairline = cut, blue #0000FF = score, black (or blue) fill = engrave, a common convention in shared files. Laser apps such as LightBurn put each colour on its own layer, so near-misses like #e8251b end up on a separate layer. Other colours are read leniently and fix maps them; --strict requires the convention.

Does it work with LightBurn, Glowforge, xTool? It checks and writes plain SVG (and reads DXF), which they all import. It does not read .lbrn or .gf project files yet.

Is this a guarantee the file cuts? No. These are geometry checks against cut rules; machines, focus and materials vary. Cut the small test sheet first.

Honest scope (v0.1)

  • SVG in and out; DXF in (checks only). No DXF writing, no LightBurn/xTool project files yet.
  • refit moves closed rectangular slots only. Edge notches, tabs and finger joints are found and reported by check, not moved.
  • fix writes a new, flattened SVG (one path per shape, transforms baked in). Groups, layer names and metadata of the original are not kept. Text and images are left out with a warning.
  • Kerf compensation and fill merging turn curves into fine polylines.
  • No raster analysis: engraving line widths and photos are not judged.

Roadmap: a jig board generator and batch names from CSV (v0.2), DXF out and LightBurn export (v0.3). Ideas and bug reports are welcome in Issues and Discussions.

Made by MocMakes

kerfkit is the open-source core of the checks behind MocMakes, where we design slot-together laser kits.

Contributing

Bug reports with a sample file are the most useful thing you can send (strip anything private first). See CONTRIBUTING.md. Security issues: SECURITY.md.

MIT licence © MocMakes.

MCPB
https://github.com/junixlabs/kerfkit/releases/download/v0.1.3/kerfkit-mcp-0.1.3.mcpb
Install Command
# mcpb: https://github.com/junixlabs/kerfkit/releases/download/v0.1.3/kerfkit-mcp-0.1.3.mcpb