All Steve Duprey wanted to do was make John McCain laugh. Riding on his campaign plane last June, the candidate was feeling low. The day before, he'd flubbed the delivery of a major speech in New Orleans and was being lampooned on the cable shows. So Duprey, McCain's close friend, informal adviser and faithful traveling buddy, got up from his seat and began handing out candy to campaign aides. Soon everyone aboard was cracking up: Duprey was decked out in a skimpy rainbow bikini—or, rather, a T shirt painted to look like one, front and, ahem, back. He'd picked up the shirt near Bourbon Street the night before, figuring the sight of a nearly bald 54-year-old guy dolled up like some kind of tragic "Baywatch" extra might just lift McCain's mood. He was right. McCain, perched in his usual spot up front, rolled his eyes and shook his head, a wide grin on his face.

Duprey, a New Hampshire real-estate developer who's been in Republican politics for decades, never thought he'd spend a year traveling almost full time with the GOP nominee. A former New Hampshire state-party chairman, he began advising McCain back in 2006 and stuck close to his friend of two decades, even when his campaign nearly went belly up last year. Duprey ferried McCain around in his own Chevy Suburban, driving him to town halls and events all over New Hampshire. After McCain won the primary there, the senator and his aides invited Duprey to stay on for the ride. In the months since, he's evolved into the campaign's "chief morale officer," as he describes it. "I try to bring a little levity to the situation and make sure that, to the degree we can, we're enjoying this campaign."

No one is having more fun than Duprey himself. Known to campaign aides as the "Sultan of Swag," he travels with a huge stash of corny McCain-themed shirts, hats and jackets, which he designs and pays for out of pocket and gives away to aides and volunteers. Last month, he had the thrill of giving a prized TEAM KALEEFORNIA baseball cap to Gov. Arnold Schwarzenegger.

Years ago, Duprey was something of a maverick contender himself. In 1972, just after he turned 19, he ran for a seat in the New Hampshire State Legislature and won. At the time he was a college student working part-time as a bartender. He was the youngest elected lawmaker in the state's history, and worked on term papers from his seat during legislative debates. Duprey ultimately served two terms before heading to Cornell Law School. He worked for a while at a law firm, then got into building hotels and rehabbing old buildings in downtown Concord. A low moment came when Duprey's company was fined for mortgage fraud. (He says he did nothing wrong and was not personally charged.)

All along, Duprey stayed involved in Republican politics. He met McCain through Sen. Phil Gramm, who was campaigning in New Hampshire. Duprey says he and McCain spent a memorable evening making jokes at a snooty GOP party. "We both shared this sort of irreverent sense of humor at what was normally a stuffy social function," he recalls. In 1992 Duprey ran for Congress and lost, but was elected the following year as chairman of the New Hampshire GOP—a post he held for nearly a decade.

Though Duprey describes himself as "the guy who wears silly T shirts," he's clearly important to McCain. Aides say the candidate often turns to Duprey for an "average Joe" perspective on how the campaign is going. When McCain's day-to-day campaign manager Steve Schmidt recently brought on several former White House staffers to help run the show, McCain made it clear that Duprey was to remain at his side, no matter what. "He's become the indispensable man," says McCain.

Lately, Duprey has started to expand his selection of McCain apparel. He now has a catalog of his offerings, which include buttons, McCain flip-flops—"sandals," he insists—a beach ball and McCain logo sunscreen. (A skin-cancer survivor, McCain often lectures his staff and reporters about protecting themselves from the sun.) Last week, McCain aide Mark Salter paraded through the press cabin with another Duprey product: a shirt with the word DUEL? on the front and TOWN HALL. HIGH NOON. ANYWHERE. on the back. It was a poke at Obama's comments a few days before that he was prepared to "duel" McCain on taxes. "I thought it was quite clever," says Duprey, who admits to spending a significant amount of time coming up with new designs and slogans. "What can I say? It's a sign of an underactive and overutilized mind."