Everyone loved Mary Sue, as usual. Mary Sue was revealed to be a Starfleet Intelligence agent, as usual. Mary Sue was Spock's intellectual equal, as usual.
I just had a thought about that. Everyone complains about Mary Sues as though it's wrong for the guest star to dominate the story. But in '60s TV, that was often what was supposed to happen. This was discussed in the Original Series forum recently, in a thread about the famous description of the show as "Wagon Train to the stars." Wagon Train was a long-running TV Western whose formula was to have a continuing cast of regulars in an ongoing situation, but to focus each episode on a specific guest star playing a member of the wagon train, to tell the guest star's story with the regulars serving to support it. Anthologies were the pinnacle of classy drama in the day, and you didn't have home video or lots of syndication yet, so the viewing experience tended to be focused on each individual story rather than the series as a whole; so even continuing series often went for an anthology flavor. And that often meant building each episode around the guest star. Since the main characters had to stay the same, if you wanted to tell a story about character growth and change, you had to make the guest star the focus.
And that's what lots of Trek novels did as well. The main characters had to be changeless, so the emphasis was on the guest stars. And those guest stars had to be made interesting and impressive enough to be worthy of that focus. So maybe it's not so much "Mary Sue" writing as it is a standard type of episodic-series writing. Something to think about, anyway.