wip: add server api and debug