Skip to content

Comments

feat: buffer init script output to comply with MCP protocol#1

Draft
localai-bot wants to merge 1 commit intomasterfrom
feature/buffer-init-script-output
Draft

feat: buffer init script output to comply with MCP protocol#1
localai-bot wants to merge 1 commit intomasterfrom
feature/buffer-init-script-output

Conversation

@localai-bot
Copy link
Owner

Fix: Buffer init script output to comply with MCP protocol

Problem

The shell MCP server currently redirects stdout/stderr of the SHELL_INIT_SCRIPT directly to the main process, which breaks the MCP protocol by injecting uncontrolled terminal output.

Solution

Replaced direct os.Stdout/os.Stderr redirection with cmd.CombinedOutput() to capture all output in memory. Output is only printed to stderr if the script fails (via log.Fatalf). Otherwise, output is silently discarded, ensuring protocol compliance.

Impact

  • No more unintended terminal noise during normal operation.
  • Full error visibility if init script fails.
  • Maintains backward compatibility for error cases.

Closes: #123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant