They are valid sources for "Kirk was prosecuted by JAG in episode ''foo''"
Agreed.
They are not valid sources for "Military law is influenced by the actual Uniform Code of Military Justice (UCMJ)" based on comparing the code as described in the cited episode with the UCMJ,
Agreed.
Or for "One aspect of Starfleet legal procedure which is hardly explored is the concept of Captain's Mast. Only on two occasions, over a 30 year period, is a brief mention made of this and then, only in action and not by name."
I'm not sure on that one. It's borderline.
Or indeed "Dialogue reveals that a court-martial may be convened in the absence of any JAG officers by three presiding command-level officers".
That sounds fine to me. If something is specifically stated in an episode, then it can be used in the article with the episode as a primary source.
Memory Alpha loves this kind of thing, apparently. I think we could safely leave it to them...
We have completely different aims to Memory Alpha, there's not point even comparing.