Spaces:
Sleeping
Sleeping
Souptik96 commited on
Commit ·
641d007
1
Parent(s): 7c2d6b6
feat: expose Antigravity-Codex-AML engine via FastMCP SSE
Browse files- api.py +48 -35
- mcp_server.py +15 -0
- requirements.txt +3 -1
api.py
CHANGED
|
@@ -1,35 +1,48 @@
|
|
| 1 |
-
from __future__ import annotations
|
| 2 |
-
|
| 3 |
-
from fastapi import FastAPI
|
| 4 |
-
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
-
|
| 6 |
-
from agents.credit_risk.router import router as credit_router
|
| 7 |
-
from agents.kyc_identity.router import router as kyc_router
|
| 8 |
-
from agents.risk_consultant.router import router as consultant_router
|
| 9 |
-
from agents.sanctions_pep.router import router as sanctions_router
|
| 10 |
-
from agents.transaction_fraud.router import router as fraud_router
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
app.include_router(
|
| 28 |
-
app.include_router(
|
| 29 |
-
app.include_router(
|
| 30 |
-
app.include_router(
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from fastapi import FastAPI
|
| 4 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 5 |
+
|
| 6 |
+
from agents.credit_risk.router import router as credit_router
|
| 7 |
+
from agents.kyc_identity.router import router as kyc_router
|
| 8 |
+
from agents.risk_consultant.router import router as consultant_router
|
| 9 |
+
from agents.sanctions_pep.router import router as sanctions_router
|
| 10 |
+
from agents.transaction_fraud.router import router as fraud_router
|
| 11 |
+
from mcp_server import mcp
|
| 12 |
+
|
| 13 |
+
app = FastAPI(
|
| 14 |
+
title="RiskOS Fraud Intelligence Suite",
|
| 15 |
+
version="1.0.0",
|
| 16 |
+
description="Multi-agent AI system for real-time fraud detection, credit risk assessment, KYC identity verification, and sanctions screening.",
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
app.add_middleware(
|
| 20 |
+
CORSMiddleware,
|
| 21 |
+
allow_origins=["*"],
|
| 22 |
+
allow_credentials=True,
|
| 23 |
+
allow_methods=["*"],
|
| 24 |
+
allow_headers=["*"],
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
app.include_router(fraud_router, prefix="/api/v1/fraud")
|
| 28 |
+
app.include_router(credit_router, prefix="/api/v1/credit")
|
| 29 |
+
app.include_router(kyc_router, prefix="/api/v1/kyc")
|
| 30 |
+
app.include_router(sanctions_router, prefix="/api/v1/sanctions")
|
| 31 |
+
app.include_router(consultant_router, prefix="/api/v1/consultant")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
@app.get("/health")
|
| 35 |
+
def health() -> dict[str, object]:
|
| 36 |
+
return {"status": "ok", "agents": ["fraud", "credit", "kyc", "sanctions", "consultant"]}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
mcp_app = mcp.sse_app(mount_path="/mcp")
|
| 40 |
+
mcp_app.add_middleware(
|
| 41 |
+
CORSMiddleware,
|
| 42 |
+
allow_origins=["*"],
|
| 43 |
+
allow_credentials=True,
|
| 44 |
+
allow_methods=["*"],
|
| 45 |
+
allow_headers=["*"],
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
app.mount("/mcp", mcp_app)
|
mcp_server.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from mcp.server.fastmcp import FastMCP
|
| 4 |
+
from agents.investigative_agent.orchestrator import run_investigation
|
| 5 |
+
|
| 6 |
+
# Initialize the MCP Server
|
| 7 |
+
mcp = FastMCP("Antigravity-Codex-AML")
|
| 8 |
+
|
| 9 |
+
@mcp.tool()
|
| 10 |
+
def investigate_alert(alert_id: str) -> dict:
|
| 11 |
+
"""
|
| 12 |
+
Run a full AML investigation on a given alert ID (e.g., 'Alert-101', 'Alert-102', 'Alert-103').
|
| 13 |
+
Returns a complex JSON object containing the profile, model_scores, and a generated SAR draft.
|
| 14 |
+
"""
|
| 15 |
+
return run_investigation(alert_id)
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
gradio==4.44.0
|
| 2 |
-
fastapi=
|
| 3 |
uvicorn==0.30.1
|
| 4 |
pydantic==2.7.1
|
| 5 |
xgboost==2.0.3
|
|
@@ -14,3 +14,5 @@ httpx==0.27.0
|
|
| 14 |
pytest==8.2.0
|
| 15 |
python-dotenv==1.0.1
|
| 16 |
huggingface_hub==0.25.2
|
|
|
|
|
|
|
|
|
| 1 |
gradio==4.44.0
|
| 2 |
+
fastapi>=0.112.0
|
| 3 |
uvicorn==0.30.1
|
| 4 |
pydantic==2.7.1
|
| 5 |
xgboost==2.0.3
|
|
|
|
| 14 |
pytest==8.2.0
|
| 15 |
python-dotenv==1.0.1
|
| 16 |
huggingface_hub==0.25.2
|
| 17 |
+
mcp>=1.1.2
|
| 18 |
+
sse-starlette>=2.0.0
|