Mr. McCain promised on election night to “do all in my power to help” Mr. Obama.

Some historians say the two men could yet forge the strongest alliance between a president and his election rival since Wendell L. Willkie helped Franklin D. Roosevelt oppose isolationism in the 1940s.

But in his first weeks back in the Senate, Mr. McCain has been quintessentially unpredictable, at times offering quiet counsel to the White House, at others jabbing in all directions.

On some days, he seems bitter, more certain than ever that he could do a better job running the country than Mr. Obama.

“I have a record of bipartisan work within the Senate; he does not,” Mr. McCain said on Feb. 19 in an interview with a newspaper in Kingman, Ariz., criticizing the president for what he called a lack of bipartisanship on the stimulus plan.

There are also signs that he still harbors grudges from the 2008 presidential campaign.

In the debate over the stimulus bill, he did not mask his fury at the three Republicans who backed the Democrats, particularly Senator Susan Collins, of Maine, once a friend, who won re-election in November in part by distancing herself from Mr. McCain and his campaign tactics.