|
10 | 10 | filemode='a' |
11 | 11 | ) |
12 | 12 | 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 |
14 | 14 |
|
15 | 15 | from pydantic import Field |
16 | 16 | #from mcp.server.fastmcp import FastMCP, Context |
|
27 | 27 | from .codeql_sqlite_models import Base, Source |
28 | 28 | from ..utils import process_repo |
29 | 29 |
|
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') |
32 | 34 |
|
33 | 35 | mcp = FastMCP("CodeQL-Python") |
34 | 36 |
|
@@ -153,8 +155,8 @@ def _run_query(query_name: str, database_path: str, language: str, template_valu |
153 | 155 | backend = CodeqlSqliteBackend(MEMORY) |
154 | 156 |
|
155 | 157 | @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"), |
158 | 160 | database_path: str = Field(description="The CodeQL database path."), |
159 | 161 | language: str = Field(description="The language used for the CodeQL database.")): |
160 | 162 | """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 |
184 | 186 | return f"Stored {stored_count} remote sources in {repo}." |
185 | 187 |
|
186 | 188 | @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")): |
188 | 191 | """ |
189 | 192 | Fetch all sources from the repo |
190 | 193 | """ |
191 | 194 | repo = process_repo(owner, repo) |
192 | 195 | return json.dumps(backend.get_sources(repo)) |
193 | 196 |
|
194 | 197 | @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"), |
197 | 200 | source_location: str = Field(description="The path to the file"), |
198 | 201 | 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")): |
200 | 203 | """ |
201 | 204 | Add new notes to an existing source. The notes will be appended to any existing notes. |
202 | 205 | """ |
203 | 206 | repo = process_repo(owner, repo) |
204 | 207 | return backend.store_new_source(repo = repo, source_location = source_location, line = line, source_type = "", notes = notes, update=True) |
205 | 208 |
|
206 | 209 | @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")): |
208 | 212 | """ |
209 | 213 | Clear all data for a given repo from the database |
210 | 214 | """ |
|
0 commit comments