API & MCP
Everything a person can do on Threadsmith Stitch File Writer, a program or AI agent can do with the same inputs and get the identical result.
HTTP API
POST https://threadsmithstitchfile.usefulweb.site/api/v1/calculate– run Threadsmith Stitch File WriterGET https://threadsmithstitchfile.usefulweb.site/api/v1/tool– inputs, output schema, examples- OpenAPI 3.1: /openapi.json · /openapi.yaml
- Errors:
application/problem+json;422includes per-fielderrors.
Threadsmith Stitch File Writer
Encodes stitches as a Tajima DST (512-byte header, balanced-ternary 3-byte records, jumps split to ≤ 12.1 mm, colour changes, trims as zero-sum jumps, END), Brother PES (v1 wrapper around the PEC stitch block with thread palette indices and thumbnails, real trim flags), Janome JEF (header with hoop, extents and Janome thread indices) or Melco EXP file. The file is decoded again to verify every stitch position before you download it.
| Field | Type | Default | Description |
|---|---|---|---|
format | select (dst, pes, jef, exp) | "dst" | File format |
stitches | textarea | — | Stitch list (JSON). [[x, y], [x, y, "jump"], [x, y, "trim"], [x, y, "color"], …] in mm (y down), or {"cmds": […], "colors": [{"name", "hex"}]} from threadsmith-digitize. |
project | textarea | — | Or: Threadsmith project JSON. If given, the project is digitized first. |
label | text | "DESIGN" | Design label (DST/PES header, 8 characters) |
colorMatch | select (de2000, redmean) | "de2000" | Thread colour matching. PES/JEF: how thread colours of a stitch list are matched to the machine chart. A project keeps the method it was saved with. |
Example request
Tiny square outline with a jump and a colour change → DST
curl -X POST https://threadsmithstitchfile.usefulweb.site/api/v1/calculate -H 'content-type: application/json' -d '{"format":"dst","label":"SQUARE","stitches":"[[0,0],[10,0],[10,10],[0,10],[0,0],[30,0,\"jump\"],[30,0,\"color\"],[30,0],[40,5],[30,10]]"}'
Every result contains
inputs (normalised, defaults applied), summary, result (validated against the published schema), units, assumptions, sources, warnings, computedAt and links.
MCP (Model Context Protocol)
- Streamable HTTP endpoint:
https://threadsmithstitchfile.usefulweb.site/mcp– protocol revisions 2026-07-28 (stateless) and 2025-11-25 / 2025-06-18 / 2025-03-26 (initialize handshake). - Tools:
threadsmith_stitch_file - Local stdio connector:
node src/mcp-stdio.ts --tool=threadsmith-stitch-file
{
"mcpServers": {
"threadsmith-stitch-file": { "type": "http", "url": "https://threadsmithstitchfile.usefulweb.site/mcp" }
}
}