SuperAPIAI Directory

ModelSafetyMCP

github.com · AI developer platforms

Scan ML model artifacts, URLs and directories for unsafe serialization, malicious patterns and risky packaging using ModelScan, PickleScan and heuristics.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsWindows

About this tool

ModelSafetyMCP is an MCP server for machine learning model safety inspection, with the goal of performing safety checks on model artifacts before they are loaded, distributed, or trusted. The project points out that malicious or unsafe ML artifacts are a real supply chain problem, and malicious or suspicious models have already been found on public platforms; one major risk comes from deserialization—many model formats (especially pickle-based and framework-specific formats) may execute code or invoke unsafe logic when loaded or reconstructed, making model files an execution vector rather than merely passive weight data.

Main capabilities The server currently provides the following tools:

  • available_scanners: shows the installed and ready scanner backends.
  • artifact_safety_report: runs the broadest available scan on a single model artifact, returning each scanner's results, normalized findings, highest severity, and recommended actions.
  • modelscan_scan: runs ModelScan directly on a local file or URL.
  • picklescan_scan: runs PickleScan directly on a local file or URL.
  • deep_model_inspect: runs lightweight structural inspection to identify risky extensions, embedded pickle members, and suspicious packaging patterns.
  • scan_directory: runs artifact_safety_report on every file in a directory and summarizes the risky files.

Detection strengths This MCP is strongest when scanning: PyTorch checkpoints (such as .pt, .pth); pickle-like artifacts (such as .pkl, .pickle, .joblib); Keras and TensorFlow HDF5 models (such as .h5); model packages that are actually ZIP or TAR containers. It combines modelscan (the best general-purpose backend, especially good at model-specific unsafe patterns such as Keras Lambda), picklescan (a specialized support backend for pickle artifacts), and deep_model_inspect (a fast heuristic fallback that can still uncover risky packaging when dedicated scanners report no alerts).

Supported inputs It can scan local filesystem paths, or direct http/https artifact URLs. For Hugging Face, direct file URLs should be used, for example https://huggingface.co/<repo>/resolve/main/model.h5; blob URLs are not recommended, because blob URLs usually return an HTML page, whereas resolve URLs return the actual artifact bytes.

Usage The repository includes a built-in local Python 3.12 runtime (python312), which is the supported runtime. To start the server, run the launcher run_server.py in the repository. To configure the MCP server in Cursor: name model-safety, command pointing to python312/python.exe, arguments pointing to run_server.py; an equivalent JSON configuration can also be used, and the repository provides the cursor.mcp.example.json example. Claude Code can also add this server.

Typical workflow: first confirm that the server is connected, ask about available scanners, and you should see installed backends such as modelscan and picklescan; then run artifact_safety_report on a local file or direct URL as the default entry point for single-artifact scanning; read the returned raw per-scanner output, normalized_findings, highest_severity, and recommended_actions; only when needed, drill down to modelscan_scan, picklescan_scan, or deep_model_inspect; for an entire batch of models, use scan_directory for batch triage, obtaining aggregated normalized findings, directory-level highest severity, risky_files, and per-file nested reports. scan_directory is best suited to folders that mainly contain model artifacts rather than general source code.

Example results Typical results for a suspicious PyTorch checkpoint include: risky extension .pth, pickle members embedded in the archive, and a recommendation to avoid trusted loading before review. Typical results for a suspicious Keras model from Hugging Face include: risky extension .h5, a ModelScan H5LambdaDetectScan finding, and a recommendation to inspect Keras Lambda layers before deserialization.

Output philosophy and limitations The server treats the scanners as complementary: modelscan is the primary safety backend, picklescan is the professional support backend, and deep_model_inspect is the fast structural fallback; it also generates standardized findings with recommended_action, so users do not have to interpret each tool separately. This tool helps triage risk, but it cannot prove that a model is safe. Important limitations include: coverage for some formats is better than for others; a clean scan does not guarantee harmless behavior; remote URL scanning depends on the URL pointing to the actual artifact bytes; directory scanning is a literal scan and may produce noise on non-model folders; model behavior risk is different from serialization and packaging risk.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools