Skip to content

cli: programmatic ergonomics — --method initialize, --tool-args-json, --connect-timeout, env-var fixes #1573

Description

@cliffhall

Summary

Programmatic-ergonomics flags and env-var fixes for the CLI:

  • --method initialize — connect-only probe; prints {serverInfo, protocolVersion, capabilities, instructions}.
  • --tool-args-json '{"k":"v"}' — pass tool args verbatim as JSON (no string→number coercion); mutually exclusive with --tool-arg.
  • --connect-timeout <ms> — default 15000 for ad-hoc --server-url invocations, 0 (none) for catalog/config-driven runs (withConnectTimeout() helper).
  • MCP_CATALOG_PATH no longer conflicts with an ad-hoc --server-url/target invocation (env catalog ignored when ad-hoc).
  • MCP_STORAGE_DIR honored alongside the per-file env override.

Reference implementation (PR #1510)

Re-implement informed by these changes at 33fac3f:

Depends on

  • CLI exit-code map + error envelopes (usage errors and timeout classification build on it)

Wave 3 (CLI) lane — sequential with the other cli.ts issues; parallel to the Apps-host lane.

Notes

  • Add a dedicated test for the ad-hoc vs file-based default-timeout split (the PR relies on integration coverage).
  • Document new flags and env-var semantics in clients/cli/README.md (docs rule).
  • Coverage gate ≥90 on all four dimensions (cli.ts is measured in-process via runCli()).

Part of the PR #1510 decomposition (see tracking issue).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

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