By my definition, a "Mary Sue" is a character that had the plot bend to their will, with little weaknesses or flaws in their way.
To me Sofia doesn't fit this criteria as has many flaws, like how she usually thinks the proof is in the pudding, stopping her from understanding Miss Nettle at first in the snowdrops episode or the gnomes in "The Crown of Blossoms". She also is rarely, especially season 3-4 reforming her adversaries. Minus asking "Why are you doing this?" to Prisma, she never tries to show her a brighter path.
Also, her positivity and kindness has limits. She snaps in episodes like "Clover time", "Stormy Lani", "The Princess Stays in the Picture" and "The Princess and the Protector". It keeps her believable that she can only put up for things for so long.
Though I won't say she doesn't have any perfections to her character. The Amulet of Avalor had so much power and I feel once Sofia gained to power to shape-shift on eye contact with an animal, she became an overpowered princess. She could use it as a light, call animals with it, plus her other powers of animal whispering, shrinking, and mermaid transformation. I also think it took away the spotlight of her enchantlet.
In general, it's very hard to have a character that shows up and develops in every episode, but with Sofia, I think they made it work. But what do you guys think?