forked from snyk/agent-scan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscan_api.py
More file actions
63 lines (57 loc) · 2.25 KB
/
scan_api.py
File metadata and controls
63 lines (57 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import asyncio
import json
import logging
from agent_scan import inspect, scan
from agent_scan.printer import print_scan_result
# no logging by default
logging.getLogger().setLevel(logging.CRITICAL + 1) # Higher than any standard level
logging.getLogger().addHandler(logging.NullHandler())
# scan PyPI package
result = asyncio.run(scan("pypi:arxiv-mcp-server"))
print_scan_result(result)
# scan oci package
result = asyncio.run(inspect("oci:zenmldocker/mcp-zenml"))
print_scan_result(result, inspect_mode=True)
# scan npm package
result = asyncio.run(inspect("npm:mcp-sequentialthinking-tools"))
print_scan_result(result, inspect_mode=True)
# scan tools directly
tools = [
{
"name": "search",
"description": "\n Search DuckDuckGo and return formatted results.\n\n Args:\n query: The search query string\n max_results: Maximum number of results to return (default: 10)\n ctx: MCP context for logging\n ",
"inputSchema": {
"type": "object",
"title": "searchArguments",
"required": ["query"],
"properties": {
"query": {"type": "string", "title": "Query"},
"max_results": {"type": "integer", "title": "Max Results", "default": 10},
},
},
"outputSchema": {
"type": "object",
"title": "searchOutput",
"required": ["result"],
"properties": {"result": {"type": "string", "title": "Result"}},
},
},
{
"name": "fetch_content",
"description": "\n Fetch and parse content from a webpage URL.\n\n Args:\n url: The webpage URL to fetch content from\n ctx: MCP context for logging\n ",
"inputSchema": {
"type": "object",
"title": "fetch_contentArguments",
"required": ["url"],
"properties": {"url": {"type": "string", "title": "Url"}},
},
"outputSchema": {
"type": "object",
"title": "fetch_contentOutput",
"required": ["result"],
"properties": {"result": {"type": "string", "title": "Result"}},
},
},
]
result = asyncio.run(inspect("tools:" + json.dumps(tools)))
print_scan_result(result, inspect_mode=True)