The Wikipedia article glosses over this completely for some reason. I'd assume that drugging American citizens against their will would be highly illegal, and later trying to destroy all records of this would also be illegal, right?
Project MK-ULTRA was first exposed in 1975 by the Church Committee and Gerald Ford's Rockefeller Commission. It got a lot of bad press, coming on the heels of Watergate at a time when outrage over the executive branch and distrust of gov't officials was already widespread (you can see the WashPo article for it here.)
A guy named John Marks read this in the Rockefeller Commission report: “The drug program was part of a much larger CIA program to study possible means for controlling human behavior. Other studies explored the effects of radiation, electric-shock, psychology, psychiatry, sociology, and harassment substances." Marks filed a FOIA request for all the information the CIA had on behavior control but it turned out that post-1963/Watergate, then-CIA director Richard Helms ordered all MK-ULTRA evidence to be burned. Marks' FOIA request turned up the only documents that were spared from the purge- some retired records of the Budget and Fiscal Section of the CIA. These documents were overlooked when the Church Committee and the Rockefeller Commission asked for the documents previously. Source.
So following Marks' FOIA requests there's a spate of Congressional hearings. Senator Edward Kennedy spearheaded these and they weren't more than a slap on the wrist for the CIA. Plus, it had already been over a decade since MK-ULTRA had ended, and most of the employees directly involved in it had either retired or moved on to other jobs. No employees involved with MK-ULTRA ever faced repercussions for the project. Every CIA official testifying before Congress in 1977 emphasized how they were merely there to provide helpful information about the actions of the generation of agency officials before their time. Even the senators conducting the questioning stated "It should be clear we are focusing on events that happened over 12 or as long as 25 years ago." So even in these hearings, there was a distinct sense that the testing had been finished, the agents responsible all shuttled off to different projects or different jobs altogether, and the climate had entirely changed.
Some people who had been unwitting experimentation subjects did sue the U.S. government, including Wayne Ritchie, who had a breakdown after a Christmas party back in 1957. MK-ULTRA agent Ike Feldman, in a sworn deposition, called Ritchie "a nitwit" who "had been given a full head and deserved to suffer". But even then, the court found insufficient evidence that Ritchie was an unwitting subject at all (this goes to the difficulty of litigating cases in which you were never supposed to have known you were being experimented on in the first place.) It's also important to note that MK-ULTRA researchers specifically targeted vulnerable populations like criminals with drug abuse backgrounds (including people in prison) or johns spending a night with prostitutes (the CIA set up safe houses with two-way mirrors to watch prostitutes engaging with these men, with the full knowledge that the men would already be in too compromising a situation to press charges).
The only Supreme Court case related to this, CIA v. Sims, grew out of Marks' FOIA requests. The case was about whether or not the CIA should release the names of university/hospital researchers funded through MK-ULTRA outreach-type programs (there were university researchers doing work on sleep deprivation and interrogation methods and isolation's effect on self-image). The Supreme Court ruled in favor of the CIA, saying that it wouldn't be able to uphold national security if it couldn't guarantee confidentiality of intelligence sources. Or as Chief Justice Burger wrote it, "We seriously doubt whether a potential intelligence source will rest assured knowing that judges, who had little or no background in the delicate business of intelligence gathering, will order his identity revealed only after examining the facts of the case." So if anything the only major case to grow out of the entire debacle of a project only reinforced the CIA's discretionary powers.
TL;DR: Yes, it was illegal, but it was super hard to hold anyone accountable. Mostly due to a deliberate efforts by the CIA. They failed in the MK-ULTRA experiments to figure out a way to productively induce amnesia in people, but they did a great job erasing their own records and effectively employing institutional amnesia.