President Trump on Monday scolded Senate Republicans for “not getting the job done” and endorsed a push by ally Stephen K. Bannon to force out GOP leaders.

The president made the remarks ahead of a lunch meeting with Senate Majority Leader Mitch McConnell, with whom Mr. Trump has had a strained relationship for months as his legislative agenda stalled.

“We are not getting the job done and I’m not going to blame myself,” Mr. Trump said at a Cabinet meeting. “I’ll be honest, they are not getting the job done.”

Mr. Trump defended Mr. Bannon, a Breitbart news executive and the president’s former White House political director, who launched a campaign to unseat establishment GOP lawmakers and force out Mr. McConnell, Kentucky Republican.

“He’s a friend of mine and he’s very committed to getting things passed,” Mr. Trump said. “I can understand where Steve Bannon is coming from. … I’m not happy about [the stalled agenda] and a lot of people are not happy about it.”

Mr. Trump’s displeasure with Mr. McConnell boiled over in July when the bill to repeal and replace Obamacare failed in the Senate by one vote. The deciding vote was cast by Sen. John McCain, Arizona Republican.