Electrical single-line and multi-line diagrams: build, check (NF C 15-100, IEC 60364), draw, PDF.
io.github.uniwire-dev/uniwire — Model Context Protocol (MCP) Server
The MCP server provides functionality for creating electrical single-line and multi-line diagrams. It supports building and checking diagram content against standards NF C 15-100 and IEC 60364. It also enables diagram drawing and exporting to PDF.
🛠️ Key Features
Electrical single-line diagram support
Electrical multi-line diagram support
Build diagrams
Check compliance with NF C 15-100 and IEC 60364
Draw diagrams
Export diagrams to PDF
🚀 Use Cases
Verifying electrical diagrams against NF C 15-100
Verifying electrical diagrams against IEC 60364
Producing diagram outputs as PDF for documentation
Return the reference card of the uniwire format for electrical diagrams: document skeleton, node types
(breakers, RCDs, cables, loads, transformers, PV...) and their fields, enums, links, pitfalls, examples.
Read it once before writing a document; type_info gives the fields of one type in detail.
Parameters2
level
string
optional
'compact' (about 3k tokens) or 'full' (every field).
lang
string
optional
Language of the returned texts: 'en' (English) or 'fr' (French).
Raw schema
{
"type": "object",
"properties": {
"level": {
"default": "compact",
"description": "'compact' (about 3k tokens) or 'full' (every field).",
"title": "Level",
"type": "string"
},
"lang": {
"default": "en",
"description": "Language of the returned texts: 'en' (English) or 'fr' (French).",
"title": "Lang",
"type": "string"
}
},
"title": "get_reference_cardArguments"
}
list_types
List the node types of the format (type, category, label), optionally for one category. Use it to
find the type name of a device or load before writing a node; type_info then gives its fields.
Parameters2
category
any
optional
Only the types of this category: source, measure, protection, switching, control, converter, conductor, container, connector or load; default: all.
lang
string
optional
Language of the returned texts: 'en' (English) or 'fr' (French).
Raw schema
{
"type": "object",
"properties": {
"category": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Only the types of this category: source, measure, protection, switching, control, converter, conductor, container, connector or load; default: all.",
"title": "Category"
},
"lang": {
"default": "en",
"description": "Language of the returned texts: 'en' (English) or 'fr' (French).",
"title": "Lang",
"type": "string"
}
},
"title": "list_typesArguments"
}
type_info
Return every field of one node type with its description, unit and allowed values (enums). Use it
before writing or editing a node of that type; list_types gives the type names.
Parameters2
type
string
required
A node type name from list_types, e.g. 'breaker', 'rcd', 'socket'.
lang
string
optional
Language of the returned texts: 'en' (English) or 'fr' (French).
Raw schema
{
"type": "object",
"properties": {
"type": {
"description": "A node type name from list_types, e.g. 'breaker', 'rcd', 'socket'.",
"title": "Type",
"type": "string"
},
"lang": {
"default": "en",
"description": "Language of the returned texts: 'en' (English) or 'fr' (French).",
"title": "Lang",
"type": "string"
}
},
"required": [
"type"
],
"title": "type_infoArguments"
}
validate
Validate a uniwire document (electrical diagram as JSON) against the format only: structure, types,
ids, references and links, without the electrical rules (use check for those). Returns valid + issues,
each naming the node id and field when possible, plus viewer_url (the document in the uniwire web
editor) and pdf_url (the PDF drawn by uniwire).
Parameters1
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
}
},
"required": [
"document"
],
"title": "validateArguments"
}
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', French grid connection 'enedis',
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, 'scope' (what the
checks cover and do not cover: automatic checks of the document data, not a conformity certificate),
viewer_url (the document in the uniwire web editor: drawing, findings, downloads) and pdf_url (the PDF
drawn by uniwire).
Parameters2
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
profiles
any
optional
Rule profiles to apply, e.g. ['nfc15100', 'enedis'] (France) or ['iec60364']; default: the 'profiles' of the document. 'core' always applies.
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
},
"profiles": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"description": "Rule profiles to apply, e.g. ['nfc15100', 'enedis'] (France) or ['iec60364']; default: the 'profiles' of the document. 'core' always applies.",
"title": "Profiles"
}
},
"required": [
"document"
],
"title": "checkArguments"
}
describe
Return a 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 read a document and find
the node ids before apply_patch.
Parameters2
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
lang
string
optional
Language of the returned texts: 'en' (English) or 'fr' (French).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
},
"lang": {
"default": "en",
"description": "Language of the returned texts: 'en' (English) or 'fr' (French).",
"title": "Lang",
"type": "string"
}
},
"required": [
"document"
],
"title": "describeArguments"
}
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).
Parameters3
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
ops
any
required
The edit operations, applied in order (list, or its JSON text): see the description for the operation forms.
validate
boolean
optional
Validate the resulting document (default true).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
},
"ops": {
"anyOf": [
{
"items": {
"additionalProperties": true,
"type": "object"
},
"type": "array"
},
{
"type": "string"
}
],
"description": "The edit operations, applied in order (list, or its JSON text): see the description for the operation forms.",
"title": "Ops"
},
"validate": {
"default": true,
"description": "Validate the resulting document (default true).",
"title": "Validate",
"type": "boolean"
}
},
"required": [
"document",
"ops"
],
"title": "apply_patchArguments"
}
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 (the PDF drawn by uniwire) instead.
color: 'none' | 'conductors' | 'phase' | 'source' | 'status' | 'voltage' (adds a legend);
conductor_colors: 'iec' (IEC 60445) | 'us'.
Parameters8
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
kind
string
optional
'single-line' or 'multi-line' (one line per conductor).
format
string
optional
'svg' or 'pdf'.
sheet
any
optional
Only this sheet (numbered from 1); default: all.
view
any
optional
Id of a view of the document (its 'views' list); default: the first view of the requested kind.
path
any
optional
File to write the PDF to (local server only).
color
any
optional
Colouring: 'none', 'conductors', 'phase', 'source', 'status' or 'voltage' (adds a legend).
conductor_colors
any
optional
Conductor colour convention: 'iec' (IEC 60445) or 'us'.
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
},
"kind": {
"default": "single-line",
"description": "'single-line' or 'multi-line' (one line per conductor).",
"title": "Kind",
"type": "string"
},
"format": {
"default": "svg",
"description": "'svg' or 'pdf'.",
"title": "Format",
"type": "string"
},
"sheet": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"description": "Only this sheet (numbered from 1); default: all.",
"title": "Sheet"
},
"view": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Id of a view of the document (its 'views' list); default: the first view of the requested kind.",
"title": "View"
},
"path": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "File to write the PDF to (local server only).",
"title": "Path"
},
"color": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Colouring: 'none', 'conductors', 'phase', 'source', 'status' or 'voltage' (adds a legend).",
"title": "Color"
},
"conductor_colors": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Conductor colour convention: 'iec' (IEC 60445) or 'us'.",
"title": "Conductor Colors"
}
},
"required": [
"document"
],
"title": "renderArguments"
}
viewer_link
Links to a document: viewer_url opens it in the uniwire web editor (drawing, single-line and
multi-line, rule findings, PDF and SVG downloads, nothing to install); pdf_url is the PDF drawn by
uniwire. On the hosted server the document is kept 30 days so that the short links open it
(anyone with a link can open it); elsewhere it travels in the link (after '#') and is stored nowhere.
Parameters1
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
}
},
"required": [
"document"
],
"title": "viewer_linkArguments"
}
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.
Parameters3
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
what
string
optional
'markers' (one row per wire end, for label printers), 'wires' (wire list) or 'cables' (cable schedule).
view
any
optional
Id of a view of the document (its 'views' list); default: the first view of the requested kind.
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
},
"what": {
"default": "markers",
"description": "'markers' (one row per wire end, for label printers), 'wires' (wire list) or 'cables' (cable schedule).",
"title": "What",
"type": "string"
},
"view": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"description": "Id of a view of the document (its 'views' list); default: the first view of the requested kind.",
"title": "View"
}
},
"required": [
"document"
],
"title": "wiringArguments"
}
bom
Compute the bill of materials (nomenclature) of an electrical installation from its document: one row
per manufacturer / part number for the nodes with a product reference, then one row per kind of
equipment without a reference (type and main characteristics in 'spec', e.g. 'C16 1P+N') and per kind of
cable (total length in 'length_m'), with quantities and the reference designations involved. Use it to
prepare a quote or an order; wiring gives the wire list and cable schedule.
Parameters1
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
}
},
"required": [
"document"
],
"title": "bomArguments"
}
list_examples
List the 53 example installations (dwellings, shops, offices, workshops, PV, EV charging, UPS, MV/LV
substations, PLCs): name, title, language, profiles, earthing, system.
Return an example installation document by name. Use it as a starting point for a similar
installation, then edit it with apply_patch; list_examples gives the names.
Parameters1
name
string
required
Example name from list_examples, or its number prefix (e.g. '02').
Raw schema
{
"type": "object",
"properties": {
"name": {
"description": "Example name from list_examples, or its number prefix (e.g. '02').",
"title": "Name",
"type": "string"
}
},
"required": [
"name"
],
"title": "get_exampleArguments"
}
normalize
Return the resolved form of a document: templates ('use') applied, every node and link id assigned,
numbers in canonical form. Use it to read a document exactly as the rules and drawings see it, or to get
stable ids before apply_patch; it does not apply the electrical rules (see check).
Parameters1
document
any
required
The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).
Raw schema
{
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "string"
}
],
"description": "The uniwire document of the electrical installation: a JSON object, or its JSON text, as returned by get_example, apply_patch or normalize (a file path is accepted when the server runs locally).",
"title": "Document"
}
},
"required": [
"document"
],
"title": "normalizeArguments"
}
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.
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.
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), vde0100 (German installations),
iec60364 (cable current-carrying capacity), enedis (connection to the French public network), 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.
Drawings in English, French, German, Spanish, Portuguese, Italian, Dutch, Polish, Turkish, Croatian, Serbian,
Bosnian, Russian, Simplified Chinese and Japanese, 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 (in ChatGPT, the
uniwire plugin of the plugin directory); details in
LLM tools.
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.
bash
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:
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="AC"):
Breaker("-Q11", "C16", cable="3G1,5") >> Lighting("Lighting", points=6)
with RCD("-Q2", "40 A", "30 mA", type="A"):
Breaker("-Q21", "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.