pcb-lens

v1.6.1
@intelligentelectron/pcb-lens Checked 8 hours ago Published 12 days ago

MCP server for IPC-2581 PCB layout analysis and review

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_pcb_metadata Design overview

Get a high-level overview of a PCB design file: file metadata, the layer stackup, design units, the board outline (its width, height and extent, and its edge and cutout contours), and the total component and net counts. Use this first to understand a design's size and layers before querying specific components or nets. For an Allegro .brd the layers are the copper layers, top to bottom, and drawingLayers lists every CLASS/SUBCLASS layer that holds lines, shapes or text (silkscreen, assembly, place bounds, keepouts, copper shapes...) with its item count; get_pcb_layer reads them.

ParameterTypeDescription
file *stringPath to an IPC-2581 XML file or an Allegro .brd file (Allegro 16.0 to 25.1)

get_pcb_component Component by refdes

Look up a single component by its exact reference designator (refdes). Returns its placement (position, rotation, layer), package and BOM details, the nets connected to each pin, and a summary of its pads (count and the distinct pad shapes). The refdes must match exactly; it is not a pattern. Set detail='full' to additionally get the exact coordinate of every pad (sampled for components with very many pads).

ParameterTypeDescription
file *stringPath to an IPC-2581 XML file or an Allegro .brd file (Allegro 16.0 to 25.1)
refdes *stringExact component reference designator (e.g., 'U5', 'C10', 'R22')
detailstringHow much to return. 'summary' (default) gives the pad count and distinct pad shapes. 'full' additionally returns the exact coordinate of each pad; components with very many pads are sampled. Use 'full…

get_pcb_net Nets by pattern

Look up nets in a PCB layout by name and inspect their connectivity and routing. Provide a net-name pattern (a regular expression); for each matching net you get the connected component pins (grouped by component), the layers the net uses, a per-layer routing summary (trace widths, number of routed segments, and total routed length), and a via summary (count per drill size). All distances are in microns. Copper that is filled as a pour or plane instead of drawn as a trace is reported as routed on its layer but without a width or length, so a net can be fully routed yet show no trace width. A n…

