I do this without an external keyboard or mouse - I use synergy to connect to it over the network instead.
When I close the lid it goes to sleep, I then have one of two ways of waking it.
One way is to plug in a USB device (usually my external hard drive I use for Time Machine).
The other way is via wake-on-lan - I run etherwake on my Linux box with the Macbook's MAC address and it wakes up.
Wake-on-lan only works if you had put the computer to sleep via the menu option - it won't work if you put it to sleep by closing the lid.
USB connections always work though.
I think both these options may need enabling in the Macbook's preferences - I can't be 100% sure as I set it up this way ages ago.