Model Context Protocol
MCP
Give an agent access to the same garment operations as the Python SDK. The current local server wraps Client over stdio. Hosted HTTP access with authentication is planned.
No authentication. Local use only. python -m beforewear.mcp or the beforewear-mcp console script.
Run locally
First request SDK access and install the supplied checkout following the installation steps. Configure your MCP client to launch the Python interpreter from that environment:
{
"mcpServers": {
"beforewear": {
"command": "/absolute/path/to/sdk/.venv/bin/python",
"args": ["-m", "beforewear.mcp"]
}
}
}Replace the interpreter path with your installed environment. This is a local stdio configuration, not a hosted endpoint.
python -m beforewear.mcpStdio JSON-RPC. Protocol version 2024-11-05. Methods: initialize, tools/list, tools/call, ping.
Wire format
Use your catalog’s product ID or SKU in place of aop-hoodie.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "garment.drape",
"arguments": {
"product_id": "aop-hoodie",
"body_id": "body_male_m_native_straight",
"material_id": "fleece_250gsm",
"device": "gpu"
}
}
}Success returns structuredContent plus a text JSON dump. garment.drape / compile / arrange accept either a project_id or Product/Pattern + Construction + Body + Material ids (a project is created for you).
Tool catalog
Thirty-seven dotted names. One JSON args sample per tool lives in examples/samples/tools/.
Product
product.listLibrary blanks.
product.getFetch by SKU or id. Pattern and Construction come with the blank.
Pattern
pattern.import2D pieces. source is provenance (for example manufacturer files).
pattern.draftFrom a sentence. Preflight still applies.
pattern.annotate_sketchFrom a drawing.
pattern.from_reference_imagesVisual-match inlet from product photos. Not a factory nest.
pattern.getFetch a Pattern.
pattern.reviseMeasured change to the cut. New Pattern id.
pattern.preflight2D gate before drape.
pattern.gradeReference Pattern + size chart → one Pattern per size. No grade knobs.
Construction
construction.proposeSewing from a Pattern and optional evidence photos. Includes placements.
construction.apply_recipefolded_band, patch, casing, and family recipes.
construction.preflightSewing gate before drape.
construction.getFetch Construction.
construction.reviseChange sewing. New Construction id.
Body and material
body.list / body.getbody.selectsex, size, pose from the library. Custom pose is the same MHR avatar, posed. SMPL / SMPL-X land through NVIDIA SOMA. Not a mesh. See avatars.
material.list / material.getLibrary cloth.
material.buildA swatch is a visual reference. Physical properties need a measured profile or reviewed assumptions.
Garment jobs
garment.compileInspectable stage.
garment.arrangeWhere the factory often refuses. Read the gate; do not drape past it.
garment.drapeBlank Run. device: cpu | gpu. No artwork argument.
garment.finishChild Run, still a blank.
garment.renderview_set (catalog, turntable, …), body (display, ghost, garment_only). Inspectable catalog views.
mockup.renderPresentation stills. kind: on_avatar | ghost | flat | on_model. Review delivered print fidelity. On-model: generated or photo + photo_uri. No generator knobs. See avatars.
garment.exportTypically glb.
garment.status / garment.getPoll and fetch a Run.
garment.measurePoints of measure vs the size chart.
uv.auditPrintable placements still have honest UVs after drape.
Stamps
colorway.applyDye a finished blank. Child Run.
graphic.applyartwork map of placement name → uri on an existing garment. Design is not authored here. Child Run.
Manufacturing
techpack.exportCustom-garment handoff from Pattern + Construction. format: pdf | json | dxf. Optional run_id for measured POM. No layout knobs.
Cloth in space
space.simulateRecorded motion from a draped or presented Run. kind: flatlay | hanger | fold. No solver knobs.
space.videoEncode a recorded Motion to mp4. Does not invent in-between cloth.
Gate on the wire
A refused job is still a JSON-RPC result, not a protocol error. isError: true and structuredContent hold the gate payload.
{
"ok": false,
"gate": "cloth_self_intersections",
"phase": "arrange",
"counts": {},
"witnesses": [{"panels": ["right_sleeve", "right_sleeve"], "kind": "self"}],
"hint": "arrangement refused; revise pattern or construction"
}Then call pattern.revise / construction.revise. That loop is the harness. Walked example: revise_after_gate.