When a Massachusetts official attacked Sen. John F. Kerry in the media, Kerry's chief of staff called to rein him in. The conversation grew heated, and the official growled, "So I criticized your guy. What are you gonna do, spank me?"

Perhaps. As chief of staff for the Massachusetts senator and presumed Democratic presidential nominee, David McKean handles all stripes of assignments. Observers describe McKean as Kerry's "alter ego," and his "confidence man." McKean is so in tune with Kerry's instincts, aides say, he will play a "significant role" in choosing a vice presidential running mate. His own name has been floated as a potential White House chief of staff.

What's more, he's Kerry's distant cousin.

"He's the most intensely loyal person John Kerry has working with him who can deal with the nitty-gritty ugly realities of fierce partisan politics," said historian Douglas Brinkley, author of the Kerry biography "Tour of Duty." "If there's a problem that needs to be solved, John turns to David."

While Kerry runs for president, McKean is running his Senate office. He supervises 27 staffers in Washington, and 14 in Massachusetts. He is a behind-the-scenes guy, built slim as if to fit in the shadows.

Lately, though, he is stepping out, meeting with visitors who, in quieter times, would have seen the senator.

"I'm a substitute," McKean said, taking a seat in Kerry's cavernous office. He recently met here with Halliburton's vice president, who complained that Kerry had failed to portray the good work Halliburton was doing in Iraq, McKean said. Kerry has criticized the administration for awarding no-bid contracts to Halliburton in Iraq.

But basically, McKean said, his job is "being a traffic cop. You're at a big, busy intersection. So many things are coming at you at the same time."

Some of those things coming at him now involve the presidential campaign. For instance, dealing with Republican charges that Kerry is weak on national security. McKean said his office is compiling a "real record" of Kerry's Senate votes on defense. The 18-year record will prove that "John has a mainstream, thoughtful approach to defense," McKean said.

And when Kerry's campaign was in disarray last summer, he called McKean at midnight for advice.

Colleagues say McKean is a modern-day version of the influential advisers he has written books about. McKean recently published "Tommy the Cork: Washington's Ultimate Insider From Roosevelt to Reagan." (As advised by the Senate Ethics Committee, McKean did not include his boss's name on the book jacket, to avoid any appearance of using his government position for commercial purposes.) He also co-authored "Friends in High Places: The Rise and Fall of Clark Clifford."

"David is as good and as loyal as they come," said Kerry, who added jokingly: "As a friend, I'm thrilled for David that his books have done so well. As his employer, I keep worrying about where he finds all this time to write."

From 10 p.m. until midnight, McKean would retreat to his home office dubbed "the bunker," after putting his three children to bed.

"I think about how much time we've shared with 'Tommy the Cork,' " said McKean's wife, Kathleen Kaye. "He's been travel companion and dinner guest -- they do occupy your space."

These days the Kerry campaign occupies their space. "The kids have darkened every window of the house with 'John Kerry for President' posters," Kaye said.

Although they are fifth cousins -- their mothers are Winthrops -- McKean and Kerry did not meet until 1976. McKean's brother, who was running for commissioner in Essex County, Mass., held a fundraiser. Four people showed up. One was Kerry.

McKean has held a number of positions with Kerry, including legislative assistant on foreign policy and banking. He assisted Kerry with the investigation of the Bank of Credit and Commerce International (BCCI). McKean recalled Kerry's questioning of Clifford during the BCCI hearings:

"During a break I told John, 'Press him harder.' John said, 'I'm not going to humiliate him. He's an old man.' "

In 1999, while Kerry's staff was widely regarded as foundering, McKean took over as chief of staff. One of the first things McKean did was cut his own salary by about $30,000. He gathered the dispirited staff in the conference room.

"He said, 'This is not the David McKean ego show. I'm here to make sure things run smoothly,' " recalled former staffer David Kass.

McKean ended a long-running feud with the staff of senior Massachusetts Sen. Edward M. Kennedy (D). He made sure the right people were in the room when Kerry had a difficult decision to make. He scheduled an hour a day for Kerry's exercise, so his boss wouldn't get cranky.

Most important, he leveled with Kerry. "Every politician needs someone who can say, 'That's a bad idea,' " said Jack Blum, a former Senate Foreign Relations Committee counsel. "David can do that without upsetting Kerry."

He also gave Kerry perhaps the most valuable advice of his political career. After watching Kerry turn in a dour performance on "Meet the Press," McKean took him aside and said: "Smile."

David McKean is chief of staff for Sen. John F. Kerry, running the office as Kerry campaigns for president.