In Pacific Rim (2013), a similar idea to this was featured. A helmet connected to your head and a suit connected to your spine allowed a human brain-machine interface, but apparently mostly in the other way, what the Jaeger was doing was transfered as feelings to the pilot, and they also shared their mental images with another pilot, if they could transfer their thoughts to the machine it isnt very clear to me.
Before that, in the Macross Plus mini-series - OVA - movie (1994), a humanoid zentraedi pilot was able to transfer his thoughts to a variable fighter and move it by thinking, or in other words he could pilot an aicraft which turned into a robot with his thoughts.
And before this, in the Jack Mc Kinney Robotech novels (1987), human pilots could fly and move their Veritechs (again, aircraft fighters which turned into robots) through "thinking caps" or helmets which transfered their thoughts to the machines.
But I'm pretty confident these can't be the first stories to feaure this idea. Which was the first story to feature helmets which reads your mind to control a machine?