Hmm. What about an adapter connected to your computer adjacent to a command block? That would need two extra blocks, but seems like the best way for what you want. In the new wiki, sadly, there's (yet?) no documentation on the CommandBlock component, but in the old one, to be precise, here, is a page about it, and the methods probably still work.
EDIT: They DO work, but this needs to be activated in the config file first. (enableCommandBlockDriver=true)
EDIT2: What do you mean by "it outputs the commands" though?