Skip to content

Commit 3ec960d

Browse files
committed
fix(gateway): 修正 MCP Server 路径设置及相关调用逻辑
- 将 MCP Server 配置路径改为 /mcp-servers/ 前缀 - 修复 AdpAIGatewayOperator 和 ApsaraGatewayOperator 中路径设置错误 - 删除前端 ApiProductLinkApi 中对特定源路径的硬编码处理 - 移除 McpDetail 页面中针对路径的特殊拼接逻辑 - 保持路径配置统一,避免前端和后端路径不一致问题
1 parent efb9d1e commit 3ec960d

File tree

4 files changed

+2
-11
lines changed

4 files changed

+2
-11
lines changed

himarket-server/src/main/java/com/alibaba/himarket/service/gateway/AdpAIGatewayOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ private String convertToMCPConfig(
325325

326326
// 设置 MCP Server 配置
327327
MCPConfigResult.MCPServerConfig serverConfig = new MCPConfigResult.MCPServerConfig();
328-
serverConfig.setPath("/" + data.getName());
328+
serverConfig.setPath("/mcp-servers/" + data.getName());
329329

330330
// 获取网关实例访问信息并设置域名信息
331331
List<DomainResult> domains = getGatewayAccessDomains(data.getGwInstanceId(), config);

himarket-server/src/main/java/com/alibaba/himarket/service/gateway/ApsaraGatewayOperator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private String convertToMCPConfig(
195195

196196
// 设置MCP Server配置
197197
MCPConfigResult.MCPServerConfig serverConfig = new MCPConfigResult.MCPServerConfig();
198-
serverConfig.setPath("/" + data.getName());
198+
serverConfig.setPath("/mcp-servers/" + data.getName());
199199

200200
// 获取网关实例访问信息并设置域名信息
201201
List<DomainResult> domains = getGatewayAccessDomains(gwInstanceId, config);

himarket-web/himarket-admin/src/components/api-product/ApiProductLinkApi.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,6 @@ export function ApiProductLinkApi({ apiProduct, linkedService, onLinkedServiceUp
190190
const baseUrl = `${domain.protocol}://${formattedDomain}`;
191191
let fullUrl = `${baseUrl}${path || '/'}`;
192192

193-
if (apiProduct.mcpConfig?.meta?.source === 'ADP_AI_GATEWAY' ||
194-
apiProduct.mcpConfig?.meta?.source === 'APSARA_GATEWAY') {
195-
fullUrl = `${baseUrl}/mcp-servers${path || '/'}`;
196-
}
197-
198193
if (protocolType === 'SSE') {
199194
// 仅生成SSE配置,不追加/sse
200195
const sseConfig = {

himarket-web/himarket-frontend/src/pages/McpDetail.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ function McpDetail() {
110110
const baseUrl = `${domain.protocol}://${formattedDomain}`;
111111
let endpoint = `${baseUrl}${path}`;
112112

113-
if (mcpConfig?.meta?.source === 'ADP_AI_GATEWAY' || mcpConfig?.meta?.source === 'APSARA_GATEWAY') {
114-
endpoint = `${baseUrl}/mcp-servers${path}`;
115-
}
116-
117113
if (protocolType === 'SSE') {
118114
// 仅生成SSE配置,不追加/sse
119115
const sseConfig = `{

0 commit comments

Comments
 (0)