Skip to content

Commit bc5e937

Browse files
committed
fix: document mount paths in execute_hub_tool and inject volumes into persistent sessions
1 parent 73a0170 commit bc5e937

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

fuzzforge-common/src/fuzzforge_common/hub/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,15 @@ async def _send_notification(
539539
async def start_persistent_session(
540540
self,
541541
config: HubServerConfig,
542+
extra_volumes: list[str] | None = None,
542543
) -> PersistentSession:
543544
"""Start a persistent Docker container and initialise MCP session.
544545
545546
The container stays running until :meth:`stop_persistent_session` is
546547
called, allowing multiple tool calls on the same session.
547548
548549
:param config: Server configuration (must be Docker type).
550+
:param extra_volumes: Additional host:container volume mounts to inject.
549551
:returns: The created persistent session.
550552
:raises HubClientError: If the container cannot be started.
551553
@@ -590,6 +592,9 @@ async def start_persistent_session(
590592
for volume in config.volumes:
591593
cmd.extend(["-v", os.path.expanduser(volume)])
592594

595+
for extra_vol in (extra_volumes or []):
596+
cmd.extend(["-v", extra_vol])
597+
593598
for key, value in config.environment.items():
594599
cmd.extend(["-e", f"{key}={value}"])
595600

fuzzforge-common/src/fuzzforge_common/hub/executor.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,14 @@ def get_tool_schema(self, identifier: str) -> dict[str, Any] | None:
345345
# Persistent session management
346346
# ------------------------------------------------------------------
347347

348-
async def start_persistent_server(self, server_name: str) -> dict[str, Any]:
348+
async def start_persistent_server(self, server_name: str, extra_volumes: list[str] | None = None) -> dict[str, Any]:
349349
"""Start a persistent container session for a server.
350350
351351
The container stays running between tool calls, allowing stateful
352352
interactions (e.g., radare2 sessions, long-running fuzzing).
353353
354354
:param server_name: Name of the hub server to start.
355+
:param extra_volumes: Additional host:container volume mounts to inject.
355356
:returns: Session status dictionary.
356357
:raises ValueError: If server not found.
357358
@@ -362,7 +363,7 @@ async def start_persistent_server(self, server_name: str) -> dict[str, Any]:
362363
msg = f"Server '{server_name}' not found"
363364
raise ValueError(msg)
364365

365-
session = await self._client.start_persistent_session(server.config)
366+
session = await self._client.start_persistent_session(server.config, extra_volumes=extra_volumes)
366367

367368
# Auto-discover tools on the new session
368369
try:

fuzzforge-mcp/src/fuzzforge_mcp/tools/hub.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,16 @@ async def execute_hub_tool(
172172
:return: Tool execution result.
173173
174174
Example identifiers:
175+
- "hub:binwalk-mcp:binwalk_scan"
176+
- "hub:yara-mcp:yara_scan_with_rules"
175177
- "hub:nmap:nmap_scan"
176-
- "nmap:nmap_scan"
177-
- "hub:nuclei:nuclei_scan"
178+
179+
FILE ACCESS — if set_project_assets was called, the assets directory is
180+
mounted read-only inside the container at two standard paths:
181+
- /app/uploads/ (used by binwalk, and tools with UPLOAD_DIR)
182+
- /app/samples/ (used by yara, capa, and tools with SAMPLES_DIR)
183+
Always use /app/uploads/<filename> or /app/samples/<filename> when
184+
passing file paths to hub tools — do NOT use the host path.
178185
179186
"""
180187
try:
@@ -353,7 +360,22 @@ async def start_hub_server(server_name: str) -> dict[str, Any]:
353360
try:
354361
executor = _get_hub_executor()
355362

356-
result = await executor.start_persistent_server(server_name)
363+
# Inject project assets as Docker volume mounts (same logic as execute_hub_tool).
364+
extra_volumes: list[str] = []
365+
try:
366+
storage = get_storage()
367+
project_path = get_project_path()
368+
assets_path = storage.get_project_assets_path(project_path)
369+
if assets_path:
370+
assets_str = str(assets_path)
371+
extra_volumes = [
372+
f"{assets_str}:/app/uploads:ro",
373+
f"{assets_str}:/app/samples:ro",
374+
]
375+
except Exception: # noqa: BLE001 - never block server start due to asset injection failure
376+
extra_volumes = []
377+
378+
result = await executor.start_persistent_server(server_name, extra_volumes=extra_volumes or None)
357379

358380
return {
359381
"success": True,

0 commit comments

Comments
 (0)