Skip to main content
Glama
cadcraft-electrical-mcp

cadcraft-electrical-mcp

cadcraft-electrical-mcp

Servidor MCP para generar planos eléctricos industriales con Claude y CADCraft.

Describe tu máquina en lenguaje natural ("PLC S7-1200, HMI KTP400, switch Balluff, 4 electroválvulas SMC, gabinete Spacial 500×400...") y Claude produce el juego completo de planos:

  • Esquemas eléctricos: portada con índice, potencia AC, control y distribución 24 VDC con referencias cruzadas y espejo de contactos, y hojas de E/S del PLC.

  • Layout de gabinete y platina: a escala 1:1 en un DXF de fabricación (con perforaciones y cotas) y a escala reducida en el juego de planos. Usa tus modelos 2D reales del fabricante.

  • Red PROFINET / Ethernet / IO-Link: topología con puertos y cables.

  • Plano de borneras, BOM, lista de cables, lista de E/S y lista de red en XLSX/CSV.

  • Validación normativa: designaciones, conflictos de E/S y de puertos, referencias cruzadas, espacio de reserva y encimamientos en la platina.

Todo cumple un perfil normativo configurable:

  • IEC: IEC 81346, 60617, 61082-1 y 60204-1.

  • IEC legado: códigos de una letra (-K/-F/-Q).

  • NFPA 79: escalera horizontal JIC/ANSI.

Los planos se generan como DXF y CADCraft los publica en PDF multipágina, PNG y DWG, y los puede abrir en vivo en la aplicación de escritorio.

Las funcionalidades traen ejemplos de instrucciones, la arquitectura incluye una guía de "si falla X, revisa Y", y hay una página con las normas y la configuración.


Cómo funciona

Claude ──MCP (stdio)──> cadcraft-elec-mcp
                          │ proyecto .elec.yaml (fuente de verdad, versionable en git)
                          │ → generadores → DXF determinista (ezdxf)
                          └──> CADCraft: cadcraft-cli (PDF / PNG / DWG / DWG→DXF)
                                         cadcraft --control 7979 (abrir en la app viva)
  • CADCraft ya trae su propio MCP genérico (cadcraft-cli mcp) con primitivas de dibujo.

  • Este servidor agrega la capa eléctrica que CADCraft no tiene: dispositivos, potenciales, bornes, E/S, cables, símbolos IEC/NFPA, cajetín, normas y validación.

  • El dibujo se hace en Python (ezdxf) en lugar de comando por comando en CADCraft (pre-alfa). Así el resultado es reproducible y probado, y CADCraft se usa para lo que hace mejor: renderizar, publicar y visualizar.

Related MCP server: THE_Studio5000_AI_Assistant_V35

Requisitos

  • Windows 10/11.

  • CADCraft 0.18 o superior (cadcraft-0.18.0-windows-x64.msi).

  • Una de estas dos opciones:

    • el ejecutable cadcraft-elec-mcp.exe de la página de Releases (no requiere Python);

    • Python 3.11 o superior (con uv o pipx).

Instalación para el equipo

Opción A: script automático (recomendada)

git clone https://github.com/alfresonico666/cadcraft-electrical-mcp
cd cadcraft-electrical-mcp
powershell -ExecutionPolicy Bypass -File scripts\install.ps1

El script:

  1. Crea un entorno en %LOCALAPPDATA%\cadcraft-elec-mcp e instala el paquete.

  2. Registra el servidor en Claude Code (alcance de usuario) y en Claude Desktop.

  3. Opcionalmente registra también el MCP nativo de CADCraft (-WithCadcraftMcp).

Al final ejecuta doctor para comprobar que todo responde.

Opción B: manual

# con uv
uv tool install git+https://github.com/alfresonico666/cadcraft-electrical-mcp
# o con pipx
pipx install git+https://github.com/alfresonico666/cadcraft-electrical-mcp

cadcraft-elec-mcp doctor            # verifica CADCraft y la configuración
claude mcp add --scope user cadcraft-elec -- cadcraft-elec-mcp

En Claude Desktop, agrega esto a %APPDATA%\Claude\claude_desktop_config.json:

{ "mcpServers": { "cadcraft-elec": { "command": "cadcraft-elec-mcp", "args": [] } } }

Con el .exe de Releases, usa la ruta completa del ejecutable como command.

Uso rápido

En Claude Code o Claude Desktop:

