Repository navigation
Onboarding: optional MCP-catalog install step - #126
Conversation
After provider + model + API-key prompts, `pasclaw onboard` now
walks through the 5 built-in MCP catalogue entries (replicate,
digitalocean-apps, digitalocean-databases, runpod-docs, huggingface),
prompting `Enable [y/N]:` (default off, picoclaw-style — never
preloaded without explicit opt-in) and capturing the API token
inline. Selected entries get upserted into Cfg.MCPServers with a
literal "Bearer <token>" Authorization header in the Args field —
same shape `pasclaw mcp install <name>` writes today, so list /
remove / test / show all keep working.
Behaviour:
- Already-installed entries print "(already installed —
skipping)" so re-running onboard preserves whatever the user
set up via `pasclaw mcp install` earlier.
- When the env var is already set (e.g. REPLICATE_API_TOKEN
exported in the shell), the prompt is skipped and the env
value is used — matches `pasclaw mcp install` for symmetry.
- When the env var isn't set, prompt for the token. Blank input
installs with no auth and warns to re-run with env set.
- Auth-less entries (runpod-docs today) skip the token prompt
entirely and install with an empty Args.
Wiring:
- New helper FormatAuthHeaderFromToken in PasClaw.MCP.Catalog —
sibling to ResolveAuthHeader. ResolveAuthHeader sources the
token from the env var; the new helper takes it as an
argument so the onboarding flow can prompt the user and persist
the resulting header directly without requiring the env var.
- UpsertCatalogMCP private helper in Cmd.Onboard.pas mirrors the
upsert logic in Cmd.MCP.DoInstall (refresh existing entry by
name, otherwise append).
- PromptMCPInstalls iterates KnownMCPServers, drives the prompts.
- Replicate catalogue Desc updated to mention the 5000+ model
count so `pasclaw mcp catalog` and the onboarding prompt both
surface it. README MCP-catalog table follows.
Verified end-to-end with a scripted stdin run that picks Anthropic
(default), enables replicate (with a test token) + runpod-docs (no
auth), declines the others. Resulting config.json shows the
Replicate entry with `args: "Bearer r8_test_..."` and the runpod
entry with `args: ""`, both `enabled: true`. Build + smoke 11/11
clean.
https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fc82a959c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| end | ||
| else | ||
| begin | ||
| Token := Trim(ReadLineEcho(' ' + Entry.EnvVar + ' (paste, or blank to skip auth): ')); |
There was a problem hiding this comment.
Read pasted MCP tokens without terminal echo
When an MCP auth environment variable is absent and the user opts in, this prompt reads the pasted API token with ReadLineEcho, so the credential remains visible in terminal scrollback and can be captured by terminal recording, screen sharing, or shared-session logs. Use a no-echo secret-input helper for MCP tokens before formatting and persisting the authorization header.
Useful? React with 👍 / 👎.
P2 — Codex flagged the MCP token paste during onboarding: pasted
credentials remained visible in terminal scrollback, screen
recordings, and shared-session logs. Fix: new ReadSecretLine
helper in PasClaw.CliUI, used by both the MCP token prompts and
the original provider API-key prompt (which had the identical
exposure pre-existing — extending the fix while we're here).
Implementation:
- POSIX path uses BaseUnix + TermIO. tcgetattr to snapshot current
termios, clear the ECHO flag with tcsetattr(TCSANOW), ReadLn
inside a try/finally, restore termios on the way out. ICANON
stays on so backspace still works and the line is delivered on
Enter — only echo is suppressed.
- Windows path uses GetConsoleMode / SetConsoleMode to disable
ENABLE_ECHO_INPUT around the ReadLn, with the same try/finally
restore.
- Both paths emit a trailing WriteLn when no-echo was in effect
so the next prompt starts on a fresh line (the user's Enter
was suppressed visually).
- When tcgetattr / GetConsoleMode fails — most commonly stdin
being a pipe in scripted tests — the helper falls through to
a plain echoing ReadLn so non-interactive automation keeps
working unchanged. Verified end-to-end with the same scripted
onboarding from PR #126 description.
- Unknown-platform branch (neither UNIX nor MSWINDOWS) falls
through to plain ReadLn — same behaviour as today, just no
no-echo protection.
Updated Cmd.Onboard.pas to call ReadSecretLine for:
- the provider API key prompt (originally ReadLineEcho)
- the MCP env-var token prompt (the one Codex flagged)
Build clean (443958 lines), smoke 11/11 OK.
https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
Three issues from Codex's review of PR #203, all legit. 1. AV in --no-tools mode (PR #203 review, P2). Reg can be intentionally nil ("pasclaw agent --no-tools"); the router call evaluated Reg.Names unconditionally and crashed every non-offline turn in that mode, even with auto_router.enabled=False. Fix: pass a nil tool array when Reg is nil. The classifier already tolerates an empty list -- write/run tool-mix gate just doesn't fire, which is correct for --no-tools (there ARE no tools). Test: TestNilToolsArraySafe. 2. Easy provider sent the primary's model (PR #203 review, P2). When auto_router.easy_model was omitted, the caller left LoopCfg.Model set to the primary's value from BuildLoopConfig, so a routed turn shipped e.g. claude-opus-4-8 to Groq and 4xx'd. Fix: RouteProvider now resolves the model itself in three steps (explicit override -> per-provider stored Model -> catalog DefaultModel) and refuses to route if all three are empty rather than handing the loop something it'll fail on. Caller no longer needs the empty-string branch -- LoopCfg.Model is always set on routed turns. Tests: TestRouteProviderFallsBackToProviderStoredModel (step 2), TestRouteProviderResolvesCatalogDefault (step 3), TestRouteProviderRefusesWithoutResolvableModel (refusal). 3. Fallback API key was echoed (PR #203 review, P2). PromptAutoRouter used ReadLineEcho for the API-key prompt, so the pasted credential landed in terminal scrollback and screen recordings. The primary provider path in the same command uses ReadSecretLine for the identical prompt; the fallback prompt now does the same. (Same exposure pattern Codex flagged on PR #126 for MCP tokens.)
Summary
After provider + model + API-key prompts,
pasclaw onboardnow walks through the 5 built-in MCP catalogue entries (replicate,digitalocean-apps,digitalocean-databases,runpod-docs,huggingface), promptingEnable [y/N]:(default off, picoclaw-style — never preloaded without explicit opt-in) and capturing the API token inline.What you see
Resulting
config.json:Same shape
pasclaw mcp install <name>writes today, solist / show / test / removeall work unchanged.Behaviour notes
(already installed — skipping)so re-runningonboardpreserves whatever the user set up viapasclaw mcp installearlier.REPLICATE_API_TOKENexported in the shell), the prompt is skipped and the env value is used — matchespasclaw mcp installfor symmetry.runpod-docstoday) skip the token prompt and install with an emptyArgs.Wiring
FormatAuthHeaderFromTokeninPasClaw.MCP.Catalog— sibling toResolveAuthHeader. The existing function sources the token from the env var; the new one takes it as an argument so onboarding can prompt the user and persist the resulting header directly.UpsertCatalogMCPprivate helper inCmd.Onboard.pasmirrors the upsert logic inCmd.MCP.DoInstall(refresh existing entry by name, otherwise append).PromptMCPInstallsiteratesKnownMCPServersand drives the prompts; called betweenUpsertProviderandSaveConfig.Descupdated to mention the 5000+ model count so bothpasclaw mcp catalogand the onboarding prompt surface it. README MCP-catalog row follows.Test plan
make smoke11/11 OKconfig.jsonmatches the example abovepasclaw onboardin a real terminal, walk through interactively, thenpasclaw mcp listto confirm both new servers show up enabledGenerated by Claude Code