Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mark3labs/mcp-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.36.0
Choose a base ref
...
head repository: mark3labs/mcp-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.37.0
Choose a head ref
  • 8 commits
  • 32 files changed
  • 9 contributors

Commits on Jul 30, 2025

  1. Replace Prompts/Resources/Resource Templates (#518)

    * Replace all Prompts
    
    Signed-off-by: David Gageot <david.gageot@docker.com>
    
    * Replace all Resources
    
    Signed-off-by: David Gageot <david.gageot@docker.com>
    
    * Replace all Resource Templates
    
    Signed-off-by: David Gageot <david.gageot@docker.com>
    
    ---------
    
    Signed-off-by: David Gageot <david.gageot@docker.com>
    dgageot authored Jul 30, 2025
    Configuration menu
    Copy the full SHA
    4cca302 View commit details
    Browse the repository at this point in the history

Commits on Jul 31, 2025

  1. Configuration menu
    Copy the full SHA
    96de112 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2025

  1. Configuration menu
    Copy the full SHA
    57740b6 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2025

  1. Configuration menu
    Copy the full SHA
    6e5d6fd View commit details
    Browse the repository at this point in the history
  2. feat: implement sampling support for Streamable HTTP transport (#515)

    * feat: implement sampling support for Streamable HTTP transport
    
    Implements sampling capability for HTTP transport, resolving issue #419.
    Enables servers to send sampling requests to HTTP clients via SSE and
    receive LLM-generated responses.
    
    ## Key Changes
    
    ### Core Implementation
    - Add `BidirectionalInterface` support to `StreamableHTTP`
    - Implement `SetRequestHandler` for server-to-client requests
    - Enhance SSE parsing to handle requests alongside responses/notifications
    - Add `handleIncomingRequest` and `sendResponseToServer` methods
    
    ### HTTP-Specific Features
    - Leverage existing MCP headers (`Mcp-Session-Id`, `Mcp-Protocol-Version`)
    - Bidirectional communication via HTTP POST for responses
    - Proper JSON-RPC request/response handling over HTTP
    
    ### Error Handling
    - Add specific JSON-RPC error codes for different failure scenarios:
      - `-32601` (Method not found) when no handler configured
      - `-32603` (Internal error) for sampling failures
      - `-32800` (Request cancelled/timeout) for context errors
    - Enhanced error messages with sampling-specific context
    
    ### Testing & Examples
    - Comprehensive test suite in `streamable_http_sampling_test.go`
    - Complete working example in `examples/sampling_http_client/`
    - Tests cover success flows, error scenarios, and interface compliance
    
    ## Technical Details
    
    The implementation maintains full backward compatibility while adding
    bidirectional communication support. Server requests are processed
    asynchronously to avoid blocking the SSE stream reader.
    
    HTTP transport now supports the complete sampling flow that was
    previously only available in stdio and inprocess transports.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * feat: implement server-side sampling support for HTTP transport
    
    This completes the server-side implementation of sampling support for
    HTTP transport, addressing the remaining requirements from issue #419.
    
    Changes:
    - Enhanced streamableHttpSession to implement SessionWithSampling interface
    - Added bidirectional SSE communication for server-to-client requests
    - Implemented session registry for proper response correlation
    - Added comprehensive error handling with JSON-RPC error codes
    - Created extensive test suite covering all scenarios
    - Added working example server with sampling tools
    
    Key Features:
    - Server can send sampling requests to HTTP clients via SSE
    - Clients respond via HTTP POST with proper session correlation
    - Queue overflow protection and timeout handling
    - Compatible with existing HTTP transport architecture
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: replace time.Sleep with synchronization primitives in tests
    
    Replace flaky time.Sleep calls with proper synchronization using channels
    and sync.WaitGroup to make tests deterministic and avoid race conditions.
    
    Also improves error handling robustness in test servers with proper JSON
    decoding error checks.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve request detection logic and add nil pointer checks
    
    - Make request vs response detection more robust by checking for presence
      of "method" field instead of relying on nil Result/Error fields
    - Add nil pointer check in sendResponseToServer function to prevent panics
    
    These changes improve reliability against malformed messages and edge cases.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: correct misleading comment about response delivery
    
    The comment incorrectly stated that responses are broadcast to all sessions,
    but the implementation actually delivers responses to the specific session
    identified by sessionID using the activeSessions registry.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: implement EnableSampling() to properly declare sampling capability
    
    Previously, EnableSampling() was a no-op that didn't actually enable the
    sampling capability in the server's declared capabilities.
    
    Changes:
    - Add Sampling field to mcp.ServerCapabilities struct
    - Add sampling field to internal serverCapabilities struct
    - Update EnableSampling() to set the sampling capability flag
    - Update handleInitialize() to include sampling in capability response
    - Add test to verify sampling capability is properly declared
    
    Now when EnableSampling() is called, the server will properly declare
    sampling capability during initialization, allowing clients to know
    that the server supports sending sampling requests.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: prevent panic from unsafe type assertion in example server
    
    Replace unsafe type assertion result.Content.(mcp.TextContent).Text
    with safe type checking to handle cases where Content might not
    be a TextContent struct.
    
    Now gracefully handles different content types without panicking.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: add missing EnableSampling() call in interface test
    
    The SamplingInterface test was missing the EnableSampling() call,
    which is necessary to activate sampling features for proper testing.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: expand error test coverage and avoid t.Fatalf
    
    - Replace single error test with comprehensive table-driven tests
    - Add test cases for invalid request IDs and malformed results
    - Replace t.Fatalf with t.Errorf to follow project conventions
    - Use proper session ID format for valid test scenarios
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: eliminate recursive response handling and improve routing
    
    - Remove recursive call in RequestSampling that could cause stack overflow
    - Remove problematic response re-queuing to global channel
    - Update deliverSamplingResponse to route responses directly to
      dedicated request channels via samplingRequests map lookup
    - This prevents ordering issues and ensures responses reach
      the correct waiting request
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve sampling response delivery robustness
    
    - Modified deliverSamplingResponse to return error instead of just logging
    - Added proper error handling for disconnected sessions
    - Improved error messages for debugging
    - Updated test expectations to match new error behavior
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: add graceful shutdown handling to sampling client
    
    - Add signal handling for SIGINT and SIGTERM
    - Move defer statement after error checking
    - Improve shutdown error handling
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve context handling in streamable HTTP transport
    
    - Add timeout context for SSE response processing (30s default)
    - Add timeout for individual connection attempts in listenForever (10s)
    - Use context-aware sleep in retry logic
    - Ensure async goroutines properly respect context cancellation
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve error message for notification channel queue full condition
    
    - Make error message more descriptive and actionable
    - Provide clearer debugging information about why the channel is blocked
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * refactor: rename struct variable for clarity in message parsing
    
    - Rename 'baseMessage' to 'jsonMessage' for more neutral naming
    - Improves code readability and follows consistent naming conventions
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * test: add concurrent sampling requests test with response association
    
    Add test verifying that concurrent sampling requests are handled correctly
    when the second request completes faster than the first. The test ensures:
    - Responses are correctly associated with their request IDs
    - Server processes requests concurrently without blocking
    - Completion order follows actual processing time, not submission order
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve context handling in async goroutine
    
    Create new context with 30-second timeout for request handling
    to prevent long-running handlers from blocking indefinitely.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * refactor: replace interface{} with any throughout codebase
    
    Replace all occurrences of interface{} with the modern Go any type alias
    for improved readability and consistency with current Go best practices.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * fix: improve context handling in async goroutine for StreamableHTTP
    
    Create timeout context from parent context instead of context.Background()
    to ensure request handlers respect parent context cancellation.
    
    Addresses review comment about context handling in async goroutine.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * refactor: remove unused samplingResponseChan field from session struct
    
    The samplingResponseChan field was declared but never used in the
    streamableHttpSession struct. Remove it and update tests accordingly.
    
    Addresses review comment about unused fields in session struct.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * feat: add graceful shutdown handling to sampling HTTP client example
    
    Add signal handling for SIGINT and SIGTERM to allow graceful shutdown
    of the sampling HTTP client example. This prevents indefinite blocking
    and provides better production-ready behavior.
    
    Addresses review comment about adding graceful shutdown handling.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    * refactor: remove unused mu field from streamableHttpSession
    
    Removes unused sync.RWMutex field that was flagged by golangci-lint.
    
    🤖 Generated with [Claude Code](https://claude.ai/code)
    
    Co-Authored-By: Claude <noreply@anthropic.com>
    
    ---------
    
    Co-authored-by: Claude <noreply@anthropic.com>
    andig and claude authored Aug 4, 2025
    Configuration menu
    Copy the full SHA
    fda6b38 View commit details
    Browse the repository at this point in the history
  3. Fix SSE transport not properly handling HTTP/2 NO_ERROR disconnections (

    #509)
    
    * Add OnConnectionLost method to Client and SSE transport to handle HTTP2 idle timeout disconnections gracefully. This allows applications to distinguish between actual errors and expected connection drops.
    
    * test: Add comprehensive NO_ERROR handling tests for SSE transport
    
    * fix: Make NO_ERROR handling backward compatible and optimize performance
    
    * fix: Make NO_ERROR handling backward compatible and add documentation
    okoshi-f authored Aug 4, 2025
    Configuration menu
    Copy the full SHA
    a63f10e View commit details
    Browse the repository at this point in the history
  4. feat: add thread-safe SetExpectedState for cross-request OAuth flows (

    #500)
    
    Enables OAuth state management when initialization and callback steps
    are handled by different OAuthHandler instances, such as in web servers
    where separate HTTP request handlers process the auth flow stages.
    
    - Add SetExpectedState method for explicit state configuration
    - Add mutex protection for thread-safe expectedState access
    - Add comprehensive test for cross-request scenario validation
    sd2k authored Aug 4, 2025
    Configuration menu
    Copy the full SHA
    9259d32 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2025

  1. 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>
    caarlos0 authored Aug 5, 2025
    Configuration menu
    Copy the full SHA
    6da5cd1 View commit details
    Browse the repository at this point in the history
Loading