This javascript can be used in a bookmarklet like this. It extracts the message ID from Gmail, and shows it in a popup box. Unfortunatly it doesn't copy the ID to the clipboard, but you can just copy it from the popup, so that's ok.