A huge cataclysm struck the world several thousand years ago, in which debris from magical meteorites basically screwed up the whole planet, altering its ecosystems to include creatures that evolved/mutated to take on magical abilities. This is how you get widespread creatures that go beyond stuff of myth, like numerous breeds of dragons, wisps that follow magical phenomena in the sky for sustenance, large golem like creatures born from lava and obsidian, etc. How might I establish a functional ecosystem based on this concept?
First, define your environment.
Ecosystem does not only include creatures, but also the inorganic environment. Will it be a desert? A volcanic terrain? Sea? A lake with a lot of mana scattered around?
Second, establish a food chain.
Decide who will be eating who. Focus on the uniqueness of each of your creature and the similarity with earth's creature, or not.
A logical step would be the bigger creature eat smaller creature, but even earth has nature freaks, so get creative. I'm imagining a plant that specialize on eating ethereal wisps. Faeries that prey on centaur and other sentient creature.
Because you've introduced magic, then let's try to make magic as the primary source of energy, instead of sun.
Get something that feeds from magic, or mana. This is like "plankton" in our ecosystem. You can choose to have plants, but I recommend "spirit". They grow by absorbing mana from their surrounding. Other creatures cannot do that.
Get your first level consumer. Something that feeds on spirit. For example, "fairy". Imagine the spirit like a tiny floating fluffy ball and the fairies flying around consuming their energy. They do not "eat" them, but rather only takes the mana, so the spirit can still absorb mana again.
Get your second level consumer. I'll give you two examples: centaurs, and for creativity: Venus fairy-eater.
Proceed adding more creatures, define their relationship with each other.
Optional: for completeness sake, think about how to recycle energy in your world. Here, dead bodies are decomposed by detrivors, like bacteria, worms, cockroach, etc. How would that work in your world? Will they simply become ghost/spirit? Do they have physical body that can rot?
I suggest doing research into real ecology to understand how genuine, natural ecosystems function. Once you have succeeded with that, consider the impact of only one creature with magical abilities on the ecology. This will be invariably catastrophic. Now devise what magical beast or plant and its abilities is needed to counteract its impact. Keep adding and you will build your own functional magical ecology.
This is a step by step method. It will enable you to learn how to construct any sort of ecology,