feat(mcp): upgrade gateway MCP server protocol to SSE for natural language agent integration

This commit is contained in:
jade
2026-07-14 17:58:07 +09:00
parent f359772782
commit c3d8818dfd
4 changed files with 9 additions and 12 deletions

View File

@@ -1,10 +1,7 @@
{ {
"mcpServers": { "mcpServers": {
"axhub-gateway": { "axhub-gateway": {
"command": "java", "url": "http://localhost:8281/mcp/sse"
"args": [
"C:/eGovFrameDev-4.3.1-64bit/workspace-egov/axhub-backend-main/McpBridge.java"
]
} }
} }
} }

View File

@@ -2,7 +2,7 @@ package io.shinhanlife.axhub.biz.mcp.gateway.sync;
import io.shinhanlife.axhub.biz.mcp.gateway.dto.ToolMetadata; import io.shinhanlife.axhub.biz.mcp.gateway.dto.ToolMetadata;
import io.shinhanlife.axhub.biz.mcp.gateway.service.ExecuteService; import io.shinhanlife.axhub.biz.mcp.gateway.service.ExecuteService;
import io.modelcontextprotocol.server.McpStatelessServerFeatures; import io.modelcontextprotocol.server.McpServerFeatures;
import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
@@ -31,14 +31,14 @@ public class RegistryMcpToolSpecificationFactory {
/** /**
* Registry Entry 하나를 MCP SDK의 stateless sync Tool specification으로 변환합니다. * Registry Entry 하나를 MCP SDK의 stateless sync Tool specification으로 변환합니다.
*/ */
public McpStatelessServerFeatures.SyncToolSpecification create(ToolMetadata entry) { public McpServerFeatures.SyncToolSpecification create(ToolMetadata entry) {
McpSchema.Tool tool = McpSchema.Tool.builder() McpSchema.Tool tool = McpSchema.Tool.builder()
.name(entry.getName()) .name(entry.getName())
.description(description(entry)) .description(description(entry))
.inputSchema(inputSchema(entry)) .inputSchema(inputSchema(entry))
.build(); .build();
return McpStatelessServerFeatures.SyncToolSpecification.builder() return McpServerFeatures.SyncToolSpecification.builder()
.tool(tool) .tool(tool)
.callHandler((context, request) -> execute(entry, request)) .callHandler((context, request) -> execute(entry, request))
.build(); .build();

View File

@@ -2,7 +2,7 @@ package io.shinhanlife.axhub.biz.mcp.gateway.sync;
import io.shinhanlife.axhub.biz.mcp.gateway.dto.ToolMetadata; import io.shinhanlife.axhub.biz.mcp.gateway.dto.ToolMetadata;
import io.shinhanlife.axhub.biz.mcp.gateway.registry.RedisRegistryService; import io.shinhanlife.axhub.biz.mcp.gateway.registry.RedisRegistryService;
import io.modelcontextprotocol.server.McpStatelessSyncServer; import io.modelcontextprotocol.server.McpSyncServer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
@@ -24,13 +24,13 @@ import java.util.stream.Collectors;
public class RegistryMcpToolSynchronizer { public class RegistryMcpToolSynchronizer {
private static final Logger log = LoggerFactory.getLogger(RegistryMcpToolSynchronizer.class); private static final Logger log = LoggerFactory.getLogger(RegistryMcpToolSynchronizer.class);
private final ObjectProvider<McpStatelessSyncServer> mcpServerProvider; private final ObjectProvider<McpSyncServer> mcpServerProvider;
private final RedisRegistryService redisRegistryService; private final RedisRegistryService redisRegistryService;
private final RegistryMcpToolSpecificationFactory specificationFactory; private final RegistryMcpToolSpecificationFactory specificationFactory;
private final Set<String> managedToolNames = new LinkedHashSet<>(); private final Set<String> managedToolNames = new LinkedHashSet<>();
private final ReentrantLock lock = new ReentrantLock(); private final ReentrantLock lock = new ReentrantLock();
public RegistryMcpToolSynchronizer(ObjectProvider<McpStatelessSyncServer> mcpServerProvider, public RegistryMcpToolSynchronizer(ObjectProvider<McpSyncServer> mcpServerProvider,
RedisRegistryService redisRegistryService, RedisRegistryService redisRegistryService,
RegistryMcpToolSpecificationFactory specificationFactory) { RegistryMcpToolSpecificationFactory specificationFactory) {
this.mcpServerProvider = mcpServerProvider; this.mcpServerProvider = mcpServerProvider;
@@ -49,7 +49,7 @@ public class RegistryMcpToolSynchronizer {
} }
public void synchronize() { public void synchronize() {
McpStatelessSyncServer server = mcpServerProvider.getIfAvailable(); McpSyncServer server = mcpServerProvider.getIfAvailable();
if (server == null) { if (server == null) {
return; return;
} }

View File

@@ -30,7 +30,7 @@ spring.lifecycle.timeout-per-shutdown-phase=20s
logging.level.org.apache.kafka=ERROR logging.level.org.apache.kafka=ERROR
# Spring AI MCP Server Settings # Spring AI MCP Server Settings
spring.ai.mcp.server.protocol=STATELESS # spring.ai.mcp.server.protocol=STATELESS
mcp.agent-claims-required=false mcp.agent-claims-required=false
mcp.trusted-claims-required=false mcp.trusted-claims-required=false
mcp.write-approval-required=false mcp.write-approval-required=false