How to integrate Thunderbird with SpamAssassin running on the server?

You should be able to configure Thunderbird's Junk button behavior to fit your needs. Two steps are required:

  1. Go to Tools | Options | Security | Junk (or on OSX, Preferences | Security) and tick When I mark messages as junk: and Move them to the account's "Junk" folder
  2. Go to Tools | Account Settings..., locate your mail account and proceed to Junk Settings for that account. Chose Move new messages to Other: and select the desired IMAP folder.

Reference: https://support.mozillamessaging.com/en-US/kb/thunderbird-and-junk-spam-messages