Skip to content

Commit c5f4b60

Browse files
authored
Merge pull request #210 from websentry-ai/vv/mcp-fingerprint-coverage
scan: forward script_content from server config to scan object
2 parents d96da20 + 246b684 commit c5f4b60

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

scripts/coding_discovery_tools/scan_single_mcp_server.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ def _normalize_url(url):
2828
def scan_one(server_name, server_config):
2929
"""Scan a single server; returns the per-server object {name, command, url, args, scan}."""
3030
servers = transform_mcp_servers_to_array({server_name: server_config})
31-
return servers[0] if servers else None
31+
obj = servers[0] if servers else None
32+
# Forward the base64 script body the hook attached for local-script servers
33+
# (it resolved the path with cwd; we run detached without it). The backend
34+
# recomputes sha256 -> `script:<hash>` fingerprint and stores the body.
35+
if obj is not None and isinstance(server_config, dict) and server_config.get('script_content'):
36+
obj['script_content'] = server_config['script_content']
37+
print(f"info: forwarding script_content ({len(server_config['script_content'])} b64 chars) for {server_name}",
38+
file=sys.stderr)
39+
return obj
3240

3341

3442
def _curl_config_quote(value):
@@ -103,12 +111,6 @@ def main():
103111
print(f"error: scan produced no result [{ctx}]", file=sys.stderr)
104112
return 1
105113

106-
scan = server_obj.get("scan") or {}
107-
if not (scan.get("tools") or []):
108-
reason = (scan.get("error") or {}).get("code") or "no tools"
109-
print(f"skip: not reporting ({reason}, tools=0) [{ctx}]", file=sys.stderr)
110-
return 0
111-
112114
try:
113115
result = report(args.domain, args.api_key, server_obj)
114116
except Exception as e:

0 commit comments

Comments
 (0)