The sCASP server can deal with constraints. Just run
swipl examples/dyncall/http.pl
Open http://localhost:8080/, past your query and see the result as HTML or JSON. The JSON format is a proposal. I think it would be great to have an agreed JSON format for sCASP. JSON is very easy to process in just about any language. See the help link for accessing the server using an HTTP POST request rather than the browser.
But yes, I think you can get what you want from Pengines using copy_term/3.