I'm so not sure it was mean-spirited (as in targeted solely at Spock). McCoy was an equal opportunity curmudgeon who would even lash out at Kirk once in a while. The thing is, Kirk would snap back and put McCoy in his place. More than anything else in life, I think McCoy would've relished getting Spock into a true back-and-forth shouting argument over something. He'd get more and more frustrated as Spock maintained his composure. For McCoy, that's just not human. And, he knows it's in Spock. It became a challenge. At least that's my interpretation.