Skip to main content

mcp-sentinel

CI License: MIT Python 3.9+

A security scanner for MCP (Model Context Protocol) servers.

MCP servers are exploding — every agent framework now connects to dozens of them. Almost none of them get security-reviewed. mcp-sentinel finds the things that quietly turn a "helpful tool" into an attack surface:

  • 🧠 Prompt-injection-prone tool descriptions — phrasing designed to hijack the calling LLM ("ignore previous instructions", hidden invisible unicode, suspiciously long descriptions that smuggle instructions).
  • 🔓 Over-broad capabilities — tools that expose shell/exec/arbitrary file access, or accept unvalidated free-form input (additionalProperties: true).
  • 💣 Dangerous code paths in the server implementation — eval, subprocess(..., shell=True), os.system, pickle.loads, unsafe yaml.load.
  • 🔑 Hardcoded secrets — API keys, AWS keys, GitHub/Slack tokens baked into source or config instead of environment variables.
  • 🌐 Unsafe defaults — binding to 0.0.0.0, trust/skip_auth flags left enabled.

Install

pip install mcp-sentinel-cli

(the PyPI distribution is named mcp-sentinel-cli since mcp-sentinel was already taken; the installed command is still mcp-sentinel)

Or from source:

git clone https://github.com/YashkantG/mcp-sentinel.git
cd mcp-sentinel
pip install -e .

Usage

Scan a server's project directory, a single source file, or a captured tools/list / mcp.json manifest:

mcp-sentinel scan ./my-mcp-server
                             mcp-sentinel findings
┌──────────┬──────────────────────────────────┬─────────────────┬────────────────────────────────────────────────┐
│ Severity │ Rule                             │ Location         │ Message                                        │
├──────────┼──────────────────────────────────┼──────────────────┼─────────────────────────────────────────────────┤
│ HIGH     │ MCP001 (Prompt-injection...)     │ mcp.json         │ Tool 'run_shell' description matches...        │
│ HIGH     │ MCP102 (Shell command built...)  │ server.py:8      │ subprocess call with shell=True                │
│ HIGH     │ MCP201 (Hardcoded secret...)     │ mcp.json         │ Possible hardcoded secret: AWS Access Key ID   │
│ MEDIUM   │ MCP301 (Server bound to all...)  │ mcp.json         │ 'host' binds to all network interfaces         │
└──────────┴──────────────────────────────────┴──────────────────┴─────────────────────────────────────────────────┘

11 finding(s)  (HIGH: 8  MEDIUM: 3)

Use --format json for machine-readable output (great for CI), and --fail-on to control what severity trips a non-zero exit code:

mcp-sentinel scan ./my-mcp-server --format json
mcp-sentinel scan ./my-mcp-server --fail-on medium   # fail CI on MEDIUM or higher

Rules

ID Check
MCP001 Prompt-injection phrasing in tool description
MCP002 Hidden/invisible unicode characters in tool description
MCP003 Suspiciously long tool description (payload smuggling risk)
MCP004 Over-broad capability exposed by tool name/description
MCP005 Tool schema accepts arbitrary/unvalidated input
MCP101 Dangerous code execution sink (eval, exec, new Function)
MCP102 Shell command built from untrusted input
MCP103 Unsafe deserialization (pickle.loads, unsafe yaml.load)
MCP201 Hardcoded secret or credential
MCP301 Server bound to all network interfaces
MCP302 Authentication / trust check disabled

Why this exists

The MCP ecosystem grew faster than its security tooling. A malicious or careless MCP server can manipulate the LLM that's using it (via crafted tool descriptions) or simply be a badly-secured piece of software with shell access. mcp-sentinel is a fast, dependency-light first pass you can run locally or in CI before trusting a new server.

It's intentionally simple — pattern/regex-based checks rather than a full taint-tracking analyzer — so it's fast, has no false-negative-hiding complexity, and is easy to extend. Contributions adding new rules are very welcome.

Contributing

Issues and PRs welcome — especially new rules, language support (only Python/JS/TS source checks exist today), and real-world MCP servers to test against. See the tests/fixtures/ directory for the pattern used to add a new check with a positive and negative fixture.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_sentinel_cli-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_sentinel_cli-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_sentinel_cli-0.1.0.tar.gz.

File metadata

  • Download URL: mcp_sentinel_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_sentinel_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6d7d3bed8425d491561edca1bb66cef7a14d626486944194d6ba47c5db74932d
MD5 a6d151da38c61c5c140b011a8bea6500
BLAKE2b-256 8bcf026cc29ca1659c43307f64cb6f9d19fc6c85dc498c21831a0f9d71786181

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_sentinel_cli-0.1.0.tar.gz:

Publisher: publish.yml on YashkantG/mcp-sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_sentinel_cli-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_sentinel_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66d6a447d0d8691c143c5819f7f97944987c2b3070300def71a68920fa08b203
MD5 16fd482935a8ca18031ffe55bbbd16ac
BLAKE2b-256 34ee35667e878401645f6974ef6c177713cd1eee8c0f7b2c5b88a63147a833d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_sentinel_cli-0.1.0-py3-none-any.whl:

Publisher: publish.yml on YashkantG/mcp-sentinel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page