Not really. But sort of. If you don’t know what a Mary Sue is, go read this discussion on fanfiction.net. You still won’t know, but you’ll be highly entertained.
A Mary Sue is, by general consensus, a female character who irritates people other than the author by drawing all the attention to herself. True Mary Sues are adorable to the other characters and/or to the reader (in the writer’s mind, at any rate) because she’s perky and perfect or a lovable goof-up who nevertheless saves the day. True Mary Sues exist only in fan fiction — stories set in established universes like Star Wars, Star Trek, Tolkien’s Middle Earth. Hard core fans of those universes resent these upstarts’ hogging the limelight and warping the stories/personalities of the official characters. Some folks claim that, if the official stories and personalities aren’t warped, the new character isn’t really a Mary Sue.
NOW, as someone points out in the discussion I linked, sometimes the character labeled a Mary Sue fulfills the author’s fantasies: She battles bad guys. Or she has a romance (preferably doomed) with an official character. Or she saves an important person’s life. And she’s the main character of the story, driving the action and solving all the things!
AND, as someone else pointed out in the discussion, and I think this is my point, although I’m never sure, all our characters are pieces of us, living out fantasies of what we would do if we were in various situations. But kind of not.
Because our characters are not us, playing out fantasies. Our characters have their own backstories, their own likes and dislikes, their own childhoods, and they can’t all be the same as ours. That’s why I have so many prompts asking things like, “What’s in your character’s wallet?”. Sauron doesn’t have the same things in his wallet as you do, most likely; why should any of your characters?
It’s fun to write #menotme characters who get into and out of scrapes in other people’s universes and wrap the narratives around themselves. And there’s nothing wrong with doing that, if it pleases you. Just do it on purpose, because you choose to do it, not because you don’t know any better. And expect some people to call your character a Mary Sue and sneer at her. Because folks are like that, sometimes.
Me, I’ve done it. And I’ve extracted my Mary Sue, changed all the official characters, and given her her own book. ha!
A WRITING PROMPT FOR YOU: Write a character who is your polar opposite.