Skip to content

Commit 3ad757d

Browse files
Fix env paths handling
1 parent 9385063 commit 3ad757d

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/seclab_taskflows/mcp_servers/codeql_python/mcp_server.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
filemode='a'
1111
)
1212
from seclab_taskflow_agent.mcp_servers.codeql.client import run_query, _debug_log
13-
from seclab_taskflow_agent.path_utils import mcp_data_dir
13+
# from seclab_taskflow_agent.path_utils import mcp_data_dir
1414

1515
from pydantic import Field
1616
#from mcp.server.fastmcp import FastMCP, Context
@@ -27,8 +27,10 @@
2727
from .codeql_sqlite_models import Base, Source
2828
from ..utils import process_repo
2929

30-
MEMORY = mcp_data_dir('seclab-taskflow-agent', 'codeql', 'DATA_DIR')
31-
CODEQL_DBS_BASE_PATH = mcp_data_dir('seclab-taskflow-agent', 'codeql', 'CODEQL_DBS_BASE_PATH')
30+
MEMORY = Path(os.getenv('DATA_DIR', default='/app/data'))
31+
CODEQL_DBS_BASE_PATH = Path(os.getenv('CODEQL_DBS_BASE_PATH', default='/app/data'))
32+
# MEMORY = mcp_data_dir('seclab-taskflows', 'codeql', 'DATA_DIR')
33+
# CODEQL_DBS_BASE_PATH = mcp_data_dir('seclab-taskflows', 'codeql', 'CODEQL_DBS_BASE_PATH')
3234

3335
mcp = FastMCP("CodeQL-Python")
3436

@@ -153,8 +155,8 @@ def _run_query(query_name: str, database_path: str, language: str, template_valu
153155
backend = CodeqlSqliteBackend(MEMORY)
154156

155157
@mcp.tool()
156-
def remote_sources(owner: str = Field(description="The owner of the GitHub repository", default=""),
157-
repo: str = Field(description="The name of the GitHub repository", default=""),
158+
def remote_sources(owner: str = Field(description="The owner of the GitHub repository"),
159+
repo: str = Field(description="The name of the GitHub repository"),
158160
database_path: str = Field(description="The CodeQL database path."),
159161
language: str = Field(description="The language used for the CodeQL database.")):
160162
"""List all remote sources and their locations in a CodeQL database, then store the results in a database."""
@@ -184,27 +186,29 @@ def remote_sources(owner: str = Field(description="The owner of the GitHub repos
184186
return f"Stored {stored_count} remote sources in {repo}."
185187

186188
@mcp.tool()
187-
def fetch_sources(owner: str = Field(description="The owner of the GitHub repository", default=""), repo: str = Field(description="The name of the GitHub repository", default="")):
189+
def fetch_sources(owner: str = Field(description="The owner of the GitHub repository"),
190+
repo: str = Field(description="The name of the GitHub repository")):
188191
"""
189192
Fetch all sources from the repo
190193
"""
191194
repo = process_repo(owner, repo)
192195
return json.dumps(backend.get_sources(repo))
193196

194197
@mcp.tool()
195-
def add_source_notes(owner: str = Field(description="The owner of the GitHub repository", default=""),
196-
repo: str = Field(description="The name of the GitHub repository", default=""),
198+
def add_source_notes(owner: str = Field(description="The owner of the GitHub repository"),
199+
repo: str = Field(description="The name of the GitHub repository"),
197200
source_location: str = Field(description="The path to the file"),
198201
line: int = Field(description="The line number of the source"),
199-
notes: str = Field(description="The notes to append to this source", default="")):
202+
notes: str = Field(description="The notes to append to this source")):
200203
"""
201204
Add new notes to an existing source. The notes will be appended to any existing notes.
202205
"""
203206
repo = process_repo(owner, repo)
204207
return backend.store_new_source(repo = repo, source_location = source_location, line = line, source_type = "", notes = notes, update=True)
205208

206209
@mcp.tool()
207-
def clear_codeql_repo(owner: str = Field(description="The owner of the GitHub repository", default=""), repo: str = Field(description="The name of the GitHub repository", default="")):
210+
def clear_codeql_repo(owner: str = Field(description="The owner of the GitHub repository"),
211+
repo: str = Field(description="The name of the GitHub repository")):
208212
"""
209213
Clear all data for a given repo from the database
210214
"""

src/seclab_taskflows/taskflows/audit/remote_sources_local.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,3 @@ taskflow:
9494
Fetch the sources of the repo {{ GLOBALS_repo }} and give a summary of the notes.
9595
toolboxes:
9696
- seclab_taskflows.toolboxes.codeql_python
97-
- seclab_taskflow_agent.toolboxes.memcache

0 commit comments

Comments
 (0)