An interesting, by-the-numbers take on McCain from Brendan Nyhan:

A friend points out that the book Ideology and Congress by Keith Poole and Howard Rosenthal, the two authors of the most widely used estimates of the ideal points of members of Congress, can help square the circle on McCain to some extent.
On pages 2-3, they note that their algorithm tends to place McCain as highly conservative but that his voting record is especially inconsistent, causing the predictive accuracy of their estimates to be the lowest of all the members of the Senate during the sessions in which he has served (i.e. “the worst fitting”):
… John McCain (R-AZ), normally one of the very most conservative members of the Senate, has been the worst fitting member of the Senate in each of his eight Senates, most notably the 103rd (2001-02), where he frequently voted with the Democrats, perhaps in pique over losing the race for the presidential nomination in 2000. … John McCain (R-AZ) started as a conservative, became a moderate after losing the Republican nomination to George Bush in 2000, and recently reemerged as very conservative. McCain is an exception…