look into my blender exporter. it's python source that writes mdl7. should be easy to figure out.
the .blend format is a complicated memory dump of blender scenes. but there are libraries for reading it (i think somewhere on the bullet physics website).
writing an exporter in python probably is easier and more user friendly though.
(when i tried to export bone animations for the first time i couldn't figure out how to calculate the matrices correctly so i first wrote a mdl viewer in python that was able to play back bone animations. it was fun and it helped a lot in understanding what's going on.)