refactor: Fix all inline FQ names with proper imports and add Javadoc to 67 files
This commit is contained in:
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway
|
||||
* @className DapGatewayApplication
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.audit;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.audit
|
||||
* @className AuditLogService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.security.McpRequestContext;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.config;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.config
|
||||
* @className AgentResponseBudgetProperties
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.config;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.config
|
||||
* @className McpGatewayProperties
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.guardrail;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.guardrail
|
||||
* @className GuardrailService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.ToolExecutionException;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.guardrail;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.guardrail
|
||||
* @className SensitiveDataMasker
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.guardrail;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.guardrail
|
||||
* @className ToolResponseGuardrailService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.ToolExecutionException;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.presentation;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.presentation
|
||||
* @className ChatController
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.registry.RedisRegistryService;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.service.ExecuteService;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.presentation;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.presentation
|
||||
* @className McpRouterController
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.shinhanlife.dap.biz.mcp.adapter.dto.JsonRpcRequest;
|
||||
import io.shinhanlife.dap.biz.mcp.adapter.dto.JsonRpcResponse;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.presentation;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.presentation
|
||||
* @className ScaffoldingController
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.common.util.PodScaffolder;
|
||||
import io.shinhanlife.dap.common.util.ToolScaffolder;
|
||||
import io.shinhanlife.dap.common.util.ToolSourceUpdater;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.redis;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.redis
|
||||
* @className McpMonitorEventService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.redis;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.redis
|
||||
* @className RedisToolTraceService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.security.McpRequestContext;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className CircuitBreaker
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className CircuitBreakerMonitorController
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className CircuitBreakerService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className CircuitBreakerSnapshot
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* MCP Monitor 화면에 내려주는 Circuit Breaker 상태 정보입니다.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className CircuitBreakerState
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* Circuit Breaker의 현재 상태입니다.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className FailureType
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* Tool/EIMS/Tool 서버 호출 실패를 업무적으로 구분하기 위한 장애 유형입니다.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className RetryPolicy
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* Tool 호출 재시도 정책입니다.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.resilience;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.resilience
|
||||
* @className ToolExecutionException
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
/**
|
||||
* Tool 실행 중 발생한 오류를 FailureType과 함께 전달하는 공통 예외입니다.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.security;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.security
|
||||
* @className McpRequestContext
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.security;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.security
|
||||
* @className McpRequestContextResolver
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.security;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.security
|
||||
* @className ToolAuthorizationService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.ToolExecutionException;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.service;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.service
|
||||
* @className ExecuteService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.util.HashMap;
|
||||
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
|
||||
@@ -1,17 +1,36 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.sync
|
||||
* @className CustomWebMvcSseServerTransportProvider
|
||||
* @description AX HUB MCP Gateway SSE 전송 제공자 - SSE 기반의 MCP 서버 트랜스포트를 구현하는 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.modelcontextprotocol.json.TypeRef;
|
||||
import io.modelcontextprotocol.spec.McpSchema;
|
||||
import io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage;
|
||||
import io.modelcontextprotocol.spec.McpSchema.JSONRPCNotification;
|
||||
import io.modelcontextprotocol.spec.McpSchema.JSONRPCRequest;
|
||||
import io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse;
|
||||
import io.modelcontextprotocol.spec.McpServerSession;
|
||||
import io.modelcontextprotocol.spec.McpServerTransport;
|
||||
import io.modelcontextprotocol.spec.McpServerTransportProvider;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.servlet.function.RouterFunction;
|
||||
import org.springframework.web.servlet.function.RouterFunctions;
|
||||
import org.springframework.web.servlet.function.ServerResponse;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -62,53 +81,53 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
|
||||
.toList());
|
||||
}
|
||||
|
||||
public org.springframework.web.servlet.mvc.method.annotation.SseEmitter handleSse() {
|
||||
public SseEmitter handleSse() {
|
||||
if (sessionFactory == null) {
|
||||
throw new IllegalStateException("SessionFactory not configured");
|
||||
}
|
||||
|
||||
org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter = new org.springframework.web.servlet.mvc.method.annotation.SseEmitter(-1L);
|
||||
|
||||
SseEmitter emitter = new SseEmitter(-1L);
|
||||
String sessionId = UUID.randomUUID().toString();
|
||||
|
||||
|
||||
CustomMcpSessionTransport sessionTransport = new CustomMcpSessionTransport(emitter, sessionId);
|
||||
McpServerSession session = sessionFactory.create(sessionTransport);
|
||||
sessions.put(sessionId, session);
|
||||
|
||||
|
||||
emitter.onCompletion(() -> sessions.remove(sessionId));
|
||||
emitter.onTimeout(() -> sessions.remove(sessionId));
|
||||
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
emitter.send(org.springframework.web.servlet.mvc.method.annotation.SseEmitter.event().name("endpoint").data(messageEndpoint + "?sessionId=" + sessionId));
|
||||
emitter.send(SseEmitter.event().name("endpoint").data(messageEndpoint + "?sessionId=" + sessionId));
|
||||
} catch (Exception e) {
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
return emitter;
|
||||
}
|
||||
|
||||
public org.springframework.web.servlet.mvc.method.annotation.SseEmitter handleCustomSse(String sessionId, String body) {
|
||||
public SseEmitter handleCustomSse(String sessionId, String body) {
|
||||
if (sessionFactory == null) {
|
||||
throw new IllegalStateException("SessionFactory not configured");
|
||||
}
|
||||
|
||||
org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter = new org.springframework.web.servlet.mvc.method.annotation.SseEmitter(-1L);
|
||||
|
||||
|
||||
SseEmitter emitter = new SseEmitter(-1L);
|
||||
|
||||
CustomMcpSessionTransport sessionTransport = new CustomMcpSessionTransport(emitter, sessionId);
|
||||
McpServerSession session = sessionFactory.create(sessionTransport);
|
||||
sessions.put(sessionId, session);
|
||||
|
||||
|
||||
emitter.onCompletion(() -> sessions.remove(sessionId));
|
||||
emitter.onTimeout(() -> sessions.remove(sessionId));
|
||||
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
// 커스텀 클라이언트는 endpoint 이벤트를 무시할 수 있지만, 표준 호환성을 위해 전송
|
||||
Thread.sleep(100);
|
||||
emitter.send(org.springframework.web.servlet.mvc.method.annotation.SseEmitter.event().name("endpoint").data(messageEndpoint + "?sessionId=" + sessionId));
|
||||
|
||||
emitter.send(SseEmitter.event().name("endpoint").data(messageEndpoint + "?sessionId=" + sessionId));
|
||||
|
||||
// Body로 들어온 initialize 등 즉시 처리
|
||||
if (body != null && !body.trim().isEmpty()) {
|
||||
handleMessage(sessionId, body);
|
||||
@@ -117,46 +136,46 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
|
||||
emitter.completeWithError(e);
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
return emitter;
|
||||
}
|
||||
|
||||
public org.springframework.http.ResponseEntity<String> handleMessage(String sessionId, String body) {
|
||||
public ResponseEntity<String> handleMessage(String sessionId, String body) {
|
||||
log.info("Received POST message for sessionId: " + sessionId + ", body: " + body);
|
||||
if (sessionId == null || !sessions.containsKey(sessionId)) {
|
||||
return org.springframework.http.ResponseEntity.badRequest().body("Missing or invalid sessionId");
|
||||
return ResponseEntity.badRequest().body("Missing or invalid sessionId");
|
||||
}
|
||||
|
||||
|
||||
McpServerSession session = sessions.get(sessionId);
|
||||
try {
|
||||
Map<String, Object> map = objectMapper.readValue(body, new TypeReference<Map<String, Object>>() {});
|
||||
io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message;
|
||||
|
||||
JSONRPCMessage message;
|
||||
|
||||
if (map.containsKey("id")) {
|
||||
if (map.containsKey("method")) {
|
||||
message = objectMapper.convertValue(map, io.modelcontextprotocol.spec.McpSchema.JSONRPCRequest.class);
|
||||
message = objectMapper.convertValue(map, JSONRPCRequest.class);
|
||||
} else {
|
||||
message = objectMapper.convertValue(map, io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse.class);
|
||||
message = objectMapper.convertValue(map, JSONRPCResponse.class);
|
||||
}
|
||||
} else {
|
||||
message = objectMapper.convertValue(map, io.modelcontextprotocol.spec.McpSchema.JSONRPCNotification.class);
|
||||
message = objectMapper.convertValue(map, JSONRPCNotification.class);
|
||||
}
|
||||
log.info("Converted message type: " + message.getClass().getName());
|
||||
|
||||
|
||||
session.handle(message).subscribe();
|
||||
log.info("Message sent to session handler");
|
||||
return org.springframework.http.ResponseEntity.ok().build();
|
||||
return ResponseEntity.ok().build();
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to handle message", e);
|
||||
return org.springframework.http.ResponseEntity.status(500).body(e.getMessage());
|
||||
return ResponseEntity.status(500).body(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private class CustomMcpSessionTransport implements McpServerTransport {
|
||||
private final org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter;
|
||||
private final SseEmitter emitter;
|
||||
private final String sessionId;
|
||||
|
||||
public CustomMcpSessionTransport(org.springframework.web.servlet.mvc.method.annotation.SseEmitter emitter, String sessionId) {
|
||||
public CustomMcpSessionTransport(SseEmitter emitter, String sessionId) {
|
||||
this.emitter = emitter;
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
@@ -168,7 +187,7 @@ public class CustomWebMvcSseServerTransportProvider implements McpServerTranspor
|
||||
try {
|
||||
String json = objectMapper.writeValueAsString(message);
|
||||
log.info("Serialized message: " + json);
|
||||
emitter.send(org.springframework.web.servlet.mvc.method.annotation.SseEmitter.event().name("message").data(json));
|
||||
emitter.send(SseEmitter.event().name("message").data(json));
|
||||
log.info("Message successfully sent to SSE emitter");
|
||||
} catch (Exception e) {
|
||||
log.error("Error sending message to SSE emitter", e);
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.sync
|
||||
* @className DynamicMcpController
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.sync
|
||||
* @className DynamicMcpServerManager
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.modelcontextprotocol.spec.McpSchema.ServerCapabilities;
|
||||
import io.modelcontextprotocol.server.McpServer;
|
||||
import io.modelcontextprotocol.server.McpSyncServer;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.sync;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.sync
|
||||
* @className RegistryMcpToolSpecificationFactory
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.dto.ToolMetadata;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.service.ExecuteService;
|
||||
import io.modelcontextprotocol.server.McpServerFeatures;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.large
|
||||
* @className AgentResponseBudgetService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.large
|
||||
* @className LargeToolResponseService
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import java.util.Iterator;
|
||||
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.large
|
||||
* @className PaginationRequestValidator
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.ToolExecutionException;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.result;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.result
|
||||
* @className ToolExecutionResult
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.result;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.result
|
||||
* @className ToolExecutionResultFormatter
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.guardrail.SensitiveDataMasker;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.transport;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.transport
|
||||
* @className HttpToolInvoker
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.FailureType;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.resilience.ToolExecutionException;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.transport;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.transport
|
||||
* @className ToolInvoker
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway
|
||||
* @className DapGatewayApplicationTests
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
package io.shinhanlife.dap.biz.mcp.gateway.tool.large;
|
||||
|
||||
|
||||
/**
|
||||
* @package io.shinhanlife.dap.biz.mcp.gateway.tool.large
|
||||
* @className PaginationRequestValidatorTest
|
||||
* @description AX HUB 시스템 처리 클래스
|
||||
* @author 김형식
|
||||
* @create 2026.09.01
|
||||
* <pre>
|
||||
* ---------- 개정이력 ----------
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- -------- ---------------------------
|
||||
* 2026.09.01 김형식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import io.shinhanlife.dap.biz.mcp.gateway.config.McpGatewayProperties;
|
||||
|
||||
Reference in New Issue
Block a user