Provided you lived together in Massachusetts and the cause for divorce occurred here, or you have lived in the Commonwealth of Massachusetts for one year preceding the filing, you are entitled to file for divorce, otherwise your option is to file for a legal separation now, and then you can file for divorce once you have met the timeline. The court charges a $220 filing fee, unless you income qualify for a waiver, and then there would be your legal fees and possibly sheriff's fees. How much that all totals, depends entirely on what your husband and you decide to fight about.
If you choose to file a contested "Complaint" for Divorce, the fee is $215, but there is also another $5 charge for the summons itself (you'll need to take the Complaint and have it served with the summons). It really doesn't matter how long you've been separated...just make sure that you and your spouse have lived in Massachusetts for at least a year.