1919from mcp_scan .MCPScanner import MCPScanner
2020from mcp_scan .printer import print_scan_result
2121from mcp_scan .Storage import Storage
22- from mcp_scan .upload import upload
22+ from mcp_scan .upload import get_hostname , upload
2323from mcp_scan .utils import parse_headers
2424from mcp_scan .version import version_info
2525from mcp_scan .well_known_clients import WELL_KNOWN_MCP_PATHS , client_shorthands_to_paths
@@ -712,6 +712,7 @@ def server(on_exit=None):
712712 parser .print_help ()
713713 sys .exit (1 )
714714
715+
715716async def evo (args ):
716717 """
717718 Pushes the scan results to the Evo API.
@@ -721,13 +722,15 @@ async def evo(args):
721722 3. Revokes the client_id
722723 """
723724
724- rich .print (f"Go to https://app.snyk.io and select the tenant on the left nav bar. Copy the Tenant ID from the URL and paste it here: " )
725+ rich .print (
726+ "Go to https://app.snyk.io and select the tenant on the left nav bar. Copy the Tenant ID from the URL and paste it here: "
727+ )
725728 tenant_id = input ().strip ()
726- rich .print (f "Paste the Authorization token from https://app.snyk.io/account (API Token -> KEY -> click to show): " )
729+ rich .print ("Paste the Authorization token from https://app.snyk.io/account (API Token -> KEY -> click to show): " )
727730 token = input ().strip ()
728731
729732 push_key_url = f"https://api.snyk.io/hidden/tenants/{ tenant_id } /mcp-scan/push-key?version=2025-08-28"
730- push_scan_url = f "https://api.snyk.io/hidden/mcp-scan/push?version=2025-08-28"
733+ push_scan_url = "https://api.snyk.io/hidden/mcp-scan/push?version=2025-08-28"
731734
732735 # create a client_id (shared secret)
733736 client_id = None
@@ -743,18 +746,18 @@ async def evo(args):
743746 if not client_id :
744747 rich .print (f"[bold red]Unexpected response[/bold red]: { data } " )
745748 return
746- rich .print (f "Client ID created" )
749+ rich .print ("Client ID created" )
747750 except Exception as e :
748751 rich .print (f"[bold red]Error calling Snyk API[/bold red]: { e } " )
749752 return
750753
751754 # Update the default scan args
752- args .control_servers = [
755+ args .control_servers = [
753756 {
754757 "url" : push_scan_url ,
755- "identifier" : None ,
758+ "identifier" : get_hostname () or None ,
756759 "opt_out" : False ,
757- "headers" : [f"x-client-id:{ client_id } " ]
760+ "headers" : [f"x-client-id:{ client_id } " ],
758761 }
759762 ]
760763 await run_scan_inspect (mode = "scan" , args = args )
@@ -777,7 +780,12 @@ async def evo(args):
777780
778781
779782async def run_scan_inspect (mode = "scan" , args = None ):
780- async with MCPScanner (additional_headers = parse_headers (args .verification_H ), ** vars (args )) as scanner :
783+ # Initialize scan_context dict that can be populated during scanning
784+ scan_context = {"cli_version" : version_info }
785+
786+ async with MCPScanner (
787+ additional_headers = parse_headers (args .verification_H ), scan_context = scan_context , ** vars (args )
788+ ) as scanner :
781789 if mode == "scan" :
782790 result = await scanner .scan ()
783791 elif mode == "inspect" :
@@ -796,6 +804,7 @@ async def run_scan_inspect(mode="scan", args=None):
796804 verbose = getattr (args , "verbose" , False ),
797805 additional_headers = parse_headers (server_config ["headers" ]),
798806 skip_ssl_verify = getattr (args , "skip_ssl_verify" , False ),
807+ scan_context = scan_context ,
799808 )
800809 return result
801810
0 commit comments