-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
Description
When smithery mcp add or smithery mcp remove is run non-interactively (piped stdin — e.g. from CI, a script, or any tool that spawns the CLI via execFile/spawn), the process hangs forever if the target client app is currently open.
Steps to Reproduce
- Have the target client app open (e.g. Opencode).
- Run:
# Run smithery with stdin as a pipe (not a TTY) to simulate CI / automation.
# Because there is no interactive terminal, the restart prompt hangs forever.
node -e "const {spawn}=require('child_process'); spawn('smithery',['mcp','add','brightdata','--client','opencode'],{stdio:['pipe','inherit','inherit']}); setInterval(()=>console.error('still running...'),2000);"Expected Behaviour
CLI detects non-TTY stdin and skips the prompt, exits cleanly.
Actual Behaviour
Process hangs indefinitely.
Additional Information
Root Cause
In src/utils/client.ts — promptForRestart() calls inquirer.prompt unconditionally when the client is running:
const isRunning = await isClientRunning(client)
if (!isRunning) return false
const { shouldRestart } = await inquirer.prompt([
{ type: "confirm", name: "shouldRestart", default: true, ... }
])promptForRestart is called at the end of both install.ts and uninstall.ts with no TTY check. When stdin is a pipe, inquirer blocks forever waiting for input that never comes.
Environment
smithery CLI version: 4.4.0
Platform: macOS (darwin)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels