There's no way to get enough protein, fats, and carbs, but not enough calories.
Protein, fats, and carbs ARE energy producing. They produce a constant amount of energy each:
1g Protein = 4 calories
1g Fat = 9 calories
1g Carbohydrates = 4 calories
So if you're getting "not enough calories" then it's because you're not getting enough protein, fat, and carbohydrates.
For muscle growth, you'll want lots of calories from protein so that those calories are stored as muscle. With excess carbs and fat, it's more likely to be stored as body fat. If you're burning as many calories as you ingest, NONE of those nutrients are going to be stored (as fat OR as muscle). So you want to get excess calories from protein that will be converted into muscle.