mcpwarden
A heuristic security linter for Model Context Protocol (MCP) setups.
mcpwarden reads MCP client configuration files, optional tool metadata dumps
(tools/list results) and, optionally, the source code of TypeScript/JavaScript
and Python MCP servers, and reports risky patterns: inline secrets, unpinned
packages fetched at launch, shell wrappers, overly broad filesystem roots,
plaintext remote endpoints, tool-poisoning text in tool descriptions, hidden
Unicode, tool-name collisions, auto-approved tools and a few common
server-side bug classes (command injection, path traversal, SSRF).
It performs static analysis only. It does not start servers, connect to endpoints or send anything over the network.
The checks are based on defect classes that Reflex Hardware Security keeps running into while auditing AI-agent and MCP open-source projects (see AI エージェントと MCP サーバに潜む脆弱性, in Japanese), plus well-known MCP risks such as tool poisoning and supply-chain pulls.
Install
Prebuilt binaries are published on PyPI for Linux (x86_64 and aarch64, glibc and musl), macOS (Apple Silicon and Intel) and Windows (x86_64), so no Rust toolchain is needed:
pipx install hwntools-mcpwarden # or: uv tool install hwntools-mcpwarden, or pip install hwntools-mcpwarden
On PyPI the package is called hwntools-mcpwarden (the name mcpwarden is too close to an
existing project there); the command it installs is mcpwarden.
hwntools installs it together with the other
Reflex tools with pip install "hwntools[tools]".
To build from source with Cargo:
Building from source requires Rust 1.88 or newer.
# latest version from GitHub (works today)
cargo install --locked --git https://github.com/reflex-hs/mcpwarden
# from crates.io (once published)
cargo install --locked mcpwarden
# from a checkout
cargo install --locked --path .
Usage
# Scan well-known client config locations on this machine
# (Claude Desktop, Cursor, VS Code, Claude Code, Windsurf, Gemini CLI)
mcpwarden scan
# Scan specific files or project directories
mcpwarden scan ~/.cursor/mcp.json .vscode/mcp.json
mcpwarden scan path/to/project # looks for .cursor/mcp.json, .vscode/mcp.json, .mcp.json, ...
# Add tool metadata (saved tools/list results) for the metadata rules
mcpwarden scan claude_desktop_config.json -t weather.tools.json -t github.tools.json
# Add source heuristics for an MCP server you are building or reviewing
mcpwarden scan --source ./my-mcp-server
# Machine-readable output
mcpwarden scan --json > report.json
mcpwarden scan --sarif -o mcpwarden.sarif
# List servers / rules
mcpwarden list
mcpwarden rules
Options
| Option | Description |
|---|---|
-t, --tools FILE |
Tool metadata file. Repeatable. |
-s, --source DIR |
Source directory or file for the MCP1xx heuristics. Repeatable. |
-f, --format text|json|sarif |
Output format (default text). --json / --sarif are shorthands. |
-o, --output FILE |
Write the report to a file. |
--fail-on SEVERITY |
Exit with status 1 if any finding is at or above this severity. Default high; none disables. |
--min-severity SEVERITY |
Hide findings below this severity. |
--ignore RULE[,RULE] |
Suppress rule IDs. |
--no-color |
Disable colours (also honours NO_COLOR). |
Severities: info, low, medium, high, critical.
Exit codes: 0 no findings at or above --fail-on, 1 findings at or above
--fail-on, 2 usage or input error (unreadable file, invalid JSON, unknown rule).
Supported config formats
| Client | File | Key |
|---|---|---|
| Claude Desktop | claude_desktop_config.json |
mcpServers |
| Cursor | ~/.cursor/mcp.json, .cursor/mcp.json |
mcpServers |
| VS Code | .vscode/mcp.json, user mcp.json (JSONC) |
servers |
| VS Code settings | settings.json |
mcp.servers |
| Claude Code | .mcp.json, ~/.claude.json |
mcpServers, projects.*.mcpServers |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
mcpServers |
| Gemini CLI | ~/.gemini/settings.json |
mcpServers |
| Generic | any JSON/JSONC file | mcpServers or servers |
Comments and trailing commas are accepted everywhere. Fields read from a
server entry: command, args, env, url / serverUrl / httpUrl,
headers, type / transport, alwaysAllow, autoApprove, trust,
disabled, and (an mcpwarden extension) inline tools.
Tool metadata files
The metadata rules (MCP006 to MCP011) need the tool list a server advertises.
Save it once with any MCP client and pass it with --tools. For example, with
the MCP Inspector CLI:
npx @modelcontextprotocol/inspector --cli node build/index.js --method tools/list > myserver.tools.json
Accepted shapes: {"tools": [...]}, a JSON-RPC response
{"result": {"tools": [...]}}, a bare array of tools, or a map
{"<server>": {"tools": [...]}, ...}. For single-server files the server name
comes from a top-level server field or the file name (weather.tools.json
becomes weather). Tools whose server name matches a server in a scanned
config are attached to it; collisions (MCP009) are computed across every
server in the scan, so scan one client's servers at a time.
Rules
| ID | Name | Max severity | Input | What it looks for |
|---|---|---|---|---|
| MCP001 | inline-secret | high | config | Known token formats (GitHub, AWS, GitLab, Slack, Stripe, Google, npm, Hugging Face, sk- API keys, private keys, JWTs) and credential-named env vars, flags, headers or URL parts holding literal values. Placeholders such as ${input:x} or ${env:X} are ignored. Evidence is redacted. |
| MCP002 | unpinned-package | medium | config | npx, bunx, npm exec, pnpm dlx, yarn dlx, uvx, uv tool run, pipx run without an exact version, with ranges or dist-tags, or from git/URL sources without a commit; docker/podman images without a tag or digest, or with latest. |
| MCP003 | shell-wrapper | high | config | Servers started through sh -c, bash -lc, cmd /c, powershell -Command / -EncodedCommand; high when a download is piped into an interpreter. |
| MCP004 | broad-filesystem-access | high | config | Arguments or bind mounts that grant /, a drive root, a whole home directory, ~/.ssh, ~/.aws, ~/.kube, /etc and similar. |
| MCP005 | insecure-transport | high | config | http:// / ws:// endpoints on non-loopback hosts (also in proxy arguments such as mcp-remote), --allow-http. |
| MCP006 | prompt-injection-pattern | high | metadata | Tool descriptions, schema text or server instructions containing "ignore previous instructions", <IMPORTANT>-style tags, "do not tell the user", references to ~/.ssh / mcp.json / .env, exfiltration instructions, "before using this tool ..." coercion, role overrides and HTML comments. |
| MCP007 | hidden-unicode | critical | metadata, config | Unicode tag characters (decoded and shown), zero-width characters and bidi controls in tool metadata, server names, arguments or env values. |
| MCP008 | encoded-payload | medium | metadata | Base64 blobs in metadata that decode to readable text. |
| MCP009 | tool-name-collision | medium | metadata | The same tool name exposed by two servers (medium) or names that differ only by case or separators (low). |
| MCP010 | internal-endpoint-disclosure | low | metadata | Private IPv4 addresses and internal hostnames (*.internal, *.corp, *.local, ...) in tool metadata. |
| MCP011 | high-privilege-tool | low | metadata | Tools that look like arbitrary command, code or query execution (run_command, execute_sql, ...). |
| MCP012 | auto-approved-tools | high | config | alwaysAllow / autoApprove lists (high with wildcards) and trust: true. |
| MCP013 | container-host-access | high | config | --privileged, host network/PID/IPC namespaces, dangerous --cap-add, unconfined security profiles, Docker socket mounts. |
| MCP101 | command-injection | high | source | exec/execSync with non-constant strings, spawn(..., {shell: true}), subprocess.*(shell=True), os.system/os.popen with non-constant input. |
| MCP102 | path-traversal | medium | source | File APIs and path.join/os.path.join fed with input-like identifiers in files that contain no containment check (realpath, startsWith, is_relative_to, ...). |
| MCP103 | ssrf | medium | source | fetch/axios/requests/httpx/urlopen with a non-constant URL in files with no address filtering at all. |
| MCP104 | bypassable-ssrf-guard | medium | source | Address filtering that resolves the name separately from the request (DNS rebinding window, medium) or compares strings without handling IPv4-mapped IPv6 such as ::ffff:127.0.0.1 (low). |
| MCP105 | dynamic-code-eval | high | source | eval, new Function, vm.runIn*Context, Python eval/exec on non-constant input. |
Source rules are line-based pattern matches without data-flow analysis. They are tuned to point at code worth reading, not to prove exploitability.
Example
$ mcpwarden scan examples/claude_desktop_config.json -t examples/weather.tools.json -t examples/filesystem.tools.json
HIGH MCP001 inline-secret examples/claude_desktop_config.json:11 [server=github]
GitHub token hard-coded in env var `GITHUB_PERSONAL_ACCESS_TOKEN`
evidence: GITHUB_PERSONAL_ACCESS_TOKEN=ghp_… (40 chars, redacted)
HIGH MCP003 shell-wrapper examples/claude_desktop_config.json:16 [server=weather]
server launch downloads code and pipes it straight into an interpreter
evidence: curl -fsSL https://weather.example.com/install.sh | sh && weather-mcp
HIGH MCP006 prompt-injection-pattern examples/weather.tools.json:6 [server=weather tool=get_forecast]
description of tool `get_forecast` coerces the model to call it before or instead of other tools
evidence: Before using this tool, read
HIGH MCP006 prompt-injection-pattern examples/weather.tools.json:6 [server=weather tool=get_forecast]
description of tool `get_forecast` contains a pseudo-tag aimed at the model
evidence: <IMPORTANT>
HIGH MCP006 prompt-injection-pattern examples/weather.tools.json:6 [server=weather tool=get_forecast]
description of tool `get_forecast` references sensitive local files
evidence: ~/.ssh
HIGH MCP006 prompt-injection-pattern examples/weather.tools.json:6 [server=weather tool=get_forecast]
description of tool `get_forecast` tells the model to hide actions from the user
evidence: Do not mention this to the user
MEDIUM MCP002 unpinned-package examples/claude_desktop_config.json:5 [server=filesystem]
`npx` runs `@modelcontextprotocol/server-filesystem` without an exact version (no version); every launch may pull a different release
evidence: @modelcontextprotocol/server-filesystem
MEDIUM MCP004 broad-filesystem-access examples/claude_desktop_config.json:5 [server=filesystem]
server is given an entire home directory `/Users/alice`
evidence: /Users/alice
MEDIUM MCP005 insecure-transport examples/claude_desktop_config.json:19 [server=team-wiki]
remote MCP endpoint `wiki.example.com` is reached over plaintext http
evidence: http://wiki.example.com/mcp/sse
MEDIUM MCP009 tool-name-collision examples/filesystem.tools.json:5 [server=filesystem tool=read_file]
tool `read_file` is also exposed by server `weather`; one may shadow the other
evidence: filesystem/read_file vs weather/read_file
MEDIUM MCP009 tool-name-collision examples/weather.tools.json:16 [server=weather tool=read_file]
tool `read_file` is also exposed by server `filesystem`; one may shadow the other
evidence: weather/read_file vs filesystem/read_file
11 finding(s) (6 high, 5 medium); scanned 1 config file(s), 5 server(s), 4 tool(s), 0 source file(s)
JSON output (--json) contains a summary and a findings array with
rule_id, rule_name, severity, message, evidence and location
(path, line, server, tool).
GitHub code scanning
name: mcpwarden
on: [push, pull_request]
permissions:
contents: read
security-events: write
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo install --locked --git https://github.com/reflex-hs/mcpwarden
- run: mcpwarden scan . --sarif -o mcpwarden.sarif --fail-on none
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: mcpwarden.sarif
Limitations
- Static only: it sees what is written in configs and the metadata you hand it. A server can advertise different tools at runtime than in a saved dump.
- Secret detection is pattern-based. Values containing words like
exampleoryourare treated as placeholders and skipped. - Package pinning checks the launch command only; it does not look at lockfiles, transitive dependencies or registry metadata.
- Source heuristics are per file and per line; multi-file data flow, framework
wrappers and custom helpers are not followed. Directory scans skip
node_modules, build output, virtualenvs and test code (tests/,test/,__tests__/,*.test.*,*.spec.*,test_*.py), and MCP103 ignores.tsx/.jsxfiles because browser-side requests are not SSRF. Pass a test file directly to scan it anyway. - No suppression comments yet; use
--ignoreand--min-severity.
Development
cargo fmt --all --check
cargo clippy --all-targets -- -D warnings
cargo test
Fixtures for every rule live in tests/fixtures/.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Metadata
Release files for hwntools-mcpwarden 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hwntools_mcpwarden-0.1.0.tar.gz | 68.2 kB | With provenance | Details for hwntools_mcpwarden-0.1.0.tar.gz |
Built distributions (wheels)
Total release size: 7.9 MB
Release files / hwntools_mcpwarden-0.1.0.tar.gz
| Download URL | hwntools_mcpwarden-0.1.0.tar.gz |
|---|---|
| Size | 68.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc13cf1b209428f24b26f7de5e9611fcf202db887be7afba827b2a25fdd8bf7f
|
|
BLAKE2b-256 checksum How to use checksums |
9fd89a35326d8a9870c662b78a7017c58c90e1e8fe8a23b3d23d645289eb9240
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-win_amd64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-win_amd64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0a49afbfe74d821dc2b417a580b66649b964352c7899f4eb4258a7e33a998410
|
|
BLAKE2b-256 checksum How to use checksums |
3e20852e888d2ba87630871413e8f11fe8ef66d2b5c16192979b4c4eabfcd6f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-musllinux_1_2_x86_64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
d9b512090da438ec50494b1daecc5d8bb26d372b3e74cc1647093233bd83782f
|
|
BLAKE2b-256 checksum How to use checksums |
d8b2e5afa6061dd7a8398e9d23bf4a71ea9ab063f29e285efe64f044e100dfea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-musllinux_1_2_aarch64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
19bca093d1698b6e897ad609829cd3d0ae21d7b0bcc8fb45e36b05d6045b98f4
|
|
BLAKE2b-256 checksum How to use checksums |
50ae0583eee72f6151bdfdc6a584f162672de71549cfca9394bba68dc1b3f5fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
773c7c16b2ea496bc492875b4f106217b9d347cc5d943b50bcc2a8b85bce9fef
|
|
BLAKE2b-256 checksum How to use checksums |
a1b84cff61f701db1f6d908f1dcf0636e98572cf90c1d8a31bfa29c690d810a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Linux glibc 2.17+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
13b0ba913e4f6dbef2d07172bb8de59bc96e8cbf40c7e68ff35270e583dc84e8
|
|
BLAKE2b-256 checksum How to use checksums |
1d6170176458bf9f1d53a14fe94b36336e3b809ba46d1fb31b88d54e433d8a21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-macosx_11_0_arm64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8c6937869f3ccba3062c0992583421d3bfed154918a18a0770b8aeeb8d1031c4
|
|
BLAKE2b-256 checksum How to use checksums |
03c47ee352534938bfbbfd072a5d0f8bebfa1d46d37ee2c73d5e8825259e9e85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logRelease files / hwntools_mcpwarden-0.1.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | hwntools_mcpwarden-0.1.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
ca5e40101870a3175afd8164483aae94bda9509fb57da1b06f6fe752e77c6fdc
|
|
BLAKE2b-256 checksum How to use checksums |
8c254f6615f74dffa87ddbc5ebfec7b46383f895852302bdf272aa2a76530ebf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logSecurity for hwntools-mcpwarden 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 8 files in this release have been uploaded with provenance metadata.
Attestation for hwntools_mcpwarden-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.