McGrady told ESPN's "First Take" of his plans and then posted on Twitter: "Thank all of you who have supported me over 16 NBA seasons, 7 All-Stars, and countless exciting moments. Retiring from NBA. Stay tuned. #mac"
"I've had a great run but it's time for it to come to an end," McGrady said on ESPN.
McGrady, 34, started last season in China but signed with the San Antonio Spurs in April and appeared in six playoff games.
He was the ninth overall selection by Toronto in the 1997 NBA draft out of high school. Over a career that spanned 1997-2013, McGrady played for Orlando, Houston, New York, Detroit, Atlanta and San Antonio, in addition to the Raptors.
McGrady averaged 19.6 points, 5.6 rebounds and 4.4 assists over 938 NBA regular-season games. He led the NBA in scoring in 2002-03 and 2003-04 while with Orlando. His seven All-Star selections came over 2001-07.