inspector
inspector copied to clipboard
Normalize connection logging
DON'T MERGE UNTIL #470 IS MERGED
-
In server/index.js
- in createTransport()
- stringify query params to put them on one line
- remove logging of transport creation (done in callers)
- in /mcp POST handler
- report POST request if session id is present
- otherwise, report new StreamableHttp connection request
- report creation of server transport
- report creation of client transport
- in /stdio GET handler
- report new STDIO connection request
- report creation of server transport
- report creation of client transport
- report 401 as authentication error without stack
- in stderr data handler
- if it includes "MODULE_NOT_FOUND"
- report "Command not found"
- remove transports
- otherwise send to client as usual
- if it includes "MODULE_NOT_FOUND"
- in /sse GET handler
- report SSE connection request
- report 401 as authentication error without stack
- report 404 as server that may not support SSE
- report error with "ECONNREFUSED" as "Connection refused" without stack
- only create, map, and proxy transports if serverTransport was successfully created
- in /message POST handler
- report received POST message
- in createTransport()
-
In mcpProxy.ts
- in onServerError()
- if error message includes 404 OR error.cause includes ECONNREFUSED, report "Connection refused."
- in onServerError()
Motivation and Context
Normalize the reporting of connection success and errors. The logging is verbose and different for every server type. This is an attempt to make the console output cleaner and more readable.
How Has This Been Tested?
Connection attempts when server is present or absent. Before and after for each server type follows
SSE Connections
Existing SSE connection success
New SSE connection success
Existing SSE connection fail (no server at address)
New SSE connection fail (no server at address)
Existing SSE connection fail (no endpoint on server)
New SSE connection fail (no endpoint on server)
STDIO Connections
Existing STDIO connection success
New STDIO connection success
Existing STDIO connection fail
New STDIO connection fail
StreamableHttp Connections
Existing StreamableHttp connection success
New StreamableHttp connection success
Existing StreamableHttp connection fail
New StreamableHttp connection fail
Breaking Changes
Nope.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update
- [x] Output formatting
Checklist
- [x] I have read the MCP Documentation
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [x] I have added appropriate error handling
- [ ] I have added or updated documentation as needed
Additional context
This fixes #348