Statistical mechanics of biomolecular condensates via cavity methods