In my opinion the Eagles got the better end of the deal. That said, I love McCoy and I don't think it was a terrible trade for the Bills, especially if Kiko ends up having some lingering injury issues. The cap hit is the worst part for the Bills, I'd say.
But the does the cap hit really bother the Bills? Before this trade they had $30.5 million free against the cap this year, and nearly $60 million against the cap next year. They now have $20 million free this year and $45 million free next year.
It's an historically cheap team who are rarely up against the cap, splashing some cash under new ownership. They've still got more than enough cap room to make pretty much any move they'd like and that's without getting into the usual shenanigans of restructuring and extensions.
Assuming Chip really just wanted McCoy gone, it's probably a win/win on both sides, although frankly if Chip was looking to move McCoy on as much as had been intimated, I think Buffalo overpaid, they could have just flung a late round pick at Chip and he'd probably have bitten. Alonso is a potentially great young LB, but he's blown the same ACL twice now and as already had hip surgery so there's definitely some risk there for the Eagles mitigated by the fact he's on his rookie deal (although only for another two years).