Mefenamic acid inhibits the activity of cyclooxygenase (COX) enzymes, which are involved in the synthesis of prostaglandins. These compounds contribute to pain, inflammation, and fever. By blocking these enzymes, mefenamic acid reduces the levels of prostaglandins, thereby alleviating pain and inflammation.