You are right, melamine & MDF both have formaldehyde in them to act as a preservative to the wood (its what they use in hospitals to store medical mishaps to coin a phrase in). It is both toxic by ingestion and potentially carcinogenic by inhalation which is why I have never had MDF worktops in my kitchen/s.
My advice would be to not use it in your compost, whilst the levels allowed in the mixing of the pulp to form the "wood" are controlled there is (like many things) no research to prove one way or the other that it is a problem. MDF in kitchens has been measured and shown to give off formaldehyde vapour but not to a level needing any form of personal protective equipment etc.
Me, fill yer compost bin with natural stuff as that is what your plants would want