EXHIBIT NO. 99.(i) 2

LEGAL OPINION CONSENT

I consent to the incorporation by reference in this Post-Effective Amendment No. 57 to the Registration Statement (the “Registration Statement”) of MFS Series Trust XVII (the “Trust”) (File Nos. 33-37615 and 811-6174), of my opinion dated October 21, 2022, appearing in Post-Effective Amendment No. 53 to the Trust’s Registration Statement, which was filed with the Securities and Exchange Commission on October 21, 2022.

 /s/AMANDA S. MOORADIAN 

 Amanda S. Mooradian

 Vice President and Senior Counsel

Boston, Massachusetts

October 27, 2026