mcp/server: enable server logging#501
Conversation
mcp/server.go
Outdated
| opts ServerOptions | ||
| impl *Implementation | ||
| opts ServerOptions | ||
| logger *slog.Logger |
There was a problem hiding this comment.
updated code to use opts.Logger
mcp/server.go
Outdated
| type ServerOptions struct { | ||
| // Optional instructions for connected clients. | ||
| Instructions string | ||
| // Logger is used for server-side logging. If nil, disable logging. |
There was a problem hiding this comment.
// If non-nil, log server activity.
There was a problem hiding this comment.
updated comment
mcp/server.go
Outdated
| }) | ||
|
|
||
| if !wasInit { | ||
| ss.server.logger.Warn("initialized before initialize") |
There was a problem hiding this comment.
If we are returning an error, shouldn't we log these as errors?
There was a problem hiding this comment.
changed from Warn to Error
mcp/streamable.go
Outdated
| type StreamableHTTPHandler struct { | ||
| getServer func(*http.Request) *Server | ||
| opts StreamableHTTPOptions | ||
| logger *slog.Logger |
There was a problem hiding this comment.
updated code to use opts.Logger
|
@jba addressed all of your review comments, can you please have a look. |
|
Could you use a logging interface instead of |
|
@dmarkhas You can write a slog.Handler to wrap your logger. |
|
This is ready to merge, but I recommend we do it after v1.0.0 to avoid last-minute changes. @findleyr |
|
@findleyr @samthanawalla just sign off on the public API. |
mcp/server.go: implement server‑side logging
All tests are passing and no functionality should change with this PR
Fixes #170