ComfyUI Node

Mpi Packer

Cram five values of any type onto one wire and stop the spaghetti

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi Packer
  • any_1
  • any_2
  • any_3
  • any_4
  • any_5
  • pack

Here's the scenario: you've got an image, a seed, a float, and a boolean that all belong to one "thing" - and they currently travel across your graph as four unrelated wires that nothing else cares about. Mpi Packer bundles up to five values of any type into a single MPI_PACK wire, and Mpi Unpacker hands them back at the other end in the same order. It's the "context object" pattern from the node-plumbing playbook, done as a plain, no-frills pair of nodes.

It comes from ComfyUi-MpiNodes, Mad Pony Interactive's utility pack, and it's one of the genuinely useful ideas in there. The pack has a 10-slot sibling (MpiPacker10), and it nests - because a pack is just a list, you can drop a pack into another packer's slot.

How it works

A pack is literally a Python list. MpiPacker takes whatever lands in its five any_1any_5 inputs and returns [any_1, any_2, any_3, any_4, any_5] on one wire. The type system lets this happen because every socket is * (wildcard), so an IMAGE, a FLOAT, an INT, and a BOOLEAN happily share a wire. The source even reads the slots by name rather than by call order, so the packed order is always the slot order you see on the node.

MpiUnpacker is the return trip: it takes the pack input and emits the five values back on outputs any_1any_5. If a slot was empty at pack time, that unpacked output is an ExecutionBlocker - meaning anything downstream of that empty slot simply doesn't run. That's deliberate: a pack with a missing any_3 shouldn't silently feed None into a node that'll crash on it.

The inputs that matter

  • any_1any_5 - all optional, all *. Wire in whatever you're bundling; unconnected slots stay empty.
  • pack (output) - the MPI_PACK. One wire instead of five.
  • The matching Mpi Unpacker hands the values back.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

Restart, or ComfyUI Manager → search ComfyUi-MpiNodes. No pip deps, no models. AGPL-3.0 at current versions (MIT through 1.2.6).

Where it pays off

The classic use: a region of your workflow that deals with one subject - a bounding box, its seed, its strength - and you want to route that whole bundle through a switch or pass it to a subroutine without dragging five wires. Or the nesting trick: five packers into one packer carries 25 values on a single wire, which is absurd until it's exactly what keeps a big graph readable. The trade-off is legibility in the other direction - a packed wire hides what's inside, so name the node well. One aside: don't use packs to hide everything; reviewers and your future self need to see the data flow. Use them where the bundle is a real unit, not everywhere.

CategoryMpiNodes/Logic

Inputs (5)

NameTypeDefaultDescription
any_1opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.
any_2opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.
any_3opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.
any_4opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.
any_5opt*Any value. Unconnected slots come out of Mpi Unpacker blocked.

Outputs (1)

NameTypeDescription
packMPI_PACK