mcp-audit
mcp-audit
MCPサーバー向けnpm audit。 MCPサーバーを指定して、認証の欠如、SSRF攻撃対象領域、高権限ツール、プロンプトインジェクションを受けやすいツール説明、シークレット漏洩をカバーするセキュリティグレード(A~F)を取得します。
なぜこれが存在するのか(2026年データ):約7,000の公開MCPサーバーのうち、41%が認証を必要とせず、36.7%がSSRF攻撃対象領域を露出し、わずか8.5%がOAuthを使用しており、30以上のCVEがわずか60日間の期間内に報告されました。サーバー数は飽和状態(22,000以上)ですが、セキュリティ態勢はそうではありません。他のツール(例:Invariantのmcp-scan)は単一のサーバーを詳細に検査しますが、mcpauditはレジストリ全体のバッチ監査を追加します。公式MCPレジストリを指定して、エコシステム全体を一度に評価します。
npm i -g @andreolf/mcpaudit # then: mcpaudit <url>
# or zero-install: npx @andreolf/mcpaudit <url>実行しても安全ですか? 設計上、はい。mcpauditは読み取り専用のinitialize + tools/listハンドシェイクのみを送信し、宣言されたツールを検査します。スキャンされたサーバーのコードを実行することは決してありません。ただし、ローカル/npmサーバーを起動するために--allow-execを明示的に渡した場合は除きます。
⚠️ ヒューリスティックスキャナー。調査結果は表面(例:「認証なし」、「URL取得ツールを公開」)を説明しており、証明されたエクスプロイトではありません。クリーンレポートはセキュリティの保証ではありません。テストする権限のあるサーバーのみをスキャンし、責任を持って調査結果を開示してください。SECURITY.mdを参照してください。
使用方法
リモートサーバーのスキャン(Streamable HTTP):
node bin/mcp-audit.js https://example.com/mcp
node bin/mcp-audit.js https://example.com/mcp --header "Authorization: Bearer $TOKEN" --json公開済みサーバーのスキャン(npx -y <package>で起動):
node bin/mcp-audit.js --npm @modelcontextprotocol/server-filesystem --timeout 20000コマンドで起動したローカルサーバーのスキャン(stdio):
node bin/mcp-audit.js --cmd "node my-server.js"Node 18+が必要です(グローバルfetchを使用)。依存関係ゼロ。インストール:npm i -g @andreolf/mcpaudit その後 mcpaudit <url> — または npx @andreolf/mcpaudit <url>。
終了コード:0 クリーン · 1 深刻/高リスクの発見 · 2 スキャン不可/使用方法の誤り。CI対応。
Related MCP server: mcp-security-audit
バッチモード(ローンチ監査)
多数のサーバーをスキャンして、最悪順のリーダーボードとローンチ投稿のための集計統計を取得します:
node bin/mcp-audit-batch.js targets.txt --out audit.mdtargets.txtは1行に1つのターゲット(https://…、npm:<package>、またはcmd:<command>;#コメント許可)。
⚠️ 安全性:
npm:/cmd:サーバーのスキャンは、そのサーバーのコードをマシン上で実行します。バッチモードはデフォルトでHTTPのみであり、--allow-execを渡さない限りローカル/npmターゲットをスキップします—これは信頼できるサンドボックス/コンテナ内でのみ行ってください。信頼できないパッケージを大量に実行することは、リモートコード実行の露出です。
出力には、ローンチスレッドとなる主要な数値(「到達可能なHTTPサーバーのX%が認証なしでinitializeを受け入れる」)が含まれます。
完全なローンチパイプライン
公式MCPレジストリからターゲットを取得し(検出のみ—サーバーは決して実行しません)、それらを監査します:
node bin/mcp-audit-fetch.js --max 300 --out targets.txt # HTTP remotes = safe to scan
node bin/mcp-audit-batch.js targets.txt --concurrency 8 --out audit.mdmcpaudit-fetchは、レジストリのHTTPエンドポイントをスキャン可能な行として出力し、npmパッケージはコメントアウトされた行として出力します(--include-npmでオプトインし、サンドボックス内で--allow-execを使用)。最初の30のレジストリサーバーの実際の実行では、50%が認証なしでinitializeを受け入れることがわかりました—これはローンチ投稿が基盤とする種類の数値です。
CIでの使用(GitHub Action)
すべてのPRでMCPサーバーのセキュリティをゲートします。サーバーを起動し、アクションをサーバーに向けます:
- name: Start my MCP server
run: node my-server.js & # or docker run ..., then wait for it to be ready
- name: Security-audit the MCP server
uses: andreolf/mcp-audit@v1
with:
url: http://localhost:3000/mcp
fail-on: D # fail the job on grade D or worse (default: F)
# header: "Authorization: Bearer ${{ secrets.MCP_TOKEN }}" # optionalジョブはA~Fのグレードと調査結果を出力し、グレードがfail-on以下であれば失敗します。スキャンされたサーバーでは何も実行されません—読み取り専用のハンドシェイクのみを送信します。
テスト
npm test # spawns the mock insecure server (stdio + batch) and asserts findings — 12 checksチェック内容(スターターヒューリスティック—これらを拡張してください)
no-auth — サーバーが認証情報なしで
initializeを受け入れる(深刻)ssrf-surface — URLを受け取る/送信リクエストを行うツール(高)
high-privilege-tool — exec/shell/delete/write-fileスタイルのツール(高)
injection-in-description — ツール説明におけるオーバーライド/インジェクション表現(中)
leaked-secret — ツールメタデータ内のトークン/キー形状の文字列(深刻)
アーキテクチャ
bin/mcp-audit.js CLI entry (arg parsing, exit codes for CI)
src/scan.js orchestrator
src/mcpClient.js MCP Streamable-HTTP transport: initialize + tools/list
src/checks.js heuristic security checks -> findings
src/report.js grading (A–F), badge, Markdown/JSON outputロードマップ(このスケルトンをバイラルなものに変える)
✅ stdio + npmトランスポート — リモートURLだけでなく、ローカル(
--cmd)および公開済み(--npm、npx経由)サーバーをスキャン。これにより、ローンチ監査のためにレジストリのトップサーバーのスキャンが可能になります。 (PyPI/uvx相当は小さなフォローアップです。)静的キー vs OAuth検出 — 認証チャレンジ/トークン形式を検査。
より深いSSRFプローブ — サンドボックス内のカナリア内部URLに対してfetchスタイルのツールを実際に呼び出します。
✅ バッチモード + リーダーボード —
mcpaudit-batch targets.txt→ ランク付けされたレポート + 主要統計。 そのランク付けされたレポートがローンチアーティファクトです:「最もインストールされている200のMCPサーバーを監査しました。」✅ レジストリフェッチャー(
mcpaudit-fetch) — 公式MCPレジストリからHTTPターゲットを取得(検出のみ、サーバーは決して実行しません)。npmパッケージはコメントアウトされて出力されます。オプトインするには--include-npm。埋め込み可能なバッジ —
MCP Security: Ashields.ioスタイルのバッジで、サーバーがREADMEに追加(2026年のランキングシグナル、そしてあなたへの無料配布)。レジストリプレゼンス — mcp.so、smithery.ai、glama.ai、PulseMCP、公式MCPレジストリに掲載し、punkpeye/awesome-mcp-serversにPR。1つのメタデータパックを準備し、すべてに提出。
ライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
Scan any MCP server for tool-poisoning, security, auth & license. Trust score before install.
Audit MCP servers for tool poisoning and shadowing. Scan a remote server by URL or paste its tools.
Grade MCP servers A to F with the open behavioral litmus. npm: full toolset; hosted: lookups only.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceSecurity scanner for MCP servers. Detects prompt injection, command injection, auth bypass, and excessive permissions across tools, resources, and prompts.5 npm2MIT
- AlicenseNot gradedqualityDmaintenanceSecurity auditor for MCP servers that enumerates tools, resources, and prompts, scans for injection patterns, classifies risk levels, and produces a scored report (0-100, grades A-F).26 PyPI2MIT
- AlicenseNot gradedqualityCmaintenanceSecurity scanner for MCP servers — vet an MCP before you wire it into an agent. Detects prompt-injection, credential exfiltration (via taint analysis), RCE, and supply-chain risks, and catches cross-server exfil chains no single server reveals. Zero-dependency local CLI, SARIF output, CI-gateable, no account.19 npmMIT
- AlicenseCqualityDmaintenanceSecurity scanner and MCP server that catches dangerous patterns in MCP servers and AI agent projects, such as leaked secrets, shell execution, and prompt-injection text. Runs as both a CLI and MCP server with CI-friendly severity gates.21MIT