Rudy Giuliani is getting impatient.

“Put up or shut up,” the former New York City mayor tweeted last week in a direct challenge to special counsel Robert Mueller.

Mueller’s team has been investigating Giuliani’s client, President Trump, since May 2017 — that’s 19 months and counting — and has spent more than $25 million in the process.

In that time, Mueller has scored six guilty pleas and one conviction, plus indictments of 26 Russian nationals and three Russian companies.

But none of Trump’s associates has yet been charged with colluding with Russia to influence the 2016 election in Trump’s favor — the purported offense that sparked Mueller’s effort.

And Trump has insisted on his innocence. “The Russian Collusion fabrication is the greatest Hoax in the history of American politics,” he declared Dec. 19.

It all seems so unprecedented. And yet, America has seen it all before.

Special-counsel investigations into presidents and their associates go back nearly 150 years, to the Reconstruction era in the decade after the Civil War.

In “Prosecuting the President” (Oxford University Press), out next week, University of Arizona law professor Andrew Coan traces three of the earliest cases — and points out their sometimes startling similarities to Trump’s legal woes.

A “witch hunt”: St. Louis Whiskey Ring (1875-1876)

President Ulysses S. Grant’s top adviser, Gen. Orville Babcock, was central to a massive corruption scheme that saw federal agents in six cities help liquor distillers dodge millions in taxes — but Grant refused to believe it.

Grant had named former GOP Sen. John B. Henderson as the nation’s first special prosecutor to oversee the case against the conspirators in 1875. But as Henderson won 110 convictions and traced the conspiracy to the White House’s doorstep, Grant became convinced he was running what a later Republican president would call a “witch hunt.”

Just before Babcock’s February 1876 trial, a furious Grant fired Henderson and replaced him with a more pliable prosecutor.

Grant sat for a deposition on Babcock’s behalf, winning his aide’s acquittal — the only time a sitting US president has testified for a defendant in a federal criminal prosecution.

A “rigged election”: Teapot Dome (1924-1929)

Mueller is not the first special counsel to probe accusations that a president had been “bought” by nefarious interests.

In April 1922, rumors spread that President Warren G. Harding’s secretary of the interior, Albert Fall, was taking payoffs from oil companies. Two years later, congressional investigators uncovered hints that oil barons had schemed with Harry Daugherty, Harding’s attorney general, to swing the 1920 presidential election in the Republican’s favor, and a conspirator admitted to paying Fall $100,000 for a $4 billion federal oil lease.

By that point, Harding had conveniently died of a heart attack while in office. Hoping to distance himself from the scandal, new President Calvin Coolidge called for a special prosecutor in February 1924 and fired Daugherty soon after.

It took five years for Fall to be convicted, in October 1929. That same year, oil heir Ned Doheny, 36, died on the eve of his trial in a grisly murder-suicide, killed by the very assistant who had helped Doheny deliver the cash to Fall.

“You’re fired!”: Truman Tax Scandal (1952)

Trump may have longed for an attorney general like Howard McGrath, who pulled the plug on a special prosecutor’s probe in a record 63 days.

President Harry S. Truman’s lax oversight allowed corruption to grow unimpeded through the federal bureaucracy. In 1951, when dozens of officials at the Internal Revenue Service resigned over bribery and extortion accusations, the president grudgingly named special prosecutor Newbold Morris but stymied the investigation by withholding subpoena power from him.

Officials slow-walked Morris’ demands for documents — and two months after his appointment, when Morris asked McGrath for details of his own finances, the attorney general fired him.

Truman, in turn, sacked McGrath within hours, giving no public explanation. But it was clear that his AG had taken the fall for the debacle. With lame-duck Truman in his final months in the Oval Office, public anger faded.

Overall, history demonstrates that special prosecutors can rein in corruption, Coan told The Post — but only to a point.

“If the president feels that he can fire Mueller or undermine his investigation without paying a substantial political price,” Coan said, “he clearly has the power to do it.”