Since Kindle Previewer accepts ePubs, simply create an ePub with
Sigil (or Calibre Editor). This will allow you to automatically generate both NCX and HTML TOCs from your h2 headings. (Current Kindles and Kindle apps only require an NCX TOC, but if you want to publish your book via KDP an HTML TOC is also recommended for backwards compatibility.)