Every individual not an inhabitant of the commonwealth and every partnership composed of persons not such inhabitants, having a usual place of business in the commonwealth, temporarily or permanently, or engaged here, temporarily or permanently, and with or without a usual place of business here, in the construction, erection, alteration or repair of a building, bridge, railroad, railway, or structure of any kind, shall, before doing business in the commonwealth, appoint in writing a person who is a citizen and resident thereof to be his or its true and lawful attorney upon whom all lawful processes against such individual or partnership may be served with like effect as if served on such person or partnership; and said writing or power of attorney shall contain an agreement on the part of the maker that the service of any lawful process on said attorney shall be of the same force and validity as service on such individual or partnership. The power of attorney shall be filed in the office of the state secretary, and copies certified by him shall be taken as sufficient evidence thereof. Such agency shall be continued so long as such individual or partnership does business as aforesaid in the commonwealth, and the power of attorney shall not be revoked until a similar power is given to another citizen and resident of the commonwealth and filed as aforesaid. If such individual or partnership fails to appoint an agent and does business in this commonwealth, service of process, in duplicate, may be made upon the state secretary. The secretary shall, upon a payment of a fee of five dollars by the plaintiff, give notice to the defendant of said action by mailing by registered mail, return receipt requested, a copy of the legal process to the defendant's last known address which shall be furnished to the secretary by the plaintiff or his attorney.
Mass. Gen. Laws ch. 227, § 5