feat(cli): lift config-file headers/timeouts/OAuth into serverSettings (#1482) - #1500
Conversation
#1482) The CLI resolved file-sourced servers via resolveServerConfigs(), which returns bare MCPServerConfig and dropped disk-level headers, timeouts, and OAuth — CLI connections from a --catalog/--config file silently ignored them. The TUI already lifted these via mcpConfigToServerEntries(). Extract the TUI's catalog/config -> per-server-settings resolution into a shared core module (core/mcp/node/servers.ts: loadServerEntries + selectServerEntry) and route both CLI and TUI through it, so the two share one file->settings path. --header still overrides the file's headers for the run while preserving the file's timeouts/OAuth. - core: add loadServerEntries/selectServerEntry/headersToServerSettings - tui: tui-servers.ts re-exports the shared core helpers (no logic dup) - cli: resolve via loadServerEntries + selectServerEntry; drop the CLI-only conflict check and bare-config path - tests: core servers.test.ts (settings lifting, header merge/override, stdio overrides, seed/error/conflict, selection); CLI integration tests asserting a config header is sent over HTTP and --header overrides it - docs: CLI README note on file settings being applied Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 2m 22s —— View job Review: lift config-file settings into
|
…pper, clearer error, spec refresh
- Remove the now-unused resolveLaunchServerConfigs() wrapper (both CLI and
TUI route through loadServerEntries now); migrate its default-catalog
launch tests to compose withDefaultCatalogPath + resolveServerConfigs.
- Deduplicate applyStdioOverrides against config.ts applyOverrides: export
the latter (now trims cwd) and reuse it in servers.ts.
- selectServerEntry's unknown-name error is source-agnostic ("not found"
not "not found in config file") since entries may be a single ad-hoc
default, where "config file" would mislead.
- Refresh specification/ docs (v2_cli_tui_launcher.md,
v2_catalog_launch_config.md): CLI/TUI resolution now via
loadServerEntries/selectServerEntry; mark gap G1 resolved (#1482);
withDefaultConfigPath → withDefaultCatalogPath.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the thorough review! Addressed all the actionable items in 58c32b8: 1. 2. Misleading "not found in config file" error — Fixed. 3. Dead 4. Duplicated stdio-override helper — Deduped. Exported 5. Spec staleness — Refreshed both
@claude review |
|
Claude finished @cliffhall's task in 1m 3s —— View job Re-review: changes in
|
|
Confirming the item-4 note: yes, the Thanks for the careful re-review! 🙏 |
Adds end-to-end smoke coverage for the config-file headers/timeouts/OAuth lift introduced in #1482: - unknown --server now errors source-agnostically ("not found") - multi-server catalog selection via --server (and the omit-it error) - --header merge does not break the stdio connect path - HTTP transport: a config-file `headers` object is lifted onto the wire, and a CLI --header overrides it (verified against an in-process test server's recorded requests via a non-blocking spawn) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes #1482.
Problem
When the CLI loaded a server from a
--catalog/--configfile it used the bareMCPServerConfigand dropped disk-levelheaders, timeouts, and OAuth — so CLI connections from a file silently ignored them. The TUI already lifted these intoInspectorServerSettingsviamcpConfigToServerEntries(); the CLI'sresolveServerConfigs()path did not.(This was the settings-lifting parity gap left open after #1499/#1347 normalized the
--catalog/--configvocabulary.)What changed
Core —
core/mcp/node/servers.ts(new, shared by CLI + TUI)loadServerEntries()— resolves the catalog/config source (or ad-hoc target) into{ config, settings }, lifting disk headers/timeouts/OAuth intoInspectorServerSettings. Applies the default writable catalog, the--catalog/--config/ad-hoc conflict matrix, and seed-if-writable / error-if-read-only semantics. (This is the formerloadTuiServersbody, moved to core.)selectServerEntry()— single-server selection for the CLI (--server, or the only server, else an error listing names).headersToServerSettings()— moved here from the CLI/TUI duplicates.CLI —
clients/cli/src/cli.tsloadServerEntries+selectServerEntry, so file settings now reach the connection.--headeroverrides the file's headers for that run while preserving the file's timeouts/OAuth.TUI —
clients/tui/src/tui-servers.tsloadTuiServers→loadServerEntries). No behavior change; eliminates the duplication.Tests
core/.../servers.test.ts: settings lifting (headers/timeouts/OAuth),--headermerge/override, stdio env/cwd overrides, catalog seed, read-only error, conflicts, ad-hoc, andselectServerEntryselection/error cases.tools/callover HTTP, and--headeroverrides the file's header.servers.tscoverage 97.8% lines / 100% functions.Acceptance criteria (#1482)
--catalog/--configinvocation applies the file'sheaders, timeouts, and OAuth to the connection.tools/call.npm run validatepasses end-to-end (web format/lint/build/coverage, CLI + TUI suites, launcher build,smoke:launcher/smoke:cli/smoke:tui/smoke:web).🤖 Generated with Claude Code