You have two options for connecting to your IBM i system:
Option A: Named System (Recommended)
Option B: Environment Variables (Zero Config)
Create a named system connection stored in .ibmi/config.yaml:
ibmi system add dev --host myhost.com --user MYUSER
You’ll be prompted for a password interactively (hidden input). Or pass it via environment variable:
ibmi system add dev --host myhost.com --user MYUSER --password '${DB2i_PASS}'
Test the connection:
ibmi system test dev
If you already have DB2i_* environment variables set (e.g., from your MCP server .env file), the CLI uses them automatically:
export DB2i_HOST=myhost.comexport DB2i_USER=MYUSERexport DB2i_PASS=mypasswordexport DB2i_PORT=8076# No system config needed — just run commandsibmi schemas
Named system connections take priority over environment variables. See Configuration for the full resolution order.
# List available schemasibmi schemas# List tables in a schemaibmi tables SAMPLE# Run a SQL queryibmi sql "SELECT * FROM SAMPLE.EMPLOYEE FETCH FIRST 5 ROWS ONLY"
# Get column metadata for a tableibmi columns SAMPLE EMPLOYEE# Validate SQL syntax before executingibmi validate "SELECT * FROM SAMPLE.EMPLOYEE WHERE SALARY > 50000"# Find objects that depend on a database fileibmi related SAMPLE EMPLOYEE# Get JSON output instead of a tableibmi sql "SELECT * FROM SAMPLE.EMPLOYEE" --raw