Skip to main content
The CLI uses YAML configuration files to manage system connections. You can configure multiple IBM i systems, set a default, and switch between them with the --system flag.

Config File Locations

The CLI loads configuration from two locations. Project-level config overrides user-level config: The CLI walks up the directory tree from your current working directory to find the nearest .ibmi/config.yaml — similar to how .gitignore files work.
The .ibmi/ directory is automatically added to .gitignore when you create your first system with ibmi system add. This prevents credentials from being committed to version control.

Config File Format

System Properties


Environment Variable Expansion

Use ${VAR_NAME} syntax in config values to reference environment variables. These are expanded at load time:
This lets you keep credentials in your shell environment or .env file rather than in the config file itself.

System Resolution Order

When a command needs a system connection, the CLI resolves it in this priority order:
1

--system flag

Explicit flag always wins.
2

IBMI_SYSTEM environment variable

Set in your shell or .env file.
3

Config default

The default: key in your config file.
4

Implicit single system

If only one system is configured, it’s used automatically.
5

Legacy DB2i_* environment variables

Falls back to DB2i_HOST, DB2i_USER, DB2i_PASS, and DB2i_PORT from the environment. This provides zero-config compatibility with existing MCP server setups.

Password Resolution

When a system connection requires authentication:
  1. Config password field — including ${ENV_VAR} expansion
  2. Interactive prompt — if running in a TTY, prompts for password with hidden input
  3. Error — if non-interactive (piped) and no password is available
Password values are never logged, displayed in --watch headers, or included in error output.

Managing Systems

Use ibmi system subcommands to manage connections:

Output Format Priority

When determining the output format, the CLI checks in this order:
  1. --raw flag (equivalent to --format json)
  2. --format <type> flag
  3. format: in config file
  4. Auto-detect: table for TTY, json for piped output
Set a default in your config to always get consistent output: