op-injection-scanner
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
op-injection-scanner
An MCP server for prompt injection boundary enforcement. AI agents call scan_url(url) instead of fetching URLs directly. The server fetches the URL (with SSRF protection), strips HTML to plain text, and scans the content for prompt injection using a three-tier model escalation strategy (Haiku → Sonnet → Opus). Results are cached by URL and TTL bucket so repeated calls within the cache window incur no additional LLM cost.
Installation
git clone https://github.com/ethereum-optimism/op-injection-scanner
cd op-injection-scanner
bun installRelated MCP server: InjectShield
Claude Code MCP config
Add to ~/.claude.json or your project's .claude/settings.json:
{
"mcpServers": {
"op-injection-scanner": {
"command": "bun",
"args": ["run", "/absolute/path/to/op-injection-scanner/src/server.ts"]
}
}
}The server requires ANTHROPIC_API_KEY in the environment.
Usage
Agents call scan_url with a URL instead of fetching it directly:
scan_url({ url: "https://some-external-docs.example.com/page" })Clean response — status 200, tool returns:
{
"status": "clean",
"content": "The stripped page text...",
"url": "https://some-external-docs.example.com/page",
"scanned_at": "2026-03-08T12:00:00.000Z",
"model_used": "claude-haiku-4-5",
"escalated": false
}Blocked response — tool returns isError: true so the calling agent receives a tool error:
{
"status": "blocked",
"reason": "Content contains instructions attempting to override agent behaviour",
"url": "https://malicious.example.com/page",
"scanned_at": "2026-03-08T12:00:00.000Z",
"model_used": "claude-haiku-4-5",
"escalated": false
}When the tool returns isError: true, the calling agent should not process the URL further.
Environment variables
Variable | Default | Purpose |
| (required) | Anthropic API key — read automatically by the SDK |
|
| Maximum number of cached scan results |
|
| Cache entry lifetime in seconds (1 hour) |
|
| Minimum confidence for a verdict — below this, escalate to next tier |
|
| HTTP request timeout in milliseconds |
|
| Maximum response body size (2 MB) |
|
| Maximum number of HTTP redirects to follow |
|
| Maximum URL length in characters |
Design decisions
Why MCP, not a hook
A Claude Code hook fires automatically on every tool call, but it cannot be selectively invoked or tested in isolation. An MCP server is explicit — agents opt in to scanning, the interface is testable, and it can be extended (new tools, new scan types) without touching hook infrastructure.
v1 scope
This version detects prompt injection only. Malicious intent detection (e.g. phishing, credential harvesting) is a future iteration. The clean verdict means "no injection attempt detected" — not "content is safe in all respects."
Tiered model strategy
Haiku — fast, cheap, handles the majority of clear-cut cases
Sonnet — escalated when Haiku returns
uncertainor confidence < 0.8Opus — final arbiter, called only when Sonnet also cannot reach a confident verdict; schema enforces a definitive
cleanorblockedverdict (nouncertainallowed); parse failure defaults toblocked
No auth or rate limiting
This is internal dev tooling. Network isolation is the access control. Auth and per-session rate limiting are noted as future work in the source.
DNS rebinding (known v1 limitation)
The SSRF guard resolves DNS once before the request and checks all returned IPs. A sophisticated attacker controlling a low-TTL DNS record could return a public IP on the initial check and re-resolve to a private IP at TCP connection time, bypassing the guard. Full mitigation requires a custom DNS-pinning HTTP client. This is acceptable for internal tooling but must be addressed before any public or shared deployment.
This server cannot be deployed
Maintenance
Related MCP Connectors
Scan prompts for injection attacks, redact PII, and audit LLM SDK usage from any MCP client
Prompt-injection scanner for agents: risk score, categories and spans for text, pages, MCP tools
Security scanner for AI agents and MCP servers: injection, jailbreak, tool abuse.
Email safety MCP server. Detects phishing, prompt injection, CEO fraud for AI agents.
Related MCP Servers
- AlicenseAqualityBmaintenanceAn MCP server that provides safeguard capabilities to protect against prompt injection and unsafe tool calls.770 PyPI11MIT
- AlicenseNot gradedqualityCmaintenanceMCP server that provides tools to scan text and URLs for prompt injection attacks, protecting AI agents from adversarial inputs.1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that provides runtime defense for AI agents, protecting against prompt injection, data exfiltration, and other adversarial attacks through a ranked pipeline of up to 36 inline defenses and 3 output scanners.2Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA URL security scanner and MCP server that enables AI agents to analyze URLs for phishing, malware, and other threats before navigation, with optional intent alignment checks.6Apache 2.0