TS tool-scan
Security

Scan MCP tools before they scan you.

Grades every tool on security, MCP compliance, and quality. Catches prompt injection, tool poisoning, data exfiltration, and command injection — A+ to F, no ambiguity.

Install

pip install tool-scan

Scan

tool-scan my_tool.json # Score: 95/100 Grade: A

CI gate

tool-scan --strict --min-score 80 tools/*.json

Features

Security, compliance, and quality in one scan.

Threat detection

Prompt injection, tool poisoning, hidden unicode, command injection, SQL injection, XSS, SSRF, and data exfiltration — all checked automatically.

MCP compliance

Validates against the MCP 2025-11-25 spec: required fields, name format, schema types, annotations, and additionalProperties.

Letter grades

Weighted scoring across security (40%), compliance (35%), and quality (25%). A+ to F with actionable remarks for every deduction.

Plugin system

Extend with custom security rules, compliance checks, and quality validators. Load from directories, entry points, or register programmatically.

SARIF output

SARIF v2.1.0 reports for GitHub Code Scanning, Azure DevOps, and VS Code. Security findings appear as inline annotations on PRs.

Concurrent scanning

Parallel file processing with --jobs N. Compact JSON (~50% smaller) and streaming mode for large batches.

Usage

CLI

# Scan a tool definition
tool-scan my_tool.json

# Strict mode for CI gates
tool-scan --strict --min-score 80 \
  tools/*.json

# JSON output for automation
tool-scan --json my_tool.json \
  > report.json

Python API

from tool_scan import grade_tool

tool = {
  "name": "get_weather",
  "description": "Gets weather.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "city": {"type": "string"}
    }
  }
}

report = grade_tool(tool)
print(f"{report.grade.letter} ({report.score})")

Threat Detection

What tool-scan catches.

Category
Threats
Severity
Prompt injection
Instruction overrides, role manipulation, fake system tags
Critical
Tool poisoning
Covert actions, hidden instructions in descriptions
Critical
Code injection
Shell metacharacters, SQL injection, XSS payloads
Critical
Unicode attacks
Zero-width spaces, homoglyph substitution
High
Network threats
SSRF (localhost, cloud metadata), data exfiltration URLs
Critical
Path traversal
Directory traversal in default values
High

CI/CD Integration

Gate deployments on tool safety.

GitHub Actions

Drop-in workflow step with --strict and --min-score flags. Upload SARIF reports as artifacts.

Pre-commit hooks

Scan tool JSON files on every commit. Block unsafe tools before they reach the repo.

Exit codes

0 = all passed, 1 = failures found, 2 = file errors. Standard Unix conventions for pipeline integration.

Quality scorecard

Ship Gate audit — 50/50.

Category
Score
Notes
A. Security
10/10
SECURITY.md, no network, no telemetry, no code execution
B. Error Handling
10/10
Structured exit codes, actionable remarks, JSON + SARIF output
C. Operator Docs
10/10
README, CHANGELOG, CONTRIBUTING, CITATION, API docs
D. Shipping Hygiene
10/10
CI (ruff + mypy + pytest), 323 tests, dep-audit, verify script
E. Identity
10/10
Logo, translations, landing page, 10 topics