rob925/mcp-shield

🔒 Security
0 Views
0 Installs

🐍 🏠 🍎 🪟 🐧 - Static security scanner and MCP server for MCP servers and AI agent tools. Detects secrets, shell execution, risky tool descriptions, environment access, and prompt-injection phrases. mcp-shield-server

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "rob925-mcp-shield": {
      "command": "npx",
      "args": [
        "-y",
        "rob925-mcp-shield"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

MCP Shield

Python CI License: MIT MCP

Security scanner and MCP server for Model Context Protocol servers, tools, prompts, and AI agent projects.

MCP gives agents access to tools. MCP Shield helps you catch the obvious dangerous parts before they reach production: leaked secrets, shell execution, risky tool descriptions, prompt-injection text, and CI-breaking security regressions.

mcp-scan .
[HIGH] code.shell_true server.py:42
  Shell execution is enabled.
  subprocess.run(cmd, shell=True)

[CRITICAL] secret.literal .env:1
  Possible hard-coded secret.
  OPENAI_API_KEY="sk-..."

Why MCP Shield

MCP servers often expose powerful capabilities: filesystem access, shell commands, network calls, credentials, browser automation, databases, and internal tools.

That is exactly where small mistakes become expensive:

  • a tool description encourages unsafe behavior
  • a test key becomes a real leaked token
  • an agent can call a shell command with user-controlled input
  • a prompt or resource contains injection text
  • CI has no security gate for MCP-specific risks

MCP Shield is the simple first line of defense: fast static checks, useful output, and a non-zero exit code when risk crosses your threshold.

Features

  • runs as both a CLI and an MCP server
  • built on the official MCP Python SDK
  • CI-friendly severity gates
  • text, JSON, Markdown, and SARIF output
  • inline suppressions with rule IDs
  • .mcp-scan-ignore for fixtures and intentional demos

What It Finds

RiskExamples
Hard-coded secretsAPI keys, tokens, passwords, private keys
Process executionsubprocess, child_process, shell=True
MCP tool risktools named or described as delete, shell, token, secret, filesystem
Environment accessos.environ, process.env
Prompt injection text"ignore previous instructions", system prompt leakage phrases

Install

From a local checkout:

pip install .

Run without installing:

python -m mcp_security_scanner.cli .

MCP Server

Run MCP Shield as a stdio MCP server:

mcp-shield-server

Available tools:

  • scan_path_tool - scan a local MCP server or agent project
  • list_rules - list rule IDs and descriptions

Example Claude Desktop-style command:

{
  "mcpServers": {
    "mcp-shield": {
      "command": "mcp-shield-server"
    }
  }
}

Usage

mcp-scan .
mcp-scan path/to/mcp-server
mcp-scan . --format json
mcp-scan . --format markdown --output mcp-security-report.md
mcp-scan . --format sarif --output mcp-shield.sarif
mcp-scan . --fail-on medium

Formats:

  • text for humans
  • json for automation
  • markdown for PR comments and reports
  • sarif for GitHub code scanning

Severity gates:

  • low
  • medium
  • high
  • critical

--fail-on high exits with code 1 when any high or critical finding exists.

Ignore Files

Create .mcp-scan-ignore in the scanned directory:

tests/
fixtures/
examples/unsafe-demo.py

Use this for intentional fixtures and demos. Do not use it to hide production risks.

Suppressions

Suppress a reviewed finding on the same line:

subprocess.run(cmd)  # mcp-shield: ignore code.subprocess

Use all only for test fixtures:

subprocess.run(cmd, shell=True)  # mcp-shield: ignore all

Example

Scan the intentionally unsafe example:

python -m mcp_security_scanner.cli examples/unsafe-mcp-server --fail-on critical

GitHub Actions

name: MCP security scan

on: [push, pull_request]

jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - run: pip install .
      - run: mcp-scan . --fail-on high

Roadmap

  • MCP SDK-aware parsing for Python and TypeScript servers
  • safer default rule pack for enterprise MCP servers
  • prompt/resource-specific injection checks
  • PyPI release for pipx install mcp-shield

Repository Topics

Add these GitHub topics for discovery:

mcp, model-context-protocol, ai-agents, security, security-tools, scanner, devtools, llm, prompt-injection, static-analysis

GitHub recommends repository topics because they help people discover and contribute to projects by purpose and subject area.

Scope

MCP Shield is a static heuristic scanner. It catches common risks early, but it is not a full security audit.

Help It Grow

MCP security is moving fast. The most useful contributions right now are real-world unsafe MCP examples, low-noise detection rules, and CI integrations.

If MCP Shield catches something useful, star the repo so more MCP builders can find it.

Related MCP Servers

13bm/GhidraMCP

🐍 ☕ 🏠 - MCP server for integrating Ghidra with AI assistants. This plugin enables binary analysis, providing tools for function inspection, decompilation, memory exploration, and import/export analysis via the Model Context Protocol.

🔒 Security1 views
123Ergo/unphurl-mcp

📇 ☁️ - URL intelligence for AI agents. 13 tools for security signals and data quality: redirect behaviour, brand impersonation detection, domain age, SSL validation, parked detection, URL structural analysis, DNS enrichment.

🔒 Security0 views
82ch/MCP-Dandan

🐍 📇 🏠 🍎 🪟 🐧 - Real-time security framework for MCP servers that detects and blocks malicious AI agent behavior by analyzing tool call patterns and intent across multiple threat detection engines.

🔒 Security0 views
9hannahnine-jpg/arc-gate-mcp

🐍 - Runtime governance for MCP tool calls. Blocks prompt injection and capability abuse before tool results reach your agent.

🔒 Security0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Not checked yet

We have not completed a health check for this listing yet.

No check timestamp yet.

Unclaimed listing (imported or pending owner verification). Claim it →
★ Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.