I did them with function calls, I just pass the data from the button to a common function.
but this is basically what you need to set
    joginc = mc.mcJogGetInc(inst,0); -- get the present increment
    mc.mcMpgSetAxis(inst, encoderid, axisid); --mpg encoder , axis ;  encoder 0, X axis 0
    mc.mcMpgSetAccel(inst, encoderid, 15); -- 15%
    mc.mcMpgSetRate(inst, encoderid, 100); --100
    mc.mcMpgSetCountsPerDetent(inst, encoderid, 1); --one click give one incremental step
    mc.mcMpgSetInc(inst, encoderid, joginc); -- pass the increments from the MPG encoder steps