Skip to content

CLI: Per-profile environment overrides and cdcx auth list #46

@troycdc

Description

@troycdc

Problem

1. MCP plugin silently fails auth when env vars are empty

The Claude Code MCP plugin framework passes userConfig values as empty strings ("") when users haven't configured them. The CLI treated these as valid credentials, attempted authentication with blank keys, and failed with a cryptic error instead of falling back to ~/.config/cdcx/config.toml.

2. No way to route profiles to different endpoints

Users working across multiple environments (production, UAT, staging, internal proxies) need per-profile URL overrides. Previously the only option was process-wide env vars (CDCX_REST_URL, CDCX_WS_MARKET_URL, CDCX_WS_USER_URL), which meant switching endpoints required manually exporting vars before each command. There was no way to bind a URL override to a specific profile in config.toml.

Example use case:

[profiles.staging]
api_key = "..."
api_secret = "..."
environment = "uat"

[profiles.staging.envs]
CDCX_REST_URL = "https://proxy.example.com/exchange/v1"

Without this, users with multiple environments must maintain shell aliases or wrapper scripts to juggle env vars.

3. No visibility into which profiles are correctly configured

With multiple profiles across environments, there's no quick way to verify which credentials are valid without manually running a command against each one. Stale keys, rotated secrets, or misconfigured endpoints silently fail at usage time.

Solution

Per-profile [envs] table

Any profile can declare an [profiles.<name>.envs] sub-table. Keys are loaded as environment variables (uppercased) when that profile is active. This is generic -- any CDCX_* override works without code changes when new env vars are introduced.

cdcx auth list

Lists all configured profiles and makes a lightweight authenticated API call against each to report:

  • Profile name, environment, masked API key
  • auth: ok or auth: error (<reason>)

This gives immediate visibility into credential health across all profiles in one command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions