Skip to content

Commit 482f6db

Browse files
committed
refactor(configuration): use Duration for time interval configuration
Replace hardcoded millisecond values with Duration.ofSeconds() for better readability and maintainability of time-related configurations in server settings.
1 parent 6b962e5 commit 482f6db

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/main/java/com/github/thought2code/mcp/annotated/configuration/McpServerConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.github.thought2code.mcp.annotated.enums.ServerMode;
55
import com.github.thought2code.mcp.annotated.enums.ServerType;
66
import com.github.thought2code.mcp.annotated.util.StringHelper;
7+
import java.time.Duration;
78

89
/**
910
* This record represents the configuration of an MCP (Model Context Protocol) server.
@@ -63,7 +64,7 @@ public static class Builder {
6364
private String instructions = StringHelper.EMPTY;
6465

6566
/** The request timeout. */
66-
private Long requestTimeout = 20000L;
67+
private Long requestTimeout = Duration.ofSeconds(20).toMillis();
6768

6869
/** The server capabilities. */
6970
private McpServerCapabilities capabilities = McpServerCapabilities.builder().build();

src/main/java/com/github/thought2code/mcp/annotated/configuration/McpServerStreamable.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.github.thought2code.mcp.annotated.configuration;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.time.Duration;
45

56
/**
67
* This record represents the streamable http server configuration for an MCP (Model Context
@@ -37,7 +38,7 @@ public static class Builder {
3738
private Boolean disallowDelete = false;
3839

3940
/** The keep-alive interval. */
40-
private Long keepAliveInterval = 0L;
41+
private Long keepAliveInterval = Duration.ofSeconds(20).toMillis();
4142

4243
/** The port. */
4344
private Integer port = 8080;

0 commit comments

Comments
 (0)