Skip to content

Commit 21404c9

Browse files
Merge pull request #39 from kevinbackhouse/mcp_data_dir
Fix mcp_data_dir instances
2 parents e0a6bde + c6eeee6 commit 21404c9

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

src/seclab_taskflows/mcp_servers/alert_results_models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
from sqlalchemy import String, Text, Integer, ForeignKey, Column
55
from sqlalchemy.orm import DeclarativeBase, mapped_column, Mapped, relationship
66
from typing import Optional
7+
from seclab_taskflow_agent.path_utils import mcp_data_dir
8+
9+
ALERT_RESULTS_DIR = mcp_data_dir("seclab-taskflows", "report_alert_state", "ALERT_RESULTS_DIR")
710

811

912
class Base(DeclarativeBase):

src/seclab_taskflows/mcp_servers/codeql_python/mcp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
from .codeql_sqlite_models import Base, Source
2323
from ..utils import process_repo
24+
from ..codeql_utils import CODEQL_DBS_BASE_PATH
2425

2526
logging.basicConfig(
2627
level=logging.DEBUG,
@@ -30,7 +31,6 @@
3031
)
3132

3233
MEMORY = mcp_data_dir("seclab-taskflows", "codeql", "DATA_DIR")
33-
CODEQL_DBS_BASE_PATH = mcp_data_dir("seclab-taskflows", "codeql", "CODEQL_DBS_BASE_PATH")
3434

3535
mcp = FastMCP("CodeQL-Python")
3636

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2025 GitHub
2+
# SPDX-License-Identifier: MIT
3+
4+
from seclab_taskflow_agent.path_utils import mcp_data_dir
5+
6+
CODEQL_DBS_BASE_PATH = mcp_data_dir("seclab-taskflows", "codeql", "CODEQL_DBS_BASE_PATH")

src/seclab_taskflows/mcp_servers/gh_code_scanning.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import zipfile
1515
from sqlalchemy import create_engine
1616
from sqlalchemy.orm import Session
17-
from seclab_taskflow_agent.path_utils import mcp_data_dir, log_file_name
17+
from seclab_taskflow_agent.path_utils import log_file_name
1818

19-
from .alert_results_models import AlertResults, AlertFlowGraph, Base
19+
from .alert_results_models import AlertResults, AlertFlowGraph, Base, ALERT_RESULTS_DIR
20+
from .codeql_utils import CODEQL_DBS_BASE_PATH
2021

2122
logging.basicConfig(
2223
level=logging.DEBUG,
@@ -29,9 +30,6 @@
2930

3031
GH_TOKEN = os.getenv("GH_TOKEN", default="")
3132

32-
CODEQL_DBS_BASE_PATH = mcp_data_dir("seclab-taskflows", "codeql", "CODEQL_DBS_BASE_PATH")
33-
ALERT_RESULTS_DIR = mcp_data_dir("seclab-taskflows", "gh_code_scanning", "ALERT_RESULTS_DIR")
34-
3533

3634
def parse_alert(alert: dict) -> dict:
3735
"""Parse the alert dictionary to extract relevant information."""

src/seclab_taskflows/mcp_servers/local_file_viewer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from pathlib import Path
1111
import aiofiles
1212
import zipfile
13-
import tempfile
14-
from seclab_taskflow_agent.path_utils import mcp_data_dir, log_file_name
13+
from seclab_taskflow_agent.path_utils import log_file_name
14+
from .local_gh_resources import LOCAL_GH_DIR
1515

1616
logging.basicConfig(
1717
level=logging.DEBUG,
@@ -22,8 +22,6 @@
2222

2323
mcp = FastMCP("LocalFileViewer")
2424

25-
LOCAL_GH_DIR = mcp_data_dir("seclab-taskflows", "local_file_viewer", "LOCAL_GH_DIR")
26-
2725
LINE_LIMIT_FOR_FETCHING_FILE_CONTENT = int(os.getenv("LINE_LIMIT_FOR_FETCHING_FILE_CONTENT", default=1000))
2826

2927
FILE_LIMIT_FOR_LIST_FILES = int(os.getenv("FILE_LIMIT_FOR_LIST_FILES", default=100))

src/seclab_taskflows/mcp_servers/report_alert_state.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from sqlalchemy import create_engine
1111
from sqlalchemy.orm import Session
1212
from pydantic import Field
13-
from seclab_taskflow_agent.path_utils import mcp_data_dir, log_file_name
13+
from seclab_taskflow_agent.path_utils import log_file_name
1414

15-
from .alert_results_models import AlertResults, AlertFlowGraph, Base
15+
from .alert_results_models import AlertResults, AlertFlowGraph, Base, ALERT_RESULTS_DIR
1616

1717
logging.basicConfig(
1818
level=logging.DEBUG,
@@ -61,9 +61,6 @@ def remove_line_numbers(location: str) -> str:
6161
return ":".join(parts[:-4])
6262

6363

64-
MEMORY = mcp_data_dir("seclab-taskflows", "report_alert_state", "ALERT_RESULTS_DIR")
65-
66-
6764
class ReportAlertStateBackend:
6865
def __init__(self, memcache_state_dir: str):
6966
self.memcache_state_dir = memcache_state_dir
@@ -296,7 +293,7 @@ def clear_flow_graphs(self) -> str:
296293

297294
mcp = FastMCP("ReportAlertState")
298295

299-
backend = ReportAlertStateBackend(MEMORY)
296+
backend = ReportAlertStateBackend(ALERT_RESULTS_DIR)
300297

301298

302299
def process_repo(repo):

0 commit comments

Comments
 (0)