Crea el proyecto 26HA076 "Máquina LVDT" para un cliente automotriz con perfil IEC. Agrega un S7-1200 1214C DC/DC/DC, una HMI KTP400, una fuente de 24 VDC 10 A con su magnetotérmico, 4 electroválvulas SMC SY7320 en las salidas Q0.0–Q0.3 y 4 sensores inductivos en I0.0–I0.3 pasando por la bornera -XD3. Genera las hojas de potencia, 24 VDC, E/S y red, configura el gabinete NSYCRN54250P, valida y construye el PDF. Muéstrame la hoja de E/S.

Claude seguirá este flujo:

  1. project_create

  2. library_search y device_add

  3. sheet_add

  4. plc_io_assign y terminals_assign_io

  5. network_link

  6. cabinet_configure

  7. validate y build

  8. sheet_preview

Los archivos quedan en Documentos\CadElec\<proyecto>\output\:

Archivo

Contenido

<código> - Planos Electricos.dxf / .pdf / .dwg

juego completo de hojas

<código> - Platina Electrica.dxf

platina 1:1 para taller (perforaciones, cotas)

<código> - Listas.xlsx + csv/

BOM, cables, bornes, E/S, red

preview/hoja-NN.png

vistas previas

Para ver el resultado en CADCraft: "ábrelo en CADCraft" (herramienta cadcraft_open).

Usar tus modelos 2D del fabricante

Importa C:\...\Modelos\Siemens - PLC\PLC_Terminales.dxf como modelo del catálogo siemens-6es7214-1ag40-0xb0.

library_import_model hace lo siguiente:

  • convierte DWG a DXF con CADCraft;

  • quita ATTDEF de CADENAS, puntos de conexión y cotas;

  • normaliza a mm con la esquina en 0,0;

  • registra el modelo en tu catálogo.

Desde entonces, la platina dibuja el equipo real. Los modelos no se suben al repositorio (licencias de los fabricantes).

Ejemplo completo

examples/build_26ha076.py reproduce el proyecto 26HA076 completo (8 hojas):

python examples\build_26ha076.py --workspace C:\temp\CadElec --models "C:\...\26HA076\Modelos"

Desarrollo

python -m venv .venv; .venv\Scripts\activate
pip install -e ".[dev]"
ruff check src tests; mypy; pytest            # las pruebas de integración se omiten si no hay CADCraft
pyinstaller packaging\cadcraft-elec-mcp.spec  # genera dist\cadcraft-elec-mcp.exe

Hay CI en GitHub Actions (Windows) con lint, tipos y pruebas. Al crear un tag v* se publica el .exe en Releases.

Solución de problemas

Síntoma

Causa / solución

cadcraft_not_installed

Instala CADCraft o define cadcraft_cli en config.toml (configuración).

cadcraft_connection al abrir en vivo

La app no tiene puerto de control. cadcraft_open la lanza sola; si no, abre cadcraft --control 7979.

pip install falla descargando mcp (InvalidChunkLength)

Proxy o red corporativa. Usa el .exe de Releases o pip install https://files.pythonhosted.org/.../mcp-2.3.0-py3-none-any.whl.

Un equipo sale como rectángulo en la platina

No tiene modelo. Impórtalo con library_import_model o da width_mm/height_mm reales.

cabinet_fit reporta equipos sin colocar

La placa es chica: más placa, canaletas más delgadas (duct_width) o menos equipos por riel.

Los registros quedan en Documentos\CadElec\logs\cadcraft-elec-mcp.log.

Licencia

Apache-2.0. CADCraft es © storytold, Apache-2.0/MIT. Este proyecto no incluye modelos CAD de terceros.

Available Tools

41 tools
buildA

Generate the drawing set: DXF (all sheets), multi-page PDF (via CADCraft), optional DWG, the 1:1 fabrication DXF of the back plate, XLSX/CSV lists and PNG previews of the sheet numbers in previews. Returns file paths, page list and a validation summary.

Inputs: dwg, pdf, reports, previews, +1 more. Returns: object

cabinet_configureB

Configure the enclosure and mounting plate (mm). Defaults: 400x500x250 enclosure, 350x450 plate, 40x60 wire ducts, 10 mm duct clearance, 20 % spare rail length.

Inputs: device_gap, duct_depth, duct_width, plate_width, +10 more. Returns: object

cabinet_placeB

Place a device manually (lower-left corner, plate coordinates, mm). Omit x/y to return to auto.

Inputs: tag (required), x, y. Returns: object

cabinet_planA
Read-onlyIdempotent

Compute the back-plate layout without drawing: device positions, rails, fill %, warnings.

