How to add text in a node in the example "Pipe"?

The node template in the Pipes sample, Pipes, consists of a Node Panel holding a Shape and a variable number of ports:

    Node, "Spot"
        Shape
        port
        port
        . . .

where each port is a Panel containing a Shape.

I suggest that you wrap that in another Spot Node Panel containing the above Panel and a TextBlock.

    Node, "Spot"  // new panel
        Panel, "Spot"  // old panel
            Shape
            port
            port
            . . .
        TextBlock

You’ll need to move some of the properties and Bindings that apply only to the Part and Node classes up to the new Node Panel, out of the old Node Panel.