A number of important issues raised by brazing technologies and recent wetting experiments with liquid metals on TiC and TiN are analyzed at the microscopic level, using first-principles density-functional computational experiments. The large variations of the wetting angles for Cu and Ag on TiC and TiN from experiment to experiment are connected of the relative contributions of different local atomic coordinations at the interface. The key factors in the structure dependence of Ag/Ti͑C,N͒ interface energetics are identified, such as the varying number of the metal-C͑N͒ bonds and the strength of metal-Ti bonding. Interface adhesion is shown to be improved by C͑N͒ vacancies, in agreement with observed better wettability of hypostoichiometric carbides. Based on Al/Ti͑C,N͒͑001͒ and Ti/Ti͑C,N͒͑001͒ simulations, the effects of Ti and Al interface segregation in the metal melt are estimated. The metal-C͑N͒ bonding across the Cu,Ag,Au/Ti͑C,N͒͑001͒ interfaces is similar to the metal-enhanced covalent bonding previously reported for Co/Ti͑C,N͒͑001͒ and Co/WC͑001͒. The systematics of the calculated work of separation correlates well with the noticeable variations of the charge-density values at the interface metal-C͑N͒ bonds.