io.github.uniwire-dev/uniwire·Productivity

uniwire

Electrical single-line and multi-line diagrams: build, check (NF C 15-100, IEC 60364), draw, PDF.

Stars
0
Version
0.1.0
License
Apache-2.0
Review
Passed
Language
Python
Last commit
3h ago
Forks
0
Open issues
1
Registry update
Oct 13, 2026
caddiagram-as-codeelectricalelectrical-engineeringiec-60364json-schemamcpmcp-servernf-c-15-100one-line-diagrampythonsingle-line-diagram

Connect

remote
Terminal
$claude mcp add --transport http uniwire https://mcp.uniwire.sh/mcp

Headers

Nothing to configure — it works as is.

Security review

Review passed

Reviewed 1h ago.

tools
14 tools scanned
metadata
scanned

No findings.

Tools

14
  • get_reference_card

    Reference card of the uniwire format for electrical diagrams: document skeleton, node types (breakers, RCDs, cables, loads, transformers, PV...) and fields, enums, links, pitfalls, examples. Read it before writing a document. level: 'compact' (~3k tokens) or 'full'; lang: 'en' or 'fr'.

  • list_types

    List node types (type, category, label), optionally for one category: source, measure, protection, switching, control, converter, conductor, container, connector, load.

  • type_info

    All fields of a node type with descriptions and allowed values (enums).

  • validate

    Validate a uniwire document (electrical diagram as JSON: object, JSON text or file path) against the format. Returns valid + issues, each naming the node id and field when possible, plus viewer_url and pdf_url (links for the user). check does the same and also applies the electrical rules.

  • check

    Check an electrical installation (single-line diagram, panel, schéma unifilaire, tableau électrique): validates the document, then applies the rule profiles (NF C 15-100 'nfc15100', IEC 60364 'iec60364', PLC; default: the document's 'profiles'; 'core' always applies): breaker ratings against cable sections, RCDs, circuits per protection, selectivity... Returns findings (level error/warning/info, rule, node id, message, source), a summary, viewer_url (opens the document in the uniwire web editor: drawing, findings, downloads) and pdf_url (same, and downloads the PDF drawn by uniwire). Give both to the user as clickable links. 'scope' says what the checks cover: tell the user once that they are not a conformity certificate.

  • describe

    Text outline of an electrical diagram: installation, full tree of the panel with stable ids, ratings and cables, links, interlocks, boards and findings summary. Use it to review a document or find the ids for apply_patch.

  • apply_patch

    Edit an electrical diagram by node id (change a rating, add a circuit, move a load...) and return the new document. ops (applied in order): {"op":"set","id":ID,"path":"in_A","value":20} (null value removes; no id = document root, e.g. path "installation.earthing"); {"op":"add","parent":ID,"node":{...},"index":0} (or "at":"sources"); {"op":"remove","id":ID}; {"op":"move","id":ID,"parent":ID,"index":0}; {"op":"rename","id":ID,"new_id":NEW}; {"op":"link","link":{"kind":"control","from":ID,"to":ID}}; {"op":"unlink","id":LINK_ID} or {"op":"unlink","from":ID,"to":ID,"kind":K}. On failure returns ok=false and errors naming the failing op index (null = validation of the result).

  • render

    Draw the electrical diagram (schéma unifilaire / multifilaire). kind: 'single-line' or 'multi-line'; view: a view id of the document (e.g. a wire-marking view). format 'svg' returns the SVG text of every sheet (or of 'sheet', numbered from 1); 'pdf' writes to 'path' if given, else returns base64 (requires the uniwire[pdf] extra); on the hosted server it returns pdf_url instead. To give the user the PDF, give them pdf_url as a clickable link. color: 'none' | 'conductors' | 'phase' | 'source' | 'status' | 'voltage' (adds a legend); conductor_colors: 'iec' (IEC 60445) | 'us'.

  • viewer_link

    Links for the user: viewer_url opens the document in the uniwire web editor (drawing, single-line and multi-line, rule findings, PDF and SVG downloads, nothing to install); pdf_url opens it and downloads the PDF drawn by uniwire. The document travels in the link (after '#') and is stored nowhere. Give them to the user as clickable Markdown links.

  • wiring

    Wiring exports of an installation as rows with stable column names (repérage des fils, carnet de câbles): what='markers' (one row per wire end, for label printers), 'wires' (wire list) or 'cables' (cable schedule). Marks follow the wire_marking rules of the view (id), by default the first view that declares them.

  • bom

    Bill of materials of an electrical installation (nomenclature), grouped by manufacturer / part number (nodes with a product reference).

  • list_examples

    List the 52 example installations (dwellings, shops, offices, workshops, PV, EV charging, UPS, MV/LV substations, PLCs): name, title, language, profiles, earthing, system. Good starting points.

  • get_example

    Return an example installation document by name (or number prefix, e.g. '02'), to adapt to the user's project.

  • normalize

    Resolved document: templates applied, every id assigned, canonical numbers.

uniwire

Electrical diagrams, as code.

An open standard to describe electrical installations, and the reference Python library that validates them, checks them against rules and draws their single-line and multi-line diagrams.

CI PyPI Python License: Apache-2.0

You describe the installation (sources, protective devices, cables, loads, PLCs) in a *.uniwire.json file or in Python, and uniwire computes the drawings. No coordinates, no CAD file: a text file you can review and diff.

Features

  • Single-line and multi-line diagrams from the same document: the multi-line view derives every conductor (L1, L2, L3, N, PE, PEN) from the single-line data, with no extra input.
  • 53 node types: utility grid, transformers, generators, UPS, PV, batteries, inverters; breakers, RCDs, RCBOs, fuses, switch-disconnectors, contactors, motor starters, transfer switches, SPDs, protection relays, instrument transformers, insulation monitors; busbars, boards, terminal blocks; lighting, sockets, heating, motors, EV chargers, modular PLCs and more.
  • Tree + links: the power tree is the backbone; transfers, bus ties, infeeds, earthing, control, interlocks, trips, measurements and data buses are links. A terminal / connectivity-node graph is derived automatically, with CIM, IFC and IEC 61850 SCL mappings.
  • Closed typing and unit-suffixed fields: in_A, idn_mA, section_mm2, p_kW; unknown fields are errors (calibre instead of in_A is caught), extensions live in ext. Templates declare a device once.
  • Rule profiles: core (always), nfc15100 (French dwellings), iec60364 (cable current-carrying capacity), plus PLC consistency checks.
  • Bill of materials: structured product references (manufacturer, part number, range, accessories) on any node or PLC module, aggregated to CSV (uniwire bom).
  • Wire and cable marking: marking rules per view (manual, sequential, per potential, pattern), marks drawn on the multi-line diagram, and CSV exports: wire list (uniwire wires), wire marker list (uniwire markers), cable schedule (uniwire cables); uniwire marks --write freezes the marks.
  • Colour modes: conductors in their IEC 60445 or North-American colours, or colouring by phase, source, status or voltage level.
  • Sheets: paper size, sub-tree views, automatic sheet splitting with cross-references, circuit schedule, enclosure frames, title block, revisions and notes. SVG output is deterministic and diff-friendly; the multi-sheet PDF has clickable links between sheets.
  • English and French rendering, selected per document with meta.lang.
  • LLM tooling: a reference card generated from the model (uniwire card), a text outline with stable ids (uniwire describe), id-based edits (uniwire patch), an MCP server (uniwire-mcp, stdio) and a hosted MCP endpoint at https://mcp.uniwire.sh/mcp, plus llms.txt for assistants (full reference card included). Setup for ChatGPT, Claude, Cursor and VS Code: uniwire in your assistant; details in LLM tools.

Gallery

French house, TT, single-line diagram
French house, TT (NF C 15-100), single-line
German house, TN-C-S, multi-line diagram in conductor colours
German house, TN-C-S, multi-line in conductor colours
Office building main LV switchboard
Office building, main LV switchboard
MV/LV substation, 1000 kVA
MV/LV substation, 1000 kVA
Standby generator, automatic transfer switch, load shedding
Standby generator, ATS, load shedding
Motor control centre, multi-line diagram with wire marks
Motor control centre, multi-line with wire marks

All 52 examples are in examples/ and listed in the documentation; open any of them in the web viewer.

Install

pip install uniwire                 # validation, rules, SVG rendering, bill of materials, exports
pip install "uniwire[pdf]"          # + PDF output (reportlab)
pip install "uniwire[mcp]"          # + MCP server (uniwire-mcp)
pip install "uniwire[iec81346]"     # + optional IEC 81346-2 class table (separate CC BY-SA 4.0 data package)

Python 3.10 or later. The only required dependency is pydantic.

Quickstart

A document in JSON:

{
  "$schema": "https://uniwire.sh/schema/v1/uniwire.schema.json",
  "uniwire": "1.0.0",
  "profiles": ["nfc15100"],
  "meta": { "title": "Small house", "lang": "en" },
  "installation": { "earthing": "TT", "system": "1P+N", "un_V": 230 },
  "templates": { "C16": { "type": "breaker", "in_A": 16, "curve": "C" } },
  "sources": [
    { "type": "grid", "label": "Utility", "children": [
      { "type": "main_breaker", "ref": "-Q0", "range_A": "15-45", "in_A": 45, "idn_mA": 500, "selective": true,
        "children": [
          { "type": "rcd", "ref": "-Q1", "in_A": 40, "idn_mA": 30, "rcd_type": "A", "children": [
            { "type": "breaker", "ref": "-Q11", "use": "C16", "cable": { "cores": "3G", "section_mm2": 1.5 },
              "children": [ { "type": "lighting", "label": "Lighting", "points": 6 } ] },
            { "type": "breaker", "ref": "-Q12", "in_A": 20, "curve": "C", "cable": { "cores": "3G", "section_mm2": 2.5 },
              "children": [ { "type": "socket", "label": "Sockets", "points": 8 } ] }
          ] }
      ] }
    ] }
  ]
}

The tree is the power flow (source, protective devices, loads); whatever falls outside the tree (transfer switches, bus ties, control and data connections) goes in links.

uniwire validate house.uniwire.json                 # schema + integrity
uniwire check house.uniwire.json                    # rule profiles (exit code 1 on errors)
uniwire render house.uniwire.json                   # SVG sheets in out/house/
uniwire render house.uniwire.json -f pdf -o house.pdf
uniwire render house.uniwire.json --kind multi-line # multi-line power diagram
uniwire bom house.uniwire.json -o house.bom.csv     # bill of materials
uniwire wires house.uniwire.json                    # wire list (also: markers, cables, marks)
uniwire card                                        # reference card for assistants

The same installation in Python:

from uniwire.build import *

with Installation("Small house", earthing="TT", system="1P+N", un="230 V", profiles=["nfc15100"]) as inst:
    with Grid("Utility"), MainBreaker("-Q0", "15-45 A", idn="500 mA", selective=True):
        with RCD("-Q1", "40 A", "30 mA", type="A"):
            Breaker("-Q11", "C16", cable="3G1,5") >> Lighting("Lighting", points=6)
            Breaker("-Q12", "C20", cable="3G2,5 18 m") >> Socket("Sockets", points=8)

for finding in inst.check():
    print(finding)
inst.save("house.uniwire.json")
inst.render("house.pdf")

with makes an element the parent of everything created inside it, >> chains elements, ratings and cables are written the way they appear on drawings ("C16", "3G2,5 18 m"). See the code-first API and the Python API and CLI.

Roadmap

  • Terminals, terminal strips and wires: UEP-0001, a draft for format 2.0 (named ports, terminal strips, wires and cables as objects, potentials).
  • Control schematics: coils, auxiliary contacts with cross-references, terminal plans and wire numbers, built on named ports.
  • Exports: DXF drawings, pandapower networks for load-flow and short-circuit studies.

Ideas and format proposals are welcome: see CONTRIBUTING.md.

Contributing

Bug reports, examples, rules, symbols and translations are welcome. Read CONTRIBUTING.md (development setup, tests, uniwire Enhancement Proposals) and the Code of Conduct. Report security issues privately, see SECURITY.md.

Licences

  • Code, CLI and JSON Schema: Apache License 2.0.
  • Specification text: CC BY 4.0: implement it freely, in any software.
  • Optional data package uniwire-data-iec81346 (IEC 81346-2 class table): CC BY-SA 4.0, distributed separately (pip install "uniwire[iec81346]").

See NOTICE for third-party notices.

From the server's repository — third-party content, read it before running anything it suggests.

More in Productivity

Listing from the official MCP Registry · repository facts from GitHub, just now.