I've written a library for the Centipede Shield, which uses four MCP23017. However, it'll work just fine for plain MCP23017 chips, as long as you have them wired and addressed correctly. I've made it compatible with both Arduino 1.0 and the older versions.
http://docs.macetech.com/doku.php/centipede_shield
Please post a drawing or photo of your wiring, to make sure there aren't any mistakes there too.