ParameterTypeDescription
file *stringPath to an IPC-2581 XML file or an Allegro .brd file (Allegro 16.0 to 25.1)
pattern *stringRegex pattern for net name (e.g., '^DDR_D0$', 'CLK', '^VCC_3V3$')
detailstringHow much to return. 'summary' (default) gives the per-layer routing summary and via counts. 'full' additionally returns exact geometry: every via coordinate and the full shape of each routed trace (it…

get_pcb_layer Items on a layer

List what is drawn on the layers of an Allegro .brd whose CLASS/SUBCLASS name matches a pattern: lines, rectangles, shapes (copper pours, keepouts, place bounds, soldermask openings, outlines) and text (refdes and value labels, pin numbers, notes). Layers are named as Allegro names them, e.g. 'BOARD_GEOMETRY/SILKSCREEN_TOP', 'PACKAGE_GEOMETRY/PLACE_BOUND_TOP', 'ETCH/TOP'; get_pcb_metadata lists the layers that hold items. The summary gives per-layer counts, filled area and extent. Set detail='full' for each item's geometry and text. Routed tracks and vias are reported by get_pcb_net.

ParameterTypeDescription
file *stringPath to an Allegro .brd file (Allegro 16.0 to 25.1)
layer *stringCase-insensitive regex on CLASS/SUBCLASS layer names (e.g. 'SILKSCREEN_TOP', '^PACKAGE_GEOMETRY/PLACE_BOUND', 'KEEPOUT')
detailstring'summary' (default) gives counts, filled area and extent per layer. 'full' adds every item's geometry and text, sampled across layers when there are very many.
refdesstringOnly items drawn by this component (exact refdes)
withinstringOnly items overlapping this box: 'minX,minY,maxX,maxY' in microns

get_pcb_footprint Footprint and padstack definitions

Look up footprint (package symbol) and padstack definitions of an Allegro .brd by name pattern. A footprint gives its kind, the components placed with it, its pin count, the padstacks its pins use, its extent and properties; detail='full' adds each pin's position, rotation and padstack in the footprint's own frame, and its template drawing (silkscreen, assembly, place bound). A padstack gives its drill, slot, plating and type (smd, through, blind/buried), the pad, antipad and thermal figure on each copper layer, the soldermask and pastemask openings, custom pad outlines and the drill symbol. g…

ParameterTypeDescription
file *stringPath to an Allegro .brd file (Allegro 16.0 to 25.1)
pattern *stringCase-insensitive regex on footprint and padstack names (e.g. '^SOIC', 'QFN48', 'VIA')
detailstring'summary' (default) describes each definition. 'full' adds footprint pins and template drawing, capped.

get_pcb_drc DRC markers and checks

Report the DRC markers an Allegro .brd holds from its last DRC run, counted by check (e.g. LINE_TO_LINE_SPACING, PACKAGE_PACKAGE), and how many DRC checks the board has on, off or in batch mode. Set detail='full' for each marker's position, layer, constraint set and the two objects in conflict (pins as REFDES.PIN, vias, tracks and shapes with their net and layer), and the list of checks that are on. Markers are what the last DRC run found; edits since then are not reflected.

ParameterTypeDescription
file *stringPath to an Allegro .brd file (Allegro 17.2 to 25.1)
checkstringOnly checks whose name matches this case-insensitive regex (e.g. 'SPACING', 'PACKAGE')
detailstring'summary' (default) gives counts. 'full' adds each marker (sampled across checks) and the checks that are on.

get_pcb_object Raw Allegro database objects

Look inside the binary database of an Allegro .brd, for data the other tools do not cover. Without arguments: every block type with Allegro's name and count, and the attachments (embedded files such as the last-save record, Constraint Manager archives, 3D models, DBDoctor logs). With 'type': the keys of the blocks of that type. With 'key': that block's words, each word that names another block or a string resolved, and the blocks whose words hold this key. With 'attachment': that attachment's text, decompressed when zlib. Use the named tools first; this is the backstop.

ParameterTypeDescription
file *stringPath to an Allegro .brd file (Allegro 16.0 to 25.1)
attachmentstringAn attachment name, e.g. 'ALLEGRO_DESIGN_WAS_LAST_SAVED'
keystringA block key, decimal or hex (e.g. '81234' or '0x13d52')
typestringA block type number, e.g. '0x1B' (nets) or '0x21'

get_constraints Layout constraints

Query layout constraints from a Cadence .tcfx file, a Constraint Manager .dcf file, or an Allegro .brd board (read directly, no Cadence install needed). Without a section name, returns an overview of all sections and object counts. With a section name, returns all constraint objects with their attributes, references, members and children. Common sections: PhysicalCSet, SpacingCSet, ElectricalCSet, NetClass, MatchGroup, DiffPair, Design (stackup), Region. A .brd also has Brd* sections decoded from its binary database (BrdPhysicalCSet, BrdNetClass, BrdNet, BrdStackup, ...): these are the board's…

ParameterTypeDescription
file *stringPath to a .tcfx, .dcf or .brd file
sectionstringSection name to query (e.g., 'PhysicalCSet', 'SpacingCSet'). Omit for overview.

export_cadence_ipc2581 Export .brd to IPC-2581

Export a Cadence Allegro .brd file to an IPC-2581 XML file, the format the other PCB query tools (get_pcb_metadata, get_pcb_component, get_pcb_net) read. Windows only, and requires a Cadence SPB installation (detected automatically).

ParameterTypeDescription
board *stringPath to Cadence Allegro .brd file
outputstringOutput path (without .xml extension — Cadence appends it). Defaults to <boardname>_ipc2581.xml next to the .brd
revisionstringIPC-2581 revision to write: "B" (1.03) or "C" (1.04, the default). Rev C carries the most layout detail; prefer it unless a downstream tool needs Rev B.

export_cadence_constraints Export .brd constraints to .tcfx

Export the design rules and constraints from a Cadence Allegro .brd file to a .tcfx file, which you can then read with get_constraints. Windows only, and requires a Cadence SPB installation (detected automatically).

ParameterTypeDescription
board *stringPath to Cadence Allegro .brd file
outputstringOutput .tcfx path. Defaults to <boardname>_constraints.tcfx next to the .brd