What would a Republican Party more in the mold of John McCain look like?

It would, for starters, stop cowing to Trump and stand up for American national security. It would investigate Russian cyberattacks and the possibility, as McCain put it, “that the president of the United States might be vulnerable to Russian extortion.” Many of McCain’s colleagues remembering him as a brave patriot are proving themselves to be neither.

Second, a more McCain-like Republican Party would understand that racism is both immoral and, in the long term, politically ruinous. McCain had a multiracial family — the kind that is increasingly America’s future. Rather than scapegoat immigrants, he took risks to pass immigration reform. After Charlottesville, he declared, “White supremacists aren’t patriots, they’re traitors.”

Third, McCain believed in democracy and its vital, fragile institutions. He accepted his two haunting presidential defeats honorably. He has reportedly chosen the victors in those campaigns — Obama and George W. Bush — to deliver eulogies at his funeral. Most significantly, McCain fought for campaign-finance laws to reduce the influence of plutocrats.

Fourth, McCain understood that democracy sometimes means moving on. He voted against Obamacare — a reflection of his small-government conservatism. But he also voted, crucially, against its repeal — a reflection of his small-c conservatism. In doing so, he acted as a modern-day Eisenhower, a Republican willing to accept an expansion of the safety net for the good of the country.

Finally, McCain recognized that the military wasn’t the only way that Washington could use its awesome power for good. When I interviewed him during the 2008 presidential campaign, he described his economic hero as Theodore Roosevelt — a “free-enterprise, capitalist, full-bore guy” who realized that prosperity depended on government agencies “that need to do their job as well.” The outlook led him to favor policies (albeit too sporadically) to fight climate change and expand community colleges.

Imagine how different our politics could be if even some Republicans — à la T.R. — occasionally took the side of the little guy against corporate behemoths. And even if you disagreed with McCain on as many issues as I did, imagine if the Republican Party ultimately came to resemble him more than Trump.

Above all, McCain believed in American greatness — as a reality, not a slogan. He knew that the United States could play a unique role in the world, as a defender of freedom and human dignity. He also knew that the role was anything but assured. It required hard work, good choices, compromise and sacrifice.

McCain’s final message for his country was a warning: Our greatness is in peril.

Follow The New York Times Opinion section on Facebook and Twitter (@NYTopinion), and sign up for the Opinion Today newsletter.