There are different methods.
Accountinfo of bonding curve account. Decode it, then get data virtual sol reserves and token reserves. Use them to calculate price. Every pumpfun token has same total supply i.e 1 billion. Price * supply = market cap
Get it from last transaction. Check swapped the sol and mint amount. Sol amount / Mint amount = price. And the same way as 1, you multiply to get marketcap.