Inputs: no named parameters. Returns: object

cabinet_railsA

Fix which devices go on each DIN rail, top to bottom, left to right (e.g. [["-QB1","-FC1"], ["-KF1","-TB1"]]). An empty list returns to automatic filling.

Inputs: rails (required). Returns: object

cadcraft_executeB

Escape hatch: run any CADCraft engine command in the running app (e.g. 'zoom', 'layer.set'). Needs the desktop app started with --control. Prefer the domain tools for drawing content.

Inputs: command (required), params.

cadcraft_openA

Open a file in the CADCraft desktop app (launches cadcraft --control <port> if needed). Without path: which='drawings' (sheet set DXF) or 'cabinet' (1:1 plate DXF) of the last build.

Inputs: path, which. Returns: object

cadcraft_statusB
Read-onlyIdempotent

CADCraft installation, version and whether the desktop app control port is reachable.

Inputs: no named parameters. Returns: object

device_addA

Add one or more devices. Give catalog_id (see library_search) or at least kind.

Tags are auto-assigned from the profile letter code when omitted (-QA1, -KF2 ... or CR1, M1 in NFPA). Use mount='field' for devices outside the cabinet, 'door' for door-mounted ones. A terminal_strip device also creates its (empty) strip.

Inputs: items (required). Returns: result

device_listB
Read-onlyIdempotent

List project devices (optionally of one kind).

Inputs: kind. Returns: result

device_removeA
Destructive

Remove a device. Fails if it is referenced unless force=true (then references are removed too).

Inputs: tag (required), force. Returns: object

device_updateC

Change device data. Renaming (new_tag) updates all references (sheets, I/O, network, cabinet).

Inputs: tag (required), data, mount, ports, +9 more. Returns: object

library_import_modelA

Clean a vendor 2D model (DXF or DWG front view) into a 1:1 mm block and add it to your catalog.

Removes CADENAS ATTDEFs, connection points and (by default) dimensions, converts DWG through CADCraft, moves the lower-left corner to 0,0. Use target_width_mm (real device width) when the file is not drawn in mm. The cleaned DXF goes to /library.

Inputs: catalog_id (required), source_path (required), kind, mount, +8 more. Returns: object

network_listC
Read-onlyIdempotent

List network links.

Inputs: no named parameters. Returns: result

plc_io_assignA

Assign PLC channels to field devices. Address (%I0.0, %Q0.0, %IW64) and module terminal (DIa.0, DQa.0 ... from the catalog) are auto-assigned when omitted; channel count is checked against the catalog.

Inputs: plc (required), channels (required). Returns: result

plc_io_listB
Read-onlyIdempotent

List I/O assignments (optionally of one PLC).

Inputs: plc. Returns: result

plc_io_removeC
Destructive

Remove one I/O channel assignment.

Inputs: plc (required), address (required). Returns: object

potential_setB

Declare a potential (rail): e.g. name='24V' kind='dc_plus', or 'L1_CTRL' kind='ac_control'.

The kind decides the conductor colour on drawings and lists.

Inputs: kind (required), name (required), source, voltage. Returns: result

project_createB

Create a new electrical project and make it the active one.

profile: 'iec' (IEC 81346-2:2019 two-letter codes, vertical paths, A3), 'iec_legacy' (single-letter -K/-F/-Q codes) or 'nfpa' (NFPA 79 ladder, ANSI B). Standard potentials L1 L2 L3 N PE 24V 0V are pre-declared. The project is saved as .elec.yaml in the workspace (or in directory).

Inputs: project_code (required), plant, author, client, +9 more. Returns: object

project_infoA
Read-onlyIdempotent

Summary of the active project: title-block data, counts, potentials, sheets, cabinet.

Inputs: no named parameters. Returns: object

project_listA
Read-onlyIdempotent

List the projects found in the workspace folder.

Inputs: no named parameters. Returns: result

project_openB

Open an existing project by code (from the workspace) or by the full path of its .elec.yaml.

Inputs: code_or_path (required). Returns: object

project_updateB

Update title-block fields and/or switch the standards profile (iec / iec_legacy / nfpa).

Inputs: date, plant, author, client, +7 more. Returns: object

reportsB

Export BOM, wire list, terminal list, PLC I/O list and network list to XLSX (+ CSV).

Inputs: csv. Returns: object

sheet_addA

Add a sheet definition. Kinds:

  • power / control: list of current paths. Each path: supply rails (one per pole, e.g. ['L1','L2','L3'] or ['24V']), series elements [{device, symbol?, terminals?, label?}], optional return_rail ('0V', 'N') and pe. Symbols/terminals default from the device kind (coil A1-A2, contacts 13-14/21-22..., poles 1-2/3-4/5-6). Use symbol 'contact_no'/'contact_nc' to draw a relay/contactor contact; cross references are automatic. Long sheets paginate.

  • plc_io: plc tag (+ optional io_kinds); draws every channel assigned with plc_io_assign.

  • network: topology of all network links. * cover / terminal_plan / cabinet_layout: automatic.

Inputs: kind (required), title (required), plc, note, +4 more. Returns: object

sheet_add_pathsC

Append current paths to an existing power/control sheet.

Inputs: paths (required), sheet_id (required). Returns: object

sheet_getC
Read-onlyIdempotent

Full definition of one sheet.

Inputs: sheet_id (required). Returns: object

sheet_moveB

Move a sheet to a 1-based position in the set (cover stays first, terminal/cabinet sheets last).

Inputs: position (required), sheet_id (required). Returns: result

sheet_previewA

Render one sheet (1-based page number) to PNG with CADCraft and return the image to inspect.

Inputs: number (required).

sheet_removeC
Destructive

Delete a sheet definition.

Inputs: sheet_id (required). Returns: object

sheet_updateC

Replace fields of a sheet (giving paths replaces all its paths).

Inputs: sheet_id (required), plc, note, paths, +2 more. Returns: object

standards_infoB
Read-onlyIdempotent

Rules of a standards profile: letter codes per device kind, wire colours, sheet format, text heights, terminal marking, available profiles and validation rules.

Inputs: profile. Returns: object

symbols_listB
Read-onlyIdempotent

Symbols available for current-path elements (use the id in PathElement.symbol).

Inputs: style. Returns: result

terminals_addA

Add terminals to a strip (created when missing; tag auto -XD1.. if omitted). Either count consecutive numbers or explicit numbers. Mark protective-earth terminals with pe=true.

Inputs: pe, count, strip, numbers, +2 more. Returns: object

terminals_assign_ioB

Route every field-mounted I/O device through its own terminal on strip (drawn on the I/O sheets and listed in the terminal plan).

Inputs: plc, strip, description. Returns: object

terminals_listC
Read-onlyIdempotent

Terminal strips with their terminals.

Inputs: no named parameters. Returns: result

terminals_removeB
Destructive

Remove one terminal, e.g. '-XD2:5'.

Inputs: ref (required). Returns: object

validateA
Read-onlyIdempotent

Check the project against the standards profile and consistency rules (designations, I/O, ports, terminals, cross references, cabinet fit/spare space ...).

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 41 tools

    Disambiguation4/5

    Most tools have clearly distinct resource/action boundaries across projects, devices, sheets, I/O, terminals, network, cabinet, and library domains. There is some overlap between reports and build (both can emit XLSX/CSV lists), between sheet_add_paths and sheet_update, and between project_open and cadcraft_open, but descriptions mostly clarify the intended use.

    Naming Consistency4/5

    The dominant convention is a predictable resource_action pattern (device_add, project_create, sheet_remove, plc_io_assign, terminals_list, network_link, cabinet_plan). A few tools deviate with bare verbs or nouns (reports, build, validate) and the cadcraft_ namespace, but the overall scheme is readable and consistent.

    Tool Count2/5

    At 41 tools the surface is heavy for an MCP server, even for a broad electrical CAD domain. Many operations are genuinely distinct, but the count exceeds the 25-tool threshold and increases selection burden.

    Completeness4/5

    The surface covers the full engineering lifecycle: project/device/sheet CRUD, PLC I/O, terminals, networking, cabinet layout, validation, previews, reports, and build outputs. Only minor gaps exist, such as no project delete/archive, no potential listing/removal, and no dedicated device_get beyond device_list.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an LLM agent to assemble, wire, run, fault and observe electromechanical motor-control circuits through 26 tools covering component placement, terminal connections, button/switch operation, fault injection, and simulation control. Also lets agents load and save circuits and generate PDF drawing sets, screenshots and scripted demo videos.
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to create, edit, validate, and read back production-grade CAD drawings — including P&ID sheets, mechanical parts and assemblies, and architectural floor plans with measured areas and schedules — through a single typed tool contract that runs either live via COM on Windows or headlessly via ezdxf anywhere. It also supports standards-aware dimensioning, ISO GD&T and tolerance checks, takeoff workbooks, and drawing understanding, diffing, and critique.
      -