feat(mcp): upgrade gateway MCP server protocol to SSE for natural language agent integration
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"axhub-gateway": {
|
||||
"command": "java",
|
||||
"args": [
|
||||
"C:/eGovFrameDev-4.3.1-64bit/workspace-egov/axhub-backend-main/McpBridge.java"
|
||||
]
|
||||
"url": "http://localhost:8281/mcp/sse"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.service.ExecuteService;
|
||||
import io.modelcontextprotocol.server.McpStatelessServerFeatures;
|
||||
import io.modelcontextprotocol.server.McpServerFeatures;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
@@ -31,14 +31,14 @@ public class RegistryMcpToolSpecificationFactory {
|
||||
/**
|
||||
* 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()
|
||||
.name(entry.getName())
|
||||
.description(description(entry))
|
||||
.inputSchema(inputSchema(entry))
|
||||
.build();
|
||||
|
||||
return McpStatelessServerFeatures.SyncToolSpecification.builder()
|
||||
return McpServerFeatures.SyncToolSpecification.builder()
|
||||
.tool(tool)
|
||||
.callHandler((context, request) -> execute(entry, request))
|
||||
.build();
|
||||
|
||||
@@ -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.registry.RedisRegistryService;
|
||||
import io.modelcontextprotocol.server.McpStatelessSyncServer;
|
||||
import io.modelcontextprotocol.server.McpSyncServer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
@@ -24,13 +24,13 @@ import java.util.stream.Collectors;
|
||||
public class RegistryMcpToolSynchronizer {
|
||||
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 RegistryMcpToolSpecificationFactory specificationFactory;
|
||||
private final Set<String> managedToolNames = new LinkedHashSet<>();
|
||||
private final ReentrantLock lock = new ReentrantLock();
|
||||
|
||||
public RegistryMcpToolSynchronizer(ObjectProvider<McpStatelessSyncServer> mcpServerProvider,
|
||||
public RegistryMcpToolSynchronizer(ObjectProvider<McpSyncServer> mcpServerProvider,
|
||||
RedisRegistryService redisRegistryService,
|
||||
RegistryMcpToolSpecificationFactory specificationFactory) {
|
||||
this.mcpServerProvider = mcpServerProvider;
|
||||
@@ -49,7 +49,7 @@ public class RegistryMcpToolSynchronizer {
|
||||
}
|
||||
|
||||
public void synchronize() {
|
||||
McpStatelessSyncServer server = mcpServerProvider.getIfAvailable();
|
||||
McpSyncServer server = mcpServerProvider.getIfAvailable();
|
||||
if (server == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ spring.lifecycle.timeout-per-shutdown-phase=20s
|
||||
logging.level.org.apache.kafka=ERROR
|
||||
|
||||
# Spring AI MCP Server Settings
|
||||
spring.ai.mcp.server.protocol=STATELESS
|
||||
# spring.ai.mcp.server.protocol=STATELESS
|
||||
mcp.agent-claims-required=false
|
||||
mcp.trusted-claims-required=false
|
||||
mcp.write-approval-required=false
|
||||
|
||||
Reference in New Issue
Block a user