McCoy stood less than a foot away from Arne Darvin and took a tricorder scan of the guy. That's how he knew that Darvin was a Klingon. His heartbeat and body temperature among other things didn't add up and look human. Darvin had been surgically altered to look human but internally he was still a run of the mill Klingon, and those scans were recorded on McCoy's tricorder and those scans were entered into Kirk's logs concerning the Sherman's Planet sabotage incident. Somebody somewhere knew about Klingon anatomy, and that was decades before Enterprise finally told the backstory of Klingon first contact.
I love Trek and for a franchise that's almost half a century old and has about 800 television episodes and big-budget theatrical films penned by a horde of different writers it's remarkably consistent, but there are times it makes as much sense as a screen door on a submarine.
How do we know the tricorder didn't flash the word "Klingon" in bright red letters on its screen.
True, but then someone would have to have had a knowledge of Klingon anatomy to program it to say that. Either way, it should have been common knowledge, especially for a surgeon of McCoy's caliber.