The public API of the corpus library (CL) should offer functions to list all attributes (of a specific type) defined for a corpus. This should be easy to implement, as simple as a walk-through of the internal data structures. For convenience, it could directly return a cl_string_list instead of a (char **).
Ideally, it should also be possible to list all CWB corpora found in the current registry directory (or directories). This is currently only implemented in CQP and requires reading directory contents and checking for plausible registry entries, so it's not as straightforward to make available at the CL level.