1616import io .modelcontextprotocol .spec .McpServerTransportProvider ;
1717import org .reflections .Reflections ;
1818
19+ import static io .modelcontextprotocol .server .transport .HttpServletSseServerTransportProvider .DEFAULT_BASE_URL ;
20+ import static io .modelcontextprotocol .server .transport .HttpServletSseServerTransportProvider .DEFAULT_SSE_ENDPOINT ;
21+
1922public class McpServers {
2023
2124 private static final McpServers INSTANCE = new McpServers ();
@@ -24,8 +27,6 @@ public class McpServers {
2427
2528 private static final String DEFAULT_MESSAGE_ENDPOINT = "/message" ;
2629
27- private static final String DEFAULT_SSE_ENDPOINT = "/sse" ;
28-
2930 private static final int DEFAULT_HTTP_SERVER_PORT = 8080 ;
3031
3132 private static Reflections reflections ;
@@ -80,31 +81,29 @@ public void startSyncSseServer(McpSseServerInfo serverInfo) {
8081 public void startSyncSseServer (String name , String version , String messageEndpoint , String sseEndpoint , int port ) {
8182 McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
8283 .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 )
8486 .build ();
85-
8687 startSyncSseServer (serverInfo );
8788 }
8889
8990 @ Deprecated (since = "0.2.0" )
9091 public void startSyncSseServer (String name , String version , int port ) {
9192 McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
9293 .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 )
9596 .build ();
96-
9797 startSyncSseServer (serverInfo );
9898 }
9999
100100 @ Deprecated (since = "0.2.0" )
101101 public void startSyncSseServer (String name , String version ) {
102102 McpSseServerInfo serverInfo = McpSseServerInfo .builder ().name (name ).version (version )
103103 .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 )
106106 .build ();
107-
108107 startSyncSseServer (serverInfo );
109108 }
110109
0 commit comments