Tags: mark3labs/mcp-go
Tags
fix: reuse sessions correctly in streamable HTTP transport (#615) Fixes session management in the streamable HTTP server to properly reuse registered sessions for POST requests instead of always creating ephemeral sessions. This enables SendNotificationToSpecificClient and session-aware features to work correctly with POST-based interactions. Changes: - Check s.server.sessions for existing sessions before creating ephemeral ones - Register sessions after successful initialization from POST requests - Store sessions in both s.server.sessions and s.activeSessions for consistency - Add comprehensive tests for session reuse and notification delivery Fixes #614
fix: replace bufio.Scanner with bufio.Reader to support large message… …s in stdio transport (#603) The bufio.Scanner has a default 64KB token limit which causes 'token too long' errors when MCP servers send large messages (e.g., large tool responses, resource contents, or prompts). This change replaces Scanner with Reader.ReadString('\n') which can handle arbitrarily large lines. Changes: - client/transport/stdio.go: Changed stdout from *bufio.Scanner to *bufio.Reader - testdata/mockstdio_server.go: Applied same fix to mock server - client/transport/stdio_test.go: Added TestStdio_LargeMessages with tests for messages ranging from 1KB to 5MB to ensure the fix works correctly The original code (pre-commit 4e353ac) used bufio.Reader, but was incorrectly changed to Scanner claiming it would avoid panics with long lines. This fix reverts to the Reader approach which actually handles large messages correctly. Fixes issue where stdio clients fail with 'bufio.Scanner: token too long' error when communicating with servers that send large responses.
fix(tool): Do not return empty `outputSchema` (#573) * fix(tool): Do not return empty `outputSchema` If the output schema is not specify, we do not return it as we break the MCP specification that are expecting the following format: ```json "outputSchema": { "type": "object", "properties": {}, "required": [] } ``` * fix(tool): typo in test
feat: allow to set a custom logger in the SSE and STDIO clients (#525) * feat: allow to set a custom logger in the SSE client So it logs to a logger instead of stdout. Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com> * fix: tests, docs, stdio logger * chore: lint --------- Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
PreviousNext