Skip to content

Log HTTP request bodies and tool responses at debug level - #55

Open
aragossa wants to merge 1 commit into
inercia:mainfrom
aragossa:log-bodies-at-debug
Open

aragossa wants to merge 1 commit into
inercia:mainfrom
aragossa:log-bodies-at-debug

Conversation

@aragossa

Copy link
Copy Markdown

In HTTP mode, handleMCPHTTP logs every request body and every response at info, the default log level:

  • Request body: ... contains the tool arguments the agent passes (e-mail addresses, keys, anything a tool takes as a parameter).
  • Response: ... contains the tool output, i.e. whatever the shell command printed (kubectl/aws output, file contents, environment values).

With --logfile these lines also go to the file. The stdio mode does not log them.

This change moves those three lines to debug, so --log-level debug still shows them for troubleshooting, while the default info level keeps only the connection line and method=... id=....

Tested locally: built from main, ran mcp --http with a one-tool config, sent initialize and tools/call with curl. Before: arguments and output in the log at info. After: only the connection and method/id lines at info; go test ./pkg/server/... passes.

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