Tags: mark3labs/mcp-go
Tags
fix: Add missing session cleanup to the StreamableHTTPServer DELETE h… …andler (#667) * fix: Add missing session cleanup to the StreamableHTTPServer DELETE handler * Fix merge typo --------- Co-authored-by: Connor Zanin <[email protected]>
fix: handle either $defs or definitions field when unmarshaling ToolA… …rgumentsSchema (#645) Older versions of the JSON Schema spec use the "definitions" field, while newer versions use "$defs". This can be seen in the Honeycomb MCP, which uses "definitions". This commit adds support for both fields, and prefers "$defs" over "definitions" if both are present.
feat: add SessionWithResourceTemplates for session-specific resource … …templates (#624) * feat: add SessionWithResourceTemplates for session-specific resource templates Implements session-specific resource templates to achieve parity with SessionWithTools and SessionWithResources. This allows sessions to have their own resource templates that override global templates with the same URI pattern. Key changes: - Add SessionWithResourceTemplates interface to ClientSession hierarchy - Implement interface in both SSE and StreamableHTTP transports - Add AddSessionResourceTemplate(s) and DeleteSessionResourceTemplates methods - Update handleListResourceTemplates to merge session and global templates - Update handleReadResource to check session templates before global ones - Session templates trigger notifications/resources/list_changed when modified Closes #622 * test: add comprehensive tests for session resource templates - Add sessionTestClientWithResourceTemplates mock - Test AddSessionResourceTemplate and AddSessionResourceTemplates - Test DeleteSessionResourceTemplates - Test session template override behavior - Test notification behavior (enabled/disabled) - Test uninitialized session handling - Test error cases for unsupported sessions - Verify thread-safety through existing patterns Coverage increased from 70.17% to 72.8% (+2.63%) * refactor: address CodeRabbit review comments - Use atomic.Bool for initialized field in test mock to prevent data races - Add nil checks for URITemplate in handleReadResource for both session and global templates - Add validation in AddSessionResourceTemplates to prevent nil URITemplate, empty URI, or empty Name - Simplify Get/SetSessionResourceTemplates using maps.Clone - Fix test initialization states to match expected behavior All tests pass with race detector.
[disable-stream] Add WithDisableStreaming option to StreamableHTTP se… …rver to allow disabling streaming (#613) * [disable-stream] Add `WithDisableStreaming` option to StreamableHTTP server to allow disabling streaming [Per the spec](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#listening-for-messages-from-the-server), a server is allowed to respond with 405 in response to a request for streaming. In our use case, we do not need streaming, and do not want to support it at a network layer. * [disable-stream] bounce * [disable-stream] tests * [disable-stream] fix docstring * [disable-stream] logging * [disable-stream] bounce
PreviousNext