Could you please let me know if there is a way to get LSN of each transaction by directly communicating with Postgres server and NOT by accessing logs.
To what end? What problem are you trying to solve?
What LSN, exactly? The LSN of the first write and xid allocation? The LSN of the commit record? What if it's a complex commit like with prepared xacts?