U.S. Senator John McCain met in Baghdad with officials who have been trying to form a government for the past three months .