js_files
List JavaScript files from a specified source, with optional host regex filtering to focus on specific hosts.
Instructions
List JS files in a source, optionally filtered by host regex.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| host_filter | No | ||
| limit | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/burp_mcp_plus/server.py:795-798 (registration)The @mcp.tool() decorator registers the js_files tool in the MCP server. It calls jsfiles.list_files() to do the actual work.
@mcp.tool() def js_files(name: str, host_filter: str | None = None, limit: int = 200) -> str: """List JS files in a source, optionally filtered by host regex.""" return json.dumps(jsfiles.list_files(name, host_filter=host_filter, limit=limit), indent=2) - src/burp_mcp_plus/jsfiles.py:142-159 (handler)The actual handler: list_files() looks up the JsSource by name, optionally filters by host regex, and returns a list of file records with metadata (index, host, path, version, size, url, on_disk).
def list_files(name: str, host_filter: str | None = None, limit: int = 200) -> list[dict[str, object]]: src = get(name) records = src.records if host_filter: rx = re.compile(host_filter, re.IGNORECASE) records = [r for r in records if rx.search(r.host)] return [ { "index": r.index, "host": r.host, "path": r.path, "version": r.version, "size_bytes": r.size_bytes, "url": r.full_url, "on_disk": bool(r.abs_path), } for r in records[:limit] ] - src/burp_mcp_plus/jsfiles.py:42-52 (schema)JsRecord dataclass: defines the schema for each JS file entry (index, timestamp, host, path, version, size_bytes, full_url, saved_as, abs_path).
@dataclass class JsRecord: index: int timestamp: str host: str path: str version: str size_bytes: int full_url: str saved_as: str # path as recorded in manifest abs_path: str # absolute path on disk if found - src/burp_mcp_plus/jsfiles.py:55-59 (schema)JsSource dataclass: defines the schema for a JS source (name, manifest_path, records).
@dataclass class JsSource: name: str manifest_path: str records: list[JsRecord] = field(default_factory=list) - src/burp_mcp_plus/jsfiles.py:113-121 (helper)register() helper: loads a manifest CSV, parses it, and stores it in the global _REGISTRY by name.
def register(manifest_path: str, name: str | None = None) -> JsSource: p = os.path.abspath(os.path.expanduser(manifest_path)) if not os.path.isfile(p): raise FileNotFoundError(p) if name is None: name = os.path.basename(os.path.dirname(p)) or "js" src = JsSource(name=name, manifest_path=p, records=parse_manifest(p)) _REGISTRY[name] = src return src