AGI is an unambiguous number: it's what shows up on Line 11 of your 1040.
MAGI is just the AGI, Modified in a particular way for a given tax benefit. The exact set of modifications depends on what tax benefit you're looking at.
To calculate the MAGI for determining whether you can deduct your IRA contributions, you do need to add your IRA deduction back in. To calculate the MAGI for ACA health care (including expanded Medicaid) you don't need to add your IRA deduction or HSA deduction back in. These deductions reduce your ACA MAGI.
Also be aware that Medicaid eligibility is usually calculated on a month-by-month basis. If you have a very low income most months and a higher income only in occasional months, it's possible to be Medicaid-eligible for most or all of the year even if your total annual income is over 138% of the poverty level.