$wgLegalTitleChars via Title::legalChars() is exposed in action=query&meta=siteinfo but because it's a regex class designed for PHP, it's really hard to use outside of PHP.
There's a significant amount of workarounds for this, including Title::convertByteClassToUnicodeClass() in PHP and the same in JavaScript: https://github.com/wikimedia/mediawiki-title/blob/master/lib/utils.js
I'm currently working on a Rust equivalent to mediawiki-title and this is a problem. It would be easier if instead of using regexes, they were referenced by some abstraction that each client could transform. For example:
$wgLegalTitleCharacters = [ 'characters' => " %!\"$&'()*,-.:;=?@^_`~", // + 'plus' => true, // / and \ 'slashes' => true, // A-z, 0-9 'alphanumeric' => true, // \x80-\xFF+ 'non-ascii' => true, ];