Skip to main content
Glama
electrician-calc-mcp

electrician-calc-mcp

README.md
# electrician-calc-mcp

Electrical wiring math as an MCP server: voltage drop in volts and percent with the smallest wire that stays under
3 %, wire and breaker size for a load by amps and distance (NEC 310.16 with derating, or IEC 60364-5-52), conduit fill
(how many THHN wires fit in EMT or PVC), NEC 314.16 box fill, and AWG ↔ mm² conversion. Copper or aluminum, DC,
single phase and three phase, AWG and feet or mm² and metres. Five read-only tools, no sign-in, nothing stored.

It is the calculator of the **[Electrician Calc](https://zhukovskyi.space/apps/electrician-calc/)** app by Dre Dev,
ported from Dart to Python and checked against the app's own test values. The same voltage drop calculator runs free
in the browser: [voltage drop calculator](https://zhukovskyi.space/calculators/electrical/voltage-drop-calculator.html).

- App: [Google Play](https://play.google.com/store/apps/details?id=com.andrii.electriccalc) ·
  [App Store](https://apps.apple.com/app/id6830185126) ·
  [zhukovskyi.space/apps/electrician-calc](https://zhukovskyi.space/apps/electrician-calc/)
- Server: `https://mcp.zhukovskyi.space/electrician-calc/mcp` (streamable HTTP)

## Tools

| Tool | Gives |
|---|---|
| `calculate_voltage_drop` | Drop in V and %, voltage at the load, I²R loss, smallest size within the limit, longest run for this wire, NEC ampacity check, drop at motor start; parallel runs |
| `size_wire_for_load` | Wire size and breaker for a load (A or kW) and one-way length: NEC 310.16 with ambient and bundling derating, 240.4(D), 125 % continuous loads, NM-B / UF / THHN / SER, 60/75 °C terminals; or IEC 60364-5-52 methods A1–E, PVC/XLPE, grouping. Says whether ampacity or voltage drop decided, and gives the ground (250.122) or PE size |
| `calculate_conduit_fill` | Fill % against Chapter 9 Table 1, how many more wires fit, max wires of one size (Annex C counts), smallest EMT or PVC 40 trade size; or any cable by diameter in mm |
| `calculate_box_fill` | NEC 314.16 volume allowances × volume per conductor against the box, room for more wires, smallest metal box |
| `convert_wire_size` | AWG → mm² (diameter, circular mils), mm² → AWG, kcmil → mm², aluminum ↔ copper by equal resistance |

All tools: `readOnlyHint: true`, `destructiveHint: false`, `openWorldHint: false`.

## Connect

**Claude (claude.ai, Desktop), ChatGPT (developer mode), Cursor, VS Code** — add a remote MCP server with the URL
`https://mcp.zhukovskyi.space/electrician-calc/mcp`, no authentication.

**Local (stdio):**

```bash
git clone https://github.com/andronaft/electrician-calc-mcp && cd electrician-calc-mcp
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
```

```json
{ "mcpServers": { "electrician-calc": { "command": "/path/to/electrician-calc-mcp/.venv/bin/python",
                                        "args": ["/path/to/electrician-calc-mcp/server.py", "--stdio"] } } }
```

Ask, for example: *"What size wire for a 50 A subpanel 130 ft away at 240 V?"* or
*"Voltage drop on 12 AWG copper, 20 A, 100 ft at 120 V — and what size keeps it under 3 %?"*

## Method

- Voltage drop, IEC 60364-5-52 Annex G: ΔU = b · (ρ · L / S · cos φ + x · L · sin φ) · I, b = 2 (DC, single phase)
  or √3 (three phase), x = 0.08 mΩ/m. ρ at operating temperature: 0.0225 Ω·mm²/m copper and 0.036 aluminum (IEC
  G.52.2), 1.25 × ρ20 for NEC, which equals the K-factor method (K = 12.9 Cu, 21.2 Al) within 0.5 %.
- NEC wire size (NFPA 70, 2023): breaker from 240.6(A), at 125 % for a continuous load (210.19(A)(1)); Table 310.16
  derated by Table 310.15(B)(1) (ambient) and 310.15(C)(1) (more than three current-carrying conductors), capped by
  the wire's and the terminals' column (NM-B at 60 °C, 334.80); 240.4(B) next size up and 240.4(D) small-conductor
  limits; EGC from Table 250.122, grown by 250.122(B) when the wire is upsized for drop.
- IEC wire size: Ib ≤ In ≤ Iz with Tables B.52.2–B.52.5 (method E from B.52.10–B.52.13), temperature factor B.52.14,
  grouping factor B.52.17 (copper); protective conductor by IEC 60364-5-54 Table 54.2. Ambient and grouping are read
  from the next table row up, as conservative as the table.
- Conduit fill: NEC Chapter 9 Table 1 (53 / 31 / 40 %), Table 4 (EMT, PVC Schedule 40), Table 5 (THHN/THWN-2) and
  Note 7 for wires of one size. Box fill: 314.16(B) allowances and Table 314.16(B)(1); boxes from Table 314.16(A).
- AWG: d = 0.127 mm × 92^((36 − n) / 39); 1 kcmil = 0.5067 mm².
- Checked against (see `tests/test_server.py`): the app's tests — 2.5 mm², 16 A, 25 m → 7.2 V; NEC K factor within
  0.5 %; 40 A range on NM-B, 60 ft → 8 AWG on 40 A with a 10 AWG ground; 50 A, 130 ft → 6 AWG with drop governing;
  continuous 48 A → 6 AWG on 60 A; IEC 30 A, B1, 40 °C, 3 circuits → 16 mm² on 32 A; all 130 cells of Annex C Table
  C.1 (THHN in EMT); three 10 AWG + one 12 AWG in 1/2" EMT → 25.2 %; 7 allowances × 2.25 in³ = 15.75 in³ — and the
  site's worked example (20 A on 12 AWG, 100 ft, 120 V → 7.94 V, 6.6 %, 8 AWG within 3 %).

Not covered here: run sections with different conditions, motor branch circuits (430), panel load calculations and
the other calculators of the app. Results are estimates for planning: the code edition your area has adopted, local
amendments, equipment terminal ratings and the inspector decide. Work on live circuits only if you are qualified to.

## Run and test

```bash
pip install -r requirements.txt
python server.py                  # http://127.0.0.1:8000/mcp
python server.py --stdio
python -m unittest discover tests   # 14 tests
```

Hosted with the other Dre Dev MCP servers in one process; `build_app()` is mounted at `/electrician-calc`.

## Licence

MIT for the code. Table values as published in NFPA 70 (NEC) 2023 and IEC 60364-5-52 / -5-54. Made by Andrii
Zhukovskyi ([Dre Dev](https://zhukovskyi.space/)).