I got into a bit of a discussion this weekend as to whether Rey is a Mary Sue. I say obvious not, while they said obviously was. I'll skip the details and propose a framework for determining whether a character is or is not a Mary Sue.
Getting a true Mary Sue into a film or video is nearly impossible as so many hands touch a film. When it is done, its almost entirely done on purpose.
What follows is a tool to help you think about a character. The tool is an aid, not proof.
1. Can you easily fix the problem in the script?
Position: Rey is a Mary Sue because she hops into a starship without being able to fly it.
In order to fix this particular problem, we only needed a line of dialog, anywhere in the script, saying that she knew how to pilot, or at least pilot this craft in particular. As the fix is just a bit of dialog, and not a problem intrinsic to the character, the problem lies in the script, or in the editing room, not in the character.
In general, scripts have setups and payoffs. Scripts establish bits of information or objects early, and then they don't seem random later on when they matter. Sometimes this is necessary, like when a character is a brain surgeon, and sometimes it's not, like when a skill is so widespread as to be generic, such as driving a car. In the Star Wars universe, flying a ship is such a generic skill that it can easily be assumed. In fact, we see multiple character fly with no in-film explanation. (Yes, outside of film there are explanations and meta-explanations. I am limiting the argument to film here.)
2. Does the character suffer reversals?
Hero and lead character do amazing stuff all the time. That goes with the territory. They also suffer setbacks all the time because an action film without setbacks has no tension and tends to be a very short film. Reversals in fortune are the stock and trade in such films. Mary Sues tend to succeed and see no reversals in fortune.
Does Rey see any reversals in fortune? She gets paid badly. Somebody tries to steal her droid. When TIE fighters attack, she runs for her life. The freighter that she's escaping in gets captured. She pulls the wrong part when trying to close the doors on the freighter, letting out the horrible monsters. She gets kidnapped by the First Order.
That's enough reversals in fortune to make me think that she's not a Mary Sue.
3. Does anyone else succeed beside the character?
Mary Sues are the engines of success. Often, they are the only source of success. Is this character the only engine of success, or does the character share success with others?
Rey is one engine of success. When escaping in the Falcon, she needed Fin to fire the guns. They laugh when the fight is done, congratulating each other on their successes. Clearly the character don't think that they each succeeded on their own. Poe blows up the planet. Han gets to the planet and Chewie blows up the thingies. Clearly there were more successful characters than just her.
4. Is the character opposed by forces as strong as herself?
In this theory, a character's power is measured in their opponents. This is why many Mary Sue like characters aren't Mary Sues, because their opponents are as influential as the lead character. They may be Mary Sue's when measured against us, but when measured against the all powerful superbad, they're going to need all their Mary Sueness just to survive.
Rey is opposed by circumstance, by being abandoned by her parents. Later, she opposed by the First Order. Finally, she's opposed by Rylo Ken, an up and coming Sith. That's a mighty impressive array of opponents. Given that the First Order is pretty much an unstoppable force in this film, you have to be similarly unstoppable to oppose them.
5. Does the character bypass the universe rules too much?
All heroes bypass the rules. We get that. Yet, there are some rules that even heroes don't get to bypass. When that happens, the audience cries foul, or at least wonders where the hell that came from.
In the film, Rey suddenly uses very powerful force powers and fights well with a lightsaber. I'll concede on this one. When it comes to the force, she comes to it all rather too easily compared to the other films. In this particular case, I lay the blame not on the character, but on the screenwriters attempt to satisfy audience expectations that there should be force-power stuff and lightsaber fights. We have a case for why the bad guys should have force powers, but because the good guys have no force powers, the only one who can possibly show them is Rey because Luke isn't in most of the film. Because of this decision, it then becomes inevitable that Rey will show too many force powers too quickly.
We could have had a lightsaber fight where Rylo Ken dominates and shows his superiority, but I don't think that the audience would have enjoyed that.
6. Are challenges reduced to trivialities?
In order for a film to have tension and excitement, there needs to be stakes and threats. Stakes are what's at stake, and threats are those things that threaten the stakes. The bigger the stake, the more prominent the problem gets.
A Mary Sue will reduce a high stakes problem to a triviality. A Mary Sue will remove tension and excitement rather than enhance it.
Does Rey remove tension? I don't see that, but I'm open to discussion. She doesn't defeat the First Order. She doesn't defeat Starkiller Base by crawling around its guts and disabling their gun. She does get a job offer by Han Solo, but that'a job offer by Han. Do you think that's going to be a great job? She does sort of skate through the film, but is that the Force at work?
I don't think that Rey is a Mary Sue as she fails to satisfy most Mary Sue criteria, but I made up the criteria, so I could be biased. However, failure to be a Mary Sue doesn't make Rey a good character. A bad character is not the same as Mary Sue. Rather than point my finger at a character, I think that pointing your finger at the script makes far more sense.
Bonus: She gets without earning.
A character getting something, like success, without earning it is a highly problematic criteria for detecting a Mary Sue. Context here is everything, and so is opinion. I think that this criteria is too subjective, too open to personal opinion. Film, in general, is constantly using sleights of hand to move the plot along, to get the audience to pay attention to one area while sliding around another. If you spot those sleights, you'll realize how much tomfoolery happens.
For Rey, I think that much of her paying for it happens before the beginning of the film, showing the audience how she lives a hard and hopeless life. She also fixes the Falcon and gets a job offer from Han Solo. Did she earn that? We know from the film that she literally works and literally lives in machinery. It's her living. The idea that she's great at knowing how things works is well telegraphed. Yes, she knows much more about how the Falcon works than Han does, but has Han ever shown great expertise is repairing the Falcon? His mechanical skills are a joke through the films. Chewie is the better mechanic. So for all her mechanical and technical feats, I think that the film does a good enough job to let the audience buy in. (It could have done better, but you already knew that.)
As for getting the Jedi powers without earning them, where Luke needed training, yeah, that stretches the continuity. For escaping, it would have worked better if they had just locked her into a room, and the she had used her mechanical knowledge to bypass the lock somehow. As for the light saber fight, that was just a hopeless cases. No mainline Star Wars film getting made could have skipped the "light saber fight" checkbox. Unless you got Luke, there was simply nobody who could credibly do that fight.
Because the film approached Rey's force power as a surprise, the film couldn't set her up properly. Seeing her use a few force powers earlier int he film, learning how they show up under stress, with her not understanding them, would have gone a long way to setting up a better ending. That makes me lay the blame at the script and the direction, not the character who was tasked with doing too much, too fast.