adds server mode

see issue #18 for discussion.

Happy to add docs, tests, etc. if you're amenable to this patch