In the pursuit of ultrasmall electronic components, monolayer electronic devices have recently been fabricated using transition-metal dichalcogenides. Monolayers of these materials are semiconducting, but nanowires with stoichiometry MX (M = Mo or W, X = S or Se) have been predicted to be metallic. Such nanowires have been chemically synthesized. However, the controlled connection of individual nanowires to monolayers, an important step in creating a two-dimensional integrated circuit, has so far remained elusive. In this work, by steering a focused electron beam, we directly fabricate MX nanowires that are less than a nanometre in width and Y junctions that connect designated points within a transition-metal dichalcogenide monolayer. In situ electrical measurements demonstrate that these nanowires are metallic, so they may serve as interconnects in future flexible nanocircuits fabricated entirely from the same monolayer. Sequential atom-resolved Z-contrast images reveal that the nanowires rotate and flex continuously under momentum transfer from the electron beam, while maintaining their structural integrity. They therefore exhibit self-adaptive connections to the monolayer from which they are sculpted. We find that the nanowires remain conductive while undergoing severe mechanical deformations, thus showing promise for mechanically robust flexible electronics. Density functional theory calculations further confirm the metallicity of the nanowires and account for their beam-induced mechanical behaviour. These results show that direct patterning of one-dimensional conducting nanowires in two-dimensional semiconducting materials with nanometre precision is possible using electron-beam-based techniques.