16
16
import io .modelcontextprotocol .spec .McpServerTransportProvider ;
17
17
import org .reflections .Reflections ;
18
18
19
+ import static io .modelcontextprotocol .server .transport .HttpServletSseServerTransportProvider .DEFAULT_BASE_URL ;
20
+ import static io .modelcontextprotocol .server .transport .HttpServletSseServerTransportProvider .DEFAULT_SSE_ENDPOINT ;
21
+
19
22
public class McpServers {
20
23
21
24
private static final McpServers INSTANCE = new McpServers ();
@@ -24,8 +27,6 @@ public class McpServers {
24
27
25
28
private static final String DEFAULT_MESSAGE_ENDPOINT = "/message" ;
26
29
27
- private static final String DEFAULT_SSE_ENDPOINT = "/sse" ;
28
-
29
30
private static final int DEFAULT_HTTP_SERVER_PORT = 8080 ;
30
31
31
32
private static Reflections reflections ;
@@ -80,31 +81,29 @@ public void startSyncSseServer(McpSseServerInfo serverInfo) {
80
81
public void startSyncSseServer (String name , String version , String messageEndpoint , String sseEndpoint , int port ) {
81
82
McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
82
83
.instructions ("You are using a deprecated API with default server instructions" )
83
- .baseUrl ("" ).messageEndpoint (messageEndpoint ).sseEndpoint (sseEndpoint ).port (port )
84
+ .baseUrl (DEFAULT_BASE_URL ).messageEndpoint (messageEndpoint )
85
+ .sseEndpoint (sseEndpoint ).port (port )
84
86
.build ();
85
-
86
87
startSyncSseServer (serverInfo );
87
88
}
88
89
89
90
@ Deprecated (since = "0.2.0" )
90
91
public void startSyncSseServer (String name , String version , int port ) {
91
92
McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
92
93
.instructions ("You are using a deprecated API with default server instructions" )
93
- .baseUrl ("" ).messageEndpoint (DEFAULT_MESSAGE_ENDPOINT ). sseEndpoint ( DEFAULT_SSE_ENDPOINT )
94
- .port (port )
94
+ .baseUrl (DEFAULT_BASE_URL ).messageEndpoint (DEFAULT_MESSAGE_ENDPOINT )
95
+ .sseEndpoint ( DEFAULT_SSE_ENDPOINT ). port (port )
95
96
.build ();
96
-
97
97
startSyncSseServer (serverInfo );
98
98
}
99
99
100
100
@ Deprecated (since = "0.2.0" )
101
101
public void startSyncSseServer (String name , String version ) {
102
102
McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
103
103
.instructions ("You are using a deprecated API with default server instructions" )
104
- .baseUrl ("" ).messageEndpoint (DEFAULT_MESSAGE_ENDPOINT ). sseEndpoint ( DEFAULT_SSE_ENDPOINT )
105
- .port (DEFAULT_HTTP_SERVER_PORT )
104
+ .baseUrl (DEFAULT_BASE_URL ).messageEndpoint (DEFAULT_MESSAGE_ENDPOINT )
105
+ .sseEndpoint ( DEFAULT_SSE_ENDPOINT ). port (DEFAULT_HTTP_SERVER_PORT )
106
106
.build ();
107
-
108
107
startSyncSseServer (serverInfo );
109
108
}
110
109
0 commit comments