How is the military strength factor determined for diplomatic claims? Is it based off the player's ships in system, or the total the NPR has currently detected? Or all player ships the NPR has encountered? Is having a fleet in-system a sufficient show of force, or do the NPRs need to actively detect them?
It is based on all military-engine ships that the NPR has detected and has not seen destroyed. The NPR is assessing whether you could take and hold the system long-term or threaten its territory in general, rather than whether you could take that system immediately. If the threat was assessed only on a local basis, you could simply sail the same fleet to half a dozen systems and claim them all. The NPR also doesn't take into account any bases you have as they could not threaten the system or its other territory.
For example, NATO wouldn't give up the Baltic States if Russia stationed a large force on the border and demanded their surrender. However, If Russia had a clear overall military superiority and did the same, then I am sure there would be a few wavering Western politicians.
There is a slight 'cheat' here as the NPR is given information on whether your ships are military or commercial engines. In fact, I will probably add that to thermal detection for everyone at some point.