Maybe you want to use some of the features features from mathoid

* get the result as json
* get mathml output from tex input (in json mode only, but could be expanded easily