If you are born in a foreign country and your parents are US citizens, you have dual citizenship until you reach the age of majority. At that time you need to decide which country you desire to be a citizen of. I'm not sure if the rule applies if you are born on a US military base. If McCain was born in the Canal Zone, I believe that the rule would not apply, as it was American territory until recently.
At least this how I understood the rules worked back in my teens. I had several friends who were born overseas to US servicemen. The rules may have changed since then.