Configure the CLI
Set your MD.ai domain and access token
Every command needs two settings: the MD.ai domain you work on and an access token that authenticates you.
mdai config domain MY_DOMAIN.md.ai
mdai config token MY_ACCESS_TOKENGet an access token
- Sign in to your MD.ai domain (for example,
public.md.ai). - Open User Settings from the sidebar on the projects page, then the Access Tokens tab. You can go there directly at
https://MY_DOMAIN.md.ai/hub/settings?tab=tokens. - Click
Generate New Token, enter a Name, select at least one Scope, and clickGenerate. - Copy the token and run
mdai config token <token>.
Treat the token like a password. Anyone with it can act as you on the projects it is scoped to.
Without a token, commands stop with Please set access token: mdai config token <token>.
Config commands
Usage: mdai config <COMMAND>
Commands:
list List current configuration
domain Configure MD.ai domain (e.g., public.md.ai) [view current if no argument supplied]
token Configure MD.ai access token [view current if no argument supplied]
auto-upgrade Configure auto-upgrade (y/n, yes or no)
reset Resets current configuration
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print helpThe configuration is stored in ~/.mdaiconfig. mdai config reset deletes it.
Use mdai config list to view the current configuration. Add --json for machine-readable output:
$ mdai config list --json
{
"data": {
"domain": "public.md.ai",
"token": "<your access token>",
"autoUpgrade": "yes"
},
"error": null
}Automatic upgrades
The CLI must match the latest released version. Before running any command other than config and version, it checks for a newer release:
- Auto-upgrade on: the CLI downloads the latest version and reruns your command with it.
- Auto-upgrade off (default): the command stops with
CLI is outdated ... Please upgrade to the latest version. Download the new version to continue.
mdai config auto-upgrade yes # enable
mdai config auto-upgrade no # disableOn Windows, v0.28 and earlier can't auto-upgrade: they stop with EPERM: operation not permitted.
Download the latest version manually. From v0.29.0, the
CLI uses a new updater that supports Windows.
CLI v0.28.0 and earlier always download the x64 build when auto-upgrading. On Linux arm64, download v0.28.1 or later manually; from then on, auto-upgrade installs the arm64 build.
Proxies
The CLI honors the standard HTTPS_PROXY, HTTP_PROXY, ALL_PROXY and NO_PROXY environment variables (or their lowercase forms).
Custom CA certificates
If your network inspects TLS traffic with a custom root certificate (for example, Zscaler), the CLI trusts it automatically when it is installed in your operating system's certificate store: the Keychain on macOS, the Windows certificate store, or the system CA bundle on Linux. Corporate setups usually install it there already.
On Linux and Windows, you can also point the CLI to a PEM file with the MDAI_EXTRA_CA_CERTS environment variable, then open a new terminal. NODE_EXTRA_CA_CERTS, used by v0.28 and earlier, still works.
Linux (bash):
echo 'export MDAI_EXTRA_CA_CERTS=/path/to/ca-bundle.pem' >> ~/.bashrcWindows (PowerShell):
# For all users (requires an administrator shell)
[System.Environment]::SetEnvironmentVariable("MDAI_EXTRA_CA_CERTS", "C:\path\to\ca-bundle.pem", "Machine")
# For the current user only
[System.Environment]::SetEnvironmentVariable("MDAI_EXTRA_CA_CERTS", "C:\path\to\ca-bundle.pem", "User")On macOS, the CLI ignores certificate files: add the certificate to the Keychain instead. Open it in Keychain Access, add it to the System keychain, and set it to Always Trust. Or from a terminal:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /path/to/ca.pem