Lets make the assumption that we are genetically modifying a tree from currently existing stock into some sort of incredible creature. Also, we will assume that photosynthesis would be the main energy source. So lets talk about some adaptations that you would genetically engineer.
Regarding the principles of tree operation, the leaf photosynthesis would not be able to occur in the normal fashion, because carbon dioxide is normally taken in through the leaves through stomate. So your tree will need to get carbon dioxide from somwhere else, and also exhaust the created oxygen somewhere else (i.e. not to space). This means the leaves should be sealed against the vacuum of space, preferably with a clear waxy film like some leaves already have. The trunk would also be sealed, and it shouldn't be too hard to make the necessary adaptation to the bark to accomplish this.
So for getting carbon dioxide and exhausting oxygen, the answer would be the root system. The roots already grab minerals and water, now they would have to absorb carbon dioxide as well. The roots could also exhaust oxygen. The danger here is that oxygen is highly reactive with alot of things, and can start fires. So all this exchange needs to happen in the roots, but the roots must be in something...like a comet.
Fortunately, comets are more or less the perfect material for feeding a tree. Our tree needs carbon dioxide, water, and a nitrogen source. Fortunately those are three of the most common comet materials (nitrogen being in ammonia). Mix those into a slurry held together by gravity and so far so good. The problem is that those three materials (carbon dioxide, water, ammonia) are not all accessible liquids at standard pressures. But at about 50 bar and ~275 K, all three materials would be liquids. 50bar is 5 MPa which is a lot of pressure, but not unbearable. For example, this is below the sustainable compressive, shear, and tensile pressure limits for several common hardwoods like ash, hickory, and oak.
Now for heat, space is cold, but vacuum is a pretty good insulator. One of the advantages of the tree's thicket of leaves is that much of the energy radiated out from the leaves in the infrared spectrum will immediately strike other nearby leaves and so not act as a net heat loss to the tree. I don't have enough information and math to say that this is sufficient, but if we combine a waxy insulating film and convective heat transfer from other warmer parts of the tree, then it could be possible to keeping water liquid as it transfers to the leaves.
Also of note for reducing heat loss, some trees like the fever tree can photosynthesize in their bark, so that would probably be a useful adaptation and could reduce the number of leaves needed. I imagine a tree like this would produce a thin layer of leaves facing the sun, and a moderately dense network of photosynthesizing branches supporting them, like this acacia.
As far as people living in this tree....yeah. That's the big problem. I don't see any answer to your last question (other than being space hippies).