feat(mcp): add debug logging mode for tool calls and errors#180
Open
annextuckner wants to merge 1 commit into
Open
feat(mcp): add debug logging mode for tool calls and errors#180annextuckner wants to merge 1 commit into
annextuckner wants to merge 1 commit into
Conversation
MCP_DEBUG=true raises the log level to debug and streams pretty logs to stderr, surfacing each tool call's args and any error response live in the terminal. A central registerTool wrapper logs every tool uniformly; error responses also surface to stderr in normal runs. New server-http:debug and server-stdio:debug scripts set the flag.
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.
What
Adds a debug logging mode that surfaces tool calls and error responses live in the terminal.
lib/logger.ts— log level is now env-driven (MCP_DEBUG/LOG_LEVEL). Adds apino-prettystderr target. Errors surface to the terminal in normal runs; the full request/response stream shows when debug is on. The tmp log files still capture everything. stderr is safe in both modes — it is never the MCP protocol channel.lib/tool-logging.ts(new) —withToolLogging()wrapsregisterToolonce so every tool logs uniformly: args and successful responses at debug level, error responses and thrown errors always. The access token rides onextra.authInfoand is never logged.lib/depscore-tool.ts— apply the wrapper increateConfiguredServer, the shared factory for both transports.package.json—server-http:debug/server-stdio:debugscripts.Stacked
Based on #179 (the MCP tools PR) since both edit
createConfiguredServer. Retarget tomainonce #179 merges.Test
pnpm run test:node-test— 77 tests passtsgoclean onlib/tool call/tool result; normal mode prints only error responses to stderr