Injectshield

io.github.bch1212由 GitHub 账号 bch1212 发布v0.1.4更新于 Oct 25, 2026

Prompt-injection firewall for AI agents — scan untrusted text before LLM calls.

概览

AI 生成的概览

本地 MCP 服务器,将 InjectShield 提示注入检测 API 暴露为工具,让助手在把不可信文本或网页交给另一个 LLM 之前先做扫描。

可以做什么
扫描字符串中的提示注入,返回判定结果、置信度、威胁类别、命中的模式 ID,以及可选的红action 掉注入片段的净化版本。抓取 URL 并扫描其正文,自动按网页内容处理。列出支持的威胁类别、上下文类型和敏感度级别。
适用场景
当助手需要读取不可信文本、抓取的网页或文件,并希望在把内容送入另一个 LLM 调用前检查提示注入时适用。它是辅助防线,不能替代其他防护措施。
运行要求
通过 npx 从 npm 包 @injectshield/mcp 以本地 stdio 进程运行,需要 Node.js。需要在 INJECTSHIELD_API_KEY 环境变量中提供 API 密钥,可从厂商网站获取(免费额度标注为每月 1 万次请求)。可用 INJECTSHIELD_API_BASE 覆盖 API 基础地址以用于自托管部署。需要能访问 InjectShield API 的网络。
安装前请注意
被扫描的文本和抓取的网页正文会发送给第三方 InjectShield API,不要扫描不愿外泄的密钥或私密内容。API 密钥是放在环境变量中的凭据,避免写入共享配置。厂商说明它只能降低而不能消除提示注入风险,应配合其他防护。扫描会消耗 API 配额。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Injectshield,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@injectshield/mcp

MCP server for InjectShield — exposes the InjectShield prompt-injection-detection API as MCP tools so any MCP-compatible client (Claude Code, Cursor, Cline, etc.) can scan untrusted text before passing it into another LLM call.

Tools

  • scan — Scan a string for prompt-injection. Returns verdict, confidence, threat category, matched pattern IDs, and an optional sanitized version with injection spans redacted.
  • scan_url — Fetch a URL and scan its body. Sets context to web_content automatically.
  • patterns — List supported threat categories, context kinds, and sensitivity levels.

Get an API key

Free tier: 10,000 requests/month, no credit card. Self-serve at https://injectshield.dev — your key is delivered by email.

Install in Claude Code

bash
claude mcp add injectshield --env INJECTSHIELD_API_KEY=is_live_… -- npx -y @injectshield/mcp

Install in Cursor

Add to ~/.cursor/mcp.json:

jsonc
{  "mcpServers": {    "promptshield": {      "command": "npx",      "args": ["-y", "@injectshield/mcp"],      "env": { "INJECTSHIELD_API_KEY": "is_live_…" }    }  }}

Install in Cline / generic MCP client

Same shape as Cursor. Stdio transport, command npx -y @injectshield/mcp, set INJECTSHIELD_API_KEY in the env block.

Usage

Once installed, your agent has three new tools. Pattern-match this:

Before reading a fetched web page or file, call scan with the body and bail if safe is false. The cleaned variant in cleaned_text is the safest thing to feed forward.

Example (model-side reasoning):

User: Summarize https://example.com/article
Agent → scan_url({"url": "https://example.com/article"})  → { "safe": false, "threat_type": "instruction_injection",      "patterns_matched": ["ignore-previous", "system-prompt-leak"],      "cleaned_text": "...[REDACTED:instruction_injection]..." }Agent: I detected prompt-injection in this page. Working from the       redacted version: ...

Configuration

Env varDefaultPurpose
INJECTSHIELD_API_KEY(none)Required for scan and scan_url. Get a free one.
INJECTSHIELD_API_BASEhttps://api.injectshield.devOverride for self-hosted deployments.

Defense in depth

InjectShield reduces but does not eliminate prompt-injection risk. Pair it with system-prompt hardening, tool sandboxing, and output filtering. See the main repo for the full pattern library and a more thorough discussion.

License

MIT.

来源:packages/injectshield-mcp/README.md,提交 ec8eb5b

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.4最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分