I wouldn't stay in Gloucester. There's good historical stuff to see/do there, but it's kind of a gritty old town...
Lots of beautiful small towns on the north shore: Rockport, Essex, Marblehead, Newburyport. They are all not far apart and you can easily travel to a few in a day. Also close to Portsmouth, NH, and southern Maine, i.e. Ogonquit, Saco, Wells, and Portland.
I'd vote for staying in Newburyport. It's the most northern of the above towns in MA, and central to the places above. I've stayed there and spent time eating/riding there. I've also stayed in Rockport, but that was long before I started riding. Lots of artist stuff, but a little touristy. Newburyport and Portsmouth, NH (as well as Portland, Maine) are much funkier towns, with good restaurants, history, and real people, not just tourists.
When will you be here?
September is generally a beautiful month here.