protect-mcp
⚠️ このリポジトリは移動しました。 今後の開発は ScopeBlind/scopeblind-gateway で継続されます。
この個人のフォークは、正規のリポジトリより遅れている可能性があります。問題の報告、プルリクエスト、最新のコードについては、組織のリポジトリを使用してください。
protect-mcp
MCPサーバー用のセキュリティゲートウェイ。デフォルトでシャドウモードのログ記録、ツールごとのポリシー、オプションのローカルEd25519レシート、および検証が容易な監査出力を提供します。
現在のCLIパス: あらゆるstdio MCPサーバーを透過プロキシとしてラップします。シャドウモードでは、すべての tools/call リクエストをログに記録し、すべてを通過させます。ポリシーファイルを追加して、ツールごとのルールを強制します。protect-mcp init を実行してローカル署名キーと設定を生成すると、ゲートウェイは署名付きレシートを発行できるようになります。
クイックスタート
# Wrap an existing OpenClaw / MCP config into a usable pack
npx @scopeblind/passport wrap --runtime openclaw --config ./openclaw.json --policy email-safe
# Shadow mode — log every tool call, enforce nothing
npx protect-mcp -- node my-server.js
# Generate keys + config template for local signing
npx protect-mcp init
# Shadow mode with local signing enabled
npx protect-mcp --policy protect-mcp.json -- node my-server.js
# Enforce mode
npx protect-mcp --policy protect-mcp.json --enforce -- node my-server.js
# Export an offline-verifiable audit bundle
npx protect-mcp bundle --output audit.jsonRelated MCP server: protect-mcp
機能
protect-mcpは、MCPクライアントとサーバーの間にstdioプロキシとして配置されます:
MCP Client ←stdin/stdout→ protect-mcp ←stdin/stdout→ your MCP servertools/call JSON-RPCリクエストをインターセプトし、以下を行います:
シャドウモード(デフォルト):すべてのツール呼び出しをログに記録し、すべてを通過させます
強制モード:
block、rate_limit、min_tierなどのツールごとのポリシールールを適用しますオプションのローカル署名:署名が設定されている場合、構造化ログとともにEd25519署名付きレシートを発行します
その他のすべてのMCPメッセージ(initialize、tools/list、通知)は透過的に通過します。
現在の機能
ツールごとのポリシー — 破壊的なツールをブロックし、高コストなツールをレート制限し、最小ティア要件を付加します
構造化決定ログ — すべての決定は
[PROTECT_MCP]を付けてstderrに出力されますオプションのローカル署名付きレシート —
signing.key_pathを含むポリシーで実行すると生成され、.protect-mcp-receipts.jsonlに保存され、http://127.0.0.1:9876/receiptsで公開されますオフライン検証 —
npx @veritasacta/verifyでレシートやバンドルを検証しますアカウント不要 — ローカルキー、ローカルポリシー、ローカルプロセス
現在の機能の境界線
導入やユーザーへの説明の前に、以下の点にご注意ください:
署名は、単純な
npx protect-mcp -- ...パスでは自動的に行われません。 そのパスはシャドウモードで決定をログに記録します。ローカル署名を行うには、npx protect-mcp initを実行してから、生成されたポリシーファイルでゲートウェイを起動してください。ティア対応のポリシーチェックは有効ですが、マニフェストの承認はデフォルトのCLI/stdioパスには組み込まれていません。 ホスト統合がプログラムで承認APIを呼び出さない限り、CLIはセッションを
unknownと見なします。資格情報設定は、現在、環境変数ベースの資格情報参照を検証し、ログ/レシートに資格情報ラベルを記録します。 任意のstdioツールへの呼び出しごとの汎用的な注入はアダプター固有であり、デフォルトのプロキシパスでは実行されません。
外部PDPアダプターと監査バンドルヘルパーは、エクスポートされたユーティリティとして存在します。 これらは、デフォルトのCLIパスにはまだ完全には組み込まれていません。
ポリシーファイル
{
"default_tier": "unknown",
"tools": {
"dangerous_tool": { "block": true },
"admin_tool": { "min_tier": "signed-known", "rate_limit": "5/hour" },
"read_tool": { "require": "any", "rate_limit": "100/hour" },
"*": { "rate_limit": "500/hour" }
},
"signing": {
"key_path": "./keys/gateway.json",
"issuer": "protect-mcp",
"enabled": true
},
"credentials": {
"internal_api": {
"inject": "env",
"name": "INTERNAL_API_KEY",
"value_env": "INTERNAL_API_KEY"
}
}
}ポリシールール
フィールド | 値 | 説明 |
|
| このツールを明示的にブロックする |
|
| 基本的なアクセス要件 |
|
| ホストが承認状態を設定している場合に必要な最小ティア |
|
| レート制限(例: |
ツール名は完全に一致させる必要があり、"*" をワイルドカードとして使用できます。
MCPクライアントの設定
Claude Desktop
claude_desktop_config.json に追加します:
{
"mcpServers": {
"my-protected-server": {
"command": "npx",
"args": [
"-y", "protect-mcp",
"--policy", "/path/to/protect-mcp.json",
"--enforce",
"--", "node", "my-server.js"
]
}
}
}Cursor / VS Code
同じパターンです。サーバーコマンドを protect-mcp でラップしたものに置き換えてください。
CLIオプション
protect-mcp [options] -- <command> [args...]
protect-mcp init
Commands:
init Generate Ed25519 keypair + config template
status Show decision stats and local passport identity
digest Generate a local human-readable summary
receipts Show recent persisted signed receipts
bundle Export an offline-verifiable audit bundle
Options:
--policy <path> Policy/config JSON file
--slug <slug> Service identifier for logs/receipts
--enforce Enable enforcement mode (default: shadow)
--verbose Enable debug logging
--help Show helpプログラム用フック
このライブラリは、デフォルトのCLIパスにはまだ組み込まれていないプリミティブも公開しています:
import {
ProtectGateway,
loadPolicy,
evaluateTier,
meetsMinTier,
resolveCredential,
initSigning,
signDecision,
queryExternalPDP,
buildDecisionContext,
createAuditBundle,
} from 'protect-mcp';以下を追加したい場合に使用してください:
セッション開始前のマニフェスト承認
外部PDP(OPA、Cerbos、または汎用HTTP Webhook)
カスタムの資格情報仲介統合
独自のレシートストア周辺の監査バンドルエクスポート
決定ログとレシート
すべてのツール呼び出しは、構造化されたJSONを stderr に出力します:
[PROTECT_MCP] {"v":2,"tool":"read_file","decision":"allow","reason_code":"observe_mode","policy_digest":"none","mode":"shadow","timestamp":1710000000}署名が設定されている場合、署名付きレシートが続きます:
[PROTECT_MCP_RECEIPT] {"v":2,"type":"decision_receipt","algorithm":"ed25519","kid":"...","issuer":"protect-mcp","issued_at":"2026-03-22T00:00:00Z","payload":{"tool":"read_file","decision":"allow","policy_digest":"...","mode":"shadow","request_id":"..."},"signature":"..."}CLIで検証:npx @veritasacta/verify receipt.json
ブラウザで検証:scopeblind.com/verify
監査バンドル
このパッケージは、自己完結型の監査バンドル用のヘルパーをエクスポートします:
{
"format": "scopeblind:audit-bundle",
"version": 1,
"tenant": "my-service",
"receipts": ["..."],
"verification": {
"algorithm": "ed25519",
"signing_keys": ["..."]
}
}収集した独自の署名付きレシートに対して createAuditBundle() を使用してください。
哲学
シャドウファースト。 何かを強制する前に、エージェントが何をしているかを確認します。
レシートはダッシュボードのみのログに勝る。 署名されたアーティファクトは、独立して検証可能であるべきです。
主張を厳密に保つ。 デフォルトのCLIパスは、長期的なアーキテクチャがサポートするすべてをまだ実行しているわけではありません。
既存の認証の上に重ねる。 制御と証拠を追加するためだけに、スタックを入れ替えないでください。
インシデントベースのポリシーパック
protect-mcpに同梱されており、それぞれが実際の攻撃を防ぎます:
ポリシー | インシデント | OWASPカテゴリ |
| CVE-2025-6514: MCP OAuthプロキシハイジャック (437K環境) | A01, A03 |
| 自律型Terraformエージェントが本番環境を破壊 | A05, A06 |
| 作成されたGitHub Issueによるプロンプトインジェクション | A01, A02, A03 |
| アウトバウンドツール悪用によるエージェントのデータ窃取 | A02, A04 |
| 不正な金融取引 | A05, A06 |
npx protect-mcp --policy node_modules/protect-mcp/policies/clinejection.json -- node server.jsOWASP Agentic Top 10の完全なマッピング:scopeblind.com/docs/owasp
BYOPE: 外部ポリシーエンジン
OPA、Cerbos、Cedar (AWS AgentCore)、および汎用HTTPエンドポイントをサポートしています:
{
"policy_engine": "hybrid",
"external": {
"endpoint": "http://localhost:8181/v1/data/mcp/allow",
"format": "cedar",
"timeout_ms": 200,
"fallback": "deny"
}
}標準とIP
IETF Internet-Draft: draft-farley-acta-signed-receipts-00 — マシン間アクセス制御のための署名付き決定レシート
特許状況: 決定レシート(構成可能な開示、ツール呼び出しゲートウェイ、エージェントマニフェスト、ポータブルIDを含む)に関するオーストラリアの仮特許4件が申請中 (2025-2026)
検証: MITライセンス —
npx @veritasacta/verify --self-test
ライセンス
MIT — 制限なしで自由に使用、変更、配布、構築が可能です。
scopeblind.com · npm · GitHub · IETF Draft
Available Tools
5 toolsdelete_fileB
Delete a file from the filesystem
Inputs: path (required).
deployC
Deploy the application to production
Inputs: environment (required), reason.
read_fileB
Read the contents of a file
Inputs: path (required).
web_searchC
Search the web for information
Inputs: query (required).
write_fileC
Write content to a file
Inputs: path (required), content (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct action: file operations (delete, read, write), deployment, and web search. There is no overlap or ambiguity between them.
Most tools follow verb_noun pattern (delete_file, read_file, write_file, web_search), but 'deploy' lacks a noun, breaking the consistent pattern slightly.
5 tools is a reasonable count, but the mix of file management, deployment, and web search seems odd for a single server scope.
The tool set lacks obvious necessary operations for any single domain: e.g., no update for files, no environment or config for deployment, making it incomplete for a coherent purpose.
Maintenance
Related MCP Connectors
Open-source MCP gateway with per-agent tool permissions, call approvals and tool-change review.
MCP gateway with runtime security policy, tool-call-level control, and audit of agent actions.
Security & DLP proxy for MCP: tool-poisoning scans, PII redaction on tool args/results. Beta.
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server for offline verification of signed artifacts — receipts, manifests, and audit bundles. MIT licensed, works without accounts or API calls. Tools: self_test, verify_receipt, verify_bundle, explain_artifact.46Apache 2.0
- AlicenseNot gradedqualityBmaintenanceSecurity gateway for MCP servers. Wraps any MCP server with per-tool policies (Cedar + JSON), Ed25519-signed decision receipts, human approval gates, and trust tiers. Shadow mode by default — logs everything, blocks nothing.1,879 npm10MIT
- AlicenseNot gradedqualityCmaintenanceSecurity gateway for MCP tool calls. Sits between your LLM client and MCP servers, enforcing per-tool policies (allow/block/approve/read-only), logging every call, and pausing dangerous operations for human approval in terminal or Slack.2MIT
- AlicenseNot gradedqualityCmaintenanceSelf-hosted MCP gateway that applies deterministic, compiled policy to tool discovery, invocation, and outbound data flow, with no model in the enforcement path. Every decision emits a hash-chained receipt sealed with Ed25519 and verifiable using public keys only.Apache 2.0