Not on generation of mobi files, but on unpacking Mobi 7 and Mobi 8 files. If you want to see how the ncx equivalent is unpacked from a Mobi index database record, see github for KindleUnpack here:
https://github.com/kevinhendricks/KindleUnpack
The binary index format is quite a pain but you can see how to unpack one once the proper record has been identified. Although similar, the ncx info in Mobi 6 and 7, differs from the more epub like Mobi 8 ncx info.
Look in the lib directory for kindleunpack.py, mobi_index.py, and mobi_ncx.py.
The easiest way to understand the binary format is generate a mobi 8 using Kindlegen from a known epub with an elaborate ncx and upack it with added debug statements added to the mobi_index.py and mobi_ncx.py code.