The chemical reactions and pathways involving medium-chain fatty acids, any fatty acid with a chain length of between C6 and C12.