Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@

<!-- Nacos -->
<nacos2.version>2.5.1</nacos2.version>
<nacos3.version>3.0.2</nacos3.version>
<nacos3.version>3.0.3</nacos3.version>
<nacos-client-mse-extension.version>1.0.4</nacos-client-mse-extension.version>
<spring-alibaba-nacos-config.version>2023.0.1.3</spring-alibaba-nacos-config.version>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public McpEndpointInfo selectEndpoint(McpServiceRef mcpServiceRef) throws NacosE
return mcpEndpointInfo;
}

public boolean createMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
public String createMcpServer(String mcpName, McpServerBasicInfo serverSpec, McpToolSpecification toolSpec,
McpEndpointSpec endpointSpec) throws NacosException {
endpointSpec.getData().put("namespaceId", this.namespace);
return aiMaintainerService.createMcpServer(this.namespace, mcpName, serverSpec, toolSpec, endpointSpec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ private void updateAll(NacosMcpServerEndpoint newServerEndpoint) {

private McpAsyncClient clientByEndpoint(McpEndpointInfo mcpEndpointInfo, String exportPath) {
McpAsyncClient asyncClient;

String baseUrl = "http://" + mcpEndpointInfo.getAddress() + ":" + mcpEndpointInfo.getPort();
String protocol = NacosMcpClientUtils.checkProtocol(mcpEndpointInfo);
String baseUrl = protocol + "://" + mcpEndpointInfo.getAddress() + ":" + mcpEndpointInfo.getPort();
WebClient.Builder webClientBuilder = webClientBuilderTemplate.clone().baseUrl(baseUrl);

WebFluxSseClientTransport transport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ public void setLoggingLevel(McpSchema.LoggingLevel loggingLevel) {

private McpSyncClient clientByEndpoint(McpEndpointInfo mcpEndpointInfo, String exportPath) {
McpSyncClient syncClient;
String baseUrl = "http://" + mcpEndpointInfo.getAddress() + ":" + mcpEndpointInfo.getPort();
String protocol = NacosMcpClientUtils.checkProtocol(mcpEndpointInfo);
String baseUrl = protocol + "://" + mcpEndpointInfo.getAddress() + ":" + mcpEndpointInfo.getPort();
WebClient.Builder webClientBuilder = webClientBuilderTemplate.clone().baseUrl(baseUrl);

// Using the build method with link tracking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,17 @@ public static String getMcpEndpointInfoId(McpEndpointInfo mcpEndpointInfo, Strin
return mcpEndpointInfo.getAddress() + "@@" + mcpEndpointInfo.getPort() + "@@" + exportPath;
}

public static String checkProtocol(McpEndpointInfo mcpEndpointInfo) {
String protocol = mcpEndpointInfo.getProtocol();
if (protocol == null || !"http".equals(protocol) && !"https".equals(protocol)) {
if (mcpEndpointInfo.getPort() == 443 || mcpEndpointInfo.getPort() == 8443) {
protocol = "https";
}
else {
protocol = "http";
}
}
return protocol;
}

}
Loading