I usually try to stick it all on one line when I have to do that, something like
ssh somehost 'cd /some/dir; grep -lr foo .' | pbcopy
not very flexible, but it works for many cases