That's a great idea, I have some code in my Walkerman project that keyframes using MEL.
//Set KeyFrame
string $c = "setKeyframe " + $attr;
button -label "K" -annotation "Set Keyframe" -command $c;
// cut Keyframe
string $c = "cutKey -cl -t `currentTime -q` " + $attr;
button -label "U" -annotation "Cut Key" -command $c;
Would need to find a way to choose the frame being keyed, or temporarily change the frame back to the key point, key, then return.
I don't have the time now to do much more than post an example from the code I wrote, but I will take a look at it when I have more time this weekend. . .
"The Sage as an Astronomer: If you still see the stars as something above you, you lack the eye of knowledge." Friedrich Nietzsche