MCP 차단관련 로직 추가

This commit is contained in:
2026-02-26 13:33:24 +09:00
parent cc236d3dac
commit 92a1c81ef1
3 changed files with 18 additions and 1 deletions

View File

@@ -63,6 +63,14 @@ async def _mcp_validate_buy(stock: dict) -> tuple:
return True, f"mcp_approved(conf={confidence:.2f})"
else:
return False, f"mcp_rejected(decision={decision}, conf={confidence:.2f})"
except httpx.HTTPStatusError as e:
if e.response.status_code == 500:
# 500 에러 → MCP 서버 내부 오류 → 룰 기반으로 우회
logger.warning(f"⚠️ MCP 서버 500 에러 — 룰 기반으로 우회: {e}")
return True, "mcp_500_fallback_to_rules"
logger.warning(f"⚠️ MCP 검증 실패 — 매매 차단: {e}")
return False, "mcp_unavailable"
except Exception as e:
logger.warning(f"⚠️ MCP 검증 실패 — 매매 차단: {e}")