Repository navigation
Conversation
…N-RPC channel Both @agent-infra/mcp-server-filesystem and @agent-infra/mcp-server-commands default to the stdio transport, where process.stdout is the JSON-RPC protocol channel (the SDK StdioServerTransport does not intercept console output). Leftover debug logging therefore injects non-JSON lines into the stream that clients parse as JSON-RPC: - mcp-server-filesystem: validatePath logged requestedPath and allowedDirectories on every tool call (and parentDir on the new-file fallback branch). - mcp-server-commands: runCommand logged the full exec result (including command output) on every successful run_command. Remove the console.log calls and add a regression test per package that fails if any console.log fires while tools are invoked. Existing console.error (stderr) logging is untouched.
✅ Deploy Preview for agent-tars-docs canceled.
|
✅ Deploy Preview for tarko canceled.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@agent-infra/mcp-server-filesystemand@agent-infra/mcp-server-commandsare published as standalone npm packages and default to the stdio transport (the READMEs instruct running them vianpxin VS Code / Cursor / Claude Desktop MCP configs). For stdio servers,process.stdoutis the JSON-RPC protocol channel: the SDK'sStdioServerTransportwrites every protocol message there and does not interceptconsoleoutput, so any strayconsole.loginjects non-JSON lines into the stream that clients try to parse as JSON-RPC.Both servers currently ship leftover debug logging on that channel:
mcp-server-filesystem:validatePath()logsrequestedPathandallowedDirectorieson every tool call (andparentDiron the new-file fallback branch).mcp-server-commands:runCommand()logs the full exec result (including command output) on every successfulrun_command.Changes:
console.logcalls inpackages/agent-infra/mcp-servers/filesystem/src/server.ts(validatePath).console.log('execute command result', result)call inpackages/agent-infra/mcp-servers/commands/src/server.ts(runCommand).console.error(stderr) logging is untouched, so error-path diagnostics keep working.No existing issue covers this; found while auditing the MCP server packages for stdio safety.
Verification: added a regression test per package that spies on
console.logand fails if any call fires while tools are invoked over an in-memory client/server pair:validatePathbranches (existing file viaread_file, new file viawrite_file) — fails onmain, passes with this patch.run_commandend to end — fails onmain, passes with this patch.Full package test suites pass after the change (the only remaining failures on a Windows dev machine are pre-existing
bash/ls-dependent tests that require a Unix shell; they are unrelated to this change and pass on Linux CI).Checklist