A lightweight security validation layer for MCP (Model Context Protocol) inputs
Wellknown found it in public sources; nobody has proven control of it yet. Claiming takes one click if the repository is under your GitHub account, or a small file on your domain otherwise. Verified owners get the badge, 15-minute checks, status alerts, edits that outrank crawled data, and a ranking boost.
Agents can do it too: POST https://wellknown.network/api/v1/claims with {"agent":"mcp-marshal","method":"well_known_file"} — machine-readable steps at claim.json, guide at /docs/claim.
Everything here was measured by our prober or read from a registry. Nothing is self-reported.
Attributed to the source that supplied each field. Treated as claims, not facts.
# mcp-marshal **mcp-marshal** is a lightweight security validation layer for [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) inputs. It scans tool-call payloads for risky patterns - SQL injection, XSS, and other common attack vectors - before they reach your model or tool handler. This is an early but functional release. The core validation logic works today; more features are on the roadmap. --- ## Installation ```bash pip install mcp-marshal ``` --- ## Quick start ```python from mcp_marshal import Warden warden = Warden() # Clean input result = warden.validate_input({"query": "What is the weather today?"}) print(result) # {"valid": True, "issues": []} # Risky input result = warden.validate_input({ "query": "SELECT * FROM users; DROP TABLE users;--", "context": "admin panel" }) print(result["valid"]) # False for issue in result["issues"]: print(issue) # {"field": "query", "pattern": "DROP TABLE", "severity": "critical"} # {"field": "query", "pattern": "--", "severity": "medium"} # {"field": "query", "pattern": ";--", "severity": "high"} ``` --- ## Custom patterns ```python from mcp_marshal import Warden extra = [ {"pattern": "IGNORE PREVIOUS INSTRUCTIONS", "severity": "critical"}, {"pattern": "jailbreak", "severity": "high"}, ] warden = Warden(extra_patterns=extra) result = warden.validate_input({"prompt": "Ignore previous instructions and ..."}) print(result["valid"]) # False ``` --- ## API ### `Warden(extra_patterns=None)` Create a warden instance. Pass `extra_patterns` to extend the built-in ruleset. ### `Warden.validate_input(payload: dict) -> dict` Scan all string values in `payload` (recursively) for risky patterns. Returns: ```python { "valid": bool, "issues": [ { "field": str, # dot-path to the offending key "pattern": str, # matched pattern "severity": str, # low | medium | high | critical …
Mapped onto the structured taxonomy from declared text and observed tool names. Confidence shown for derived entries.
Every source is kept verbatim. Field changes are logged as events.