can mcp tools (and other commands) capture err/std out logs?
when calling a command that might fail you get something like:
mcp tools jbang fileserver@mcp-java
error: init response failed: error reading from stdout: EOF
in this case the issue is very clear if I could somehow see the logged stdout/err content.
Could the client capture and show that in case of error?
Yes they can capture. Actually all the logs are stored in ~/.mcpt/ you can trace.
~/.mcpt is empty for me no matter what errors I make.
same problem and ~/.mcpt is also empty
I believe ~/.mcpt/ captures logs for proxy and mock servers.
@maxandersen, If I understand correctly you would like to see the logs from the server that is being called, in your case it is jbang fileserver@mcp-java, is that right?
One way of seeing them is to run export MCP_DEBUG=1 first. Although this will print bunch of other debug lines on the code as well as the logs from server. I believe ideally we should capture stderr from server in a seperate file imo.
export MCP_DEBUG=1
mcp tools npx --verbose @jbangdev/jbang fileserver@mcp-java
Yes I was hoping something like --verbose would show the stdout/stdout happening when calling.
--server-logs works brilliantly - thanks!
this works for 'tools' but it doesn't work for 'calls' am i missing something?
You are right, apparently I forgot to change this switch statment, adding something like the code below should work, I am not available to open a PR soon, @vqndev feel free to send a PR. (cc: @f in case he wants to do it)
case cmdArgs[i] == FlagServerLogs:
ShowServerLogs = true
i++