Thanks for the info as I've been experiencing this when evaluating Caché 2018.1.4 and couldn't understand why the server eventually ran out of memory. Can this post be updated when there is a public build that contains the fix (I'm interested in Caché)?  It's very hard to find which bug fixes are included in each build/released version and this bug seems serious enough to get a new public release version built soon?

You can do this with:

set props("Address") = serverAddr
set props("Port") = serverPort
set props("MirrorConnection") = 1
set sc=##class(Config.ECPServers).Create(ECPServerName,.props)

And

set props("Server") = ECPServerName
set props("Directory") = ":mirror:"_mirrorName_":" _databaseName
set sc=##class(Config.Databases).Create(databaseName,.props)

Then you need the Namespace created pointing to that remote database and that can be done via the %Installer (I've not found a way of doing the above with %Installer but you can call class methods for the above from %Installer):

<Namespace Name="${newNS}" Create="yes" Ensemble="0" Code="${SourceCodeNameSpace}">
    <Configuration>
        <Database Name="${newNS}" Create="no" />
    </Configuration>
</Namespace