Skip to content

Commit 83899b9

Browse files
TomorJMvorburger
authored andcommitted
feat(SseServerParameters): Add configuration option for connection endpoint
This commit adds a new configuration option sseEndpoint to the SseServerParameters class, which is used to specify the exact endpoint for connecting to the SSE server. It also updates the related processing logic in DefaultMcpTransportBuilder to ensure the configuration is applied correctly.
1 parent 7c7d779 commit 83899b9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

core/src/main/java/com/google/adk/tools/mcp/DefaultMcpTransportBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public McpClientTransport build(Object connectionParams) {
2121
return new StdioClientTransport(serverParameters);
2222
} else if (connectionParams instanceof SseServerParameters sseServerParams) {
2323
return HttpClientSseClientTransport.builder(sseServerParams.url())
24-
.sseEndpoint("sse")
24+
.sseEndpoint(
25+
sseServerParams.sseEndpoint() == null ? "sse" : sseServerParams.sseEndpoint())
2526
.customizeRequest(
2627
builder ->
2728
Optional.ofNullable(sseServerParams.headers())

core/src/main/java/com/google/adk/tools/mcp/SseServerParameters.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public abstract class SseServerParameters {
2929
/** The URL of the SSE server. */
3030
public abstract String url();
3131

32+
/** The endpoint to connect to on the SSE server. */
33+
@Nullable
34+
public abstract String sseEndpoint();
35+
3236
/** Optional headers to include in the SSE connection request. */
3337
@Nullable
3438
public abstract ImmutableMap<String, Object> headers();
@@ -52,6 +56,9 @@ public abstract static class Builder {
5256
/** Sets the URL of the SSE server. */
5357
public abstract Builder url(String url);
5458

59+
/** Sets the endpoint to connect to on the SSE server. */
60+
public abstract Builder sseEndpoint(String sseEndpoint);
61+
5562
/** Sets the headers for the SSE connection request. */
5663
public abstract Builder headers(@Nullable Map<String, Object> headers);
5764

0 commit comments

Comments
 (0)