Skip to content

feat: add connectTimeout, requestTimeout, and logger options to client builder and transport#79

Open
stenalpjolly wants to merge 1 commit into
googleapis:mainfrom
stenalpjolly:stenalpjolly_pr2-transport-options
Open

feat: add connectTimeout, requestTimeout, and logger options to client builder and transport#79
stenalpjolly wants to merge 1 commit into
googleapis:mainfrom
stenalpjolly:stenalpjolly_pr2-transport-options

Conversation

@stenalpjolly

Copy link
Copy Markdown
Contributor

Summary

Adds connectTimeout(), requestTimeout(), and logger() options to McpToolboxClient.Builder (McpToolboxClientBuilder) and cascades these options down to BaseMcpTransport and all HttpMcpTransport version delegates (HttpMcpTransportV20241105, HttpMcpTransportV20250326, HttpMcpTransportV20250618, HttpMcpTransportV20251125).

Expectation & Implementation

  • Expectation: Callers should be able to configure custom connection and request timeouts for HTTP requests made by the MCP client, as well as pass a custom java.util.logging.Logger instance for telemetry and logging.
  • Implementation:
    • Added connectTimeout(), requestTimeout(), and logger() methods to McpToolboxClient.Builder interface and McpToolboxClientBuilder.
    • Added constructors to BaseMcpTransport, HttpMcpTransport, and all HttpMcpTransportV* delegate classes accepting connectTimeout, requestTimeout, and logger.
    • Configured HttpClient.Builder with the specified connectTimeout (defaulting to 10 seconds).
    • Configured HttpRequest.Builder with requestTimeout during listTools and invokeTool requests when specified.
    • Replaced static logger calls with activeLogger initialized from the provided logger or default class logger.

Test cases

  • Added testInvokeTool_WithRequestTimeout in HttpMcpTransportTest to verify that instantiating HttpMcpTransport with custom request/connect timeouts successfully applies configurations across transport delegation and completes invokeTool calls cleanly.
  • Executed mvn clean test jacoco:report -Dtest="*Test,!*E2ETest" -Dnet.bytebuddy.experimental=true verifying 129 tests pass cleanly across the SDK.

Acceptance criteria

  • McpToolboxClient.Builder provides connectTimeout, requestTimeout, and logger configuration methods.
  • Transport constructors accept and apply custom connection/request timeouts and logger.
  • All unit and validation test suites pass cleanly with 100% backward compatibility for existing constructors.

Breaking changes

None. Secondary constructors are provided to maintain full backward compatibility for existing transport and client instantiations.

@stenalpjolly
stenalpjolly requested a review from a team as a code owner July 14, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant