Boston City Directories offer lists of names and occupations. Search the catalog using Boston Directory in the titles field and limit by online resources and the desired years. Tufts also offers an integrated search of these directories listed below.
HathiTrust offers digitized versions of Massachusetts Census documents along with Directories with resident information. Search the catalog and then filter by dates of interest. You can also filter by "available online" and HathiTrust. Search within the documents for "nativity" or "foreign" information and to see if the data is available down to the ward level within Boston. You can also search by country.