The 37-year-old McGrath spent all 17 years of his professional career with his home county, playing in 257 first-class matches and registering 35 first-class centuries. The Bradford-born right-hander represented England in four Tests and 14 one-day internationals.
"It has been an honour and a privilege to have represented Yorkshire throughout my professional career," McGrath said on Yorkshire's website.
"I have been involved with this great club every summer since I was 12 and it is going to be difficult not having the opportunity to play again. I would like to thank the club, the members and the all the coaches for their help throughout my career.
"Above all else, my last word goes to my team-mates, who I have shared the greatest of times with over the past 20 years. I have met some great people that have become my closest of friends."
McGrath suffered a thumb injury last season that has not healed. His highest first-class score was 211 against Warwickshire at Edgbaston in 2009, the same season he captained Yorkshire, while he also took 134 first-class wickets at an average of 35.
Martyn Moxon, Yorkshire's director of cricket, said: "Anthony McGrath has been a great servant to Yorkshire County Cricket Club.
"It has been a privilege to play with and coach Anthony. He has given every ounce of blood, sweat and tears to the county and his role within the dressing room will be sadly missed.
"He is the perfect role model for any aspiring junior wanting to be the best they can be. The way he inspires those around him is his distinct quality.
"I would like to wish him well in the future and hope that he will continue his connection to the club through his coach education qualifications and programme."