I lived just outside Gloucester in 92-93 so would recommend you taking a drive up to Cape Ann, there are quite a lot of areas you would recognise with the amount of films made there. Rockport is lovely, the house where Mermaids was filmed was just down the road from where I lived.
Boston is a very walkable city and the "T" trains are so easy to understand making the whole city accessible. I am very jealous as I would love to go back someday!
I did go to Cape Cod also, but to HyannisPort but like the others said P-town is more colourful and entertaining.
Oh and if you can take a whale watching boat out to (I think this is the right name) Stillwagon Bank where you can see the humpback whales. Have no idea how much it will cost now but it is so worth the money, you will never forget seeing the whales. I took the boat trip from Gloucester but there are ones in Boston and from Cape Cod too.
Plymouth is also worth a visit if you like history, or a version of it anyway. There was a museum that had the whole pilgrim story in it that I had to read out for the Danish and Norwegian friends I was with and people started following us thinking I was a tour guide - yeah, with a Scottish accent!
See you asked about Boston and you get all this!