Looks like a workaround with setting $wgServer using --server attribute in command line tools like this:
$wgServer = $options['server'];
doesn't work properly for some cases like the one described for Semantic MediaWiki extension in bug 19077.
The problem is that commandLine.inc is included before $wgServer = $options['server']; can be set ($options array is generated in commandLine.inc). It means that all extensions are loaded before $wgServer is corrected.
It breaks in cases when $wgServer variable (as well as $wgServerName) are used during original include of the extension code (which happens through commandLine.inc). In most cases it works as majority of extensions use $wgServer/$wgServerName only in hooks or in any post-init function calls, but it will break for all extensions that use it in original include.
Will appreciate any feedback on this bug and possible workarounds for specific case of bug 18007 for Semantic MediaWiki (e.g. any way to "late bind" $wgServer / $wgServerName).