mcp-lint
A lightweight, zero-dependency static security and hygiene linter for Model Context Protocol (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, and claude_desktop_config.json) configurations.
Quick Demo
Run mcp-lint against any MCP config (or run with no arguments to auto-discover local configs):
$ mcp-lint mcp.json SKILL.md
mcp.json: [MEDIUM] MCP002 (unsafe-fs): Unpinned package '@modelcontextprotocol/server-filesystem' via npx; pin a specific version.
mcp.json: [CRITICAL] MCP003 (unsafe-fs): Possible hardcoded API token or secret detected in server config.
mcp.json: [HIGH] MCP004 (unsafe-fs): Overly broad filesystem path '/' exposed to MCP server.
mcp.json: [HIGH] MCP005 (unsafe-remote): Unencrypted remote endpoint 'http://example.com'; use https:// instead.
mcp.json: [HIGH] MCP006 (injected-server): Suspicious prompt-injection or instruction-override phrase detected in config.
mcp.json: [CRITICAL] MCP007 (injected-server): Privileged execution detected via 'sudo'; run MCP servers with least privilege.
SKILL.md: [CRITICAL] MCP008 (skill:deploy): Untrusted remote script piped directly to shell in SKILL.md.
$ mcp-lint --dry-run .mcp.json
[dry-run] .mcp.json: filesystem: pinned '@modelcontextprotocol/server-filesystem' -> '@modelcontextprotocol/server-filesystem@2026.1.0'
Features
- MCP001: Flags direct raw shell invocations (
bash,sh,zsh,pwsh,powershell,cmd). - MCP002: Warns on unpinned
npxanduvxpackage executions (including scoped packages without version pins). - MCP003: Detects hardcoded API keys and bearer tokens in
envorargs. - MCP004: Flags overly broad filesystem mounts (
/,C:\,~,/Users,/home,C:\Users). - MCP005: Flags unencrypted remote
http://MCP URLs (excludinglocalhost/127.0.0.1) and disabled TLS verification flags. - MCP006: Detects suspicious prompt-injection or instruction-override phrases in server descriptions, arguments, or environment variables.
- MCP007: Flags privileged or root-level command execution (
sudo,runas,docker run --privileged). - Auto-Discovery: Automatically finds and scans local project and user MCP configuration files when run with no arguments.
- SARIF 2.1.0 Output: Exports findings in SARIF format (
--format sarif) for native GitHub Code Scanning and PR annotations. - Pre-commit Support: Ships with
.pre-commit-hooks.yamlto catch insecure MCP configs before they are committed.
Cross-Platform Support
mcp-lint runs natively on Windows, macOS, and Linux with zero external dependencies:
- Windows-Aware Paths & Shells: Flags Windows root mounts (
C:\,C:\Users), privilegedrunasusage, and rawpwsh/powershell/cmdinvocations. - Auto-Discovery Across OSes: Automatically locates
%APPDATA%\Claude\claude_desktop_config.jsonon Windows,~/Library/Application Support/Claude/claude_desktop_config.jsonon macOS, and~/.config/Claude/claude_desktop_config.jsonon Linux. - UTF-8 BOM Resilient: Cleanly parses JSON files saved with a UTF-8 Byte Order Mark by PowerShell or Windows editors.
Installation
# Run directly without installing
uvx --from mcp-guard-lint mcp-lint
# Or install via pip
pip install mcp-guard-lint
Usage
# Auto-discover project and user MCP configs (.mcp.json, .cursor/mcp.json, .vscode/mcp.json, Claude Desktop)
mcp-lint
# Auto-discover only configs inside the current project directory
mcp-lint --no-user-configs
# Scan one or more specific configuration files
mcp-lint path/to/.mcp.json .cursor/mcp.json
# Export SARIF 2.1.0 output for GitHub Code Scanning
mcp-lint --format sarif --output mcp-lint.sarif
# Scan Claude Desktop's config on Windows PowerShell
mcp-lint "$env:APPDATA\Claude\claude_desktop_config.json"
Example Output
.mcp.json: [CRITICAL] MCP003 (unsafe-fs): Possible hardcoded API token or secret detected in server config.
.mcp.json: [MEDIUM] MCP002 (unsafe-fs): Unpinned package '@modelcontextprotocol/server-filesystem' via npx; pin a specific version.
.mcp.json: [HIGH] MCP004 (unsafe-fs): Overly broad filesystem path '/' exposed to MCP server.
GitHub Actions Code Scanning (SARIF)
Add a workflow (e.g., .github/workflows/mcp-security.yml) to surface MCP security findings directly in your repository's Security Code scanning tab:
name: MCP Config Security Scan
on: [push, pull_request]
jobs:
mcp-lint:
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install mcp-guard-lint
id: lint
- run: mcp-lint --no-user-configs --format sarif --output mcp-lint.sarif
continue-on-error: true
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: mcp-lint.sarif
- name: Fail if findings detected
if: steps.lint.outcome == 'failure'
run: exit 1
Pre-commit Hook
Add mcp-lint to your .pre-commit-config.yaml to block unpinned packages, broad mounts, or hardcoded secrets before they are committed:
repos:
- repo: https://github.com/Staggerlee60/mcp-lint
rev: v0.4.0
hooks:
- id: mcp-lint
Running Tests
pytest -v
License
MIT
Metadata
Release files for mcp-guard-lint 0.4.1
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 |
|---|---|---|---|---|
| mcp_guard_lint-0.4.1.tar.gz | 11.2 kB | With provenance | Details for mcp_guard_lint-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_guard_lint-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for mcp_guard_lint-0.4.1-py3-none-any.whl |
Total release size: 23.1 kB
Release files / mcp_guard_lint-0.4.1.tar.gz
| Download URL | mcp_guard_lint-0.4.1.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0832ae4b55b740d569da9cca32686cf1a8e82a46c8efe071450670b4c6e307c2
|
|
BLAKE2b-256 checksum How to use checksums |
57e6abca7fe367ab603defdfc82a64f95119f09e5d373662e53400cfa3dc252d
|
| 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 Nov 28, 2026.
Transparency logRelease files / mcp_guard_lint-0.4.1-py3-none-any.whl
| Download URL | mcp_guard_lint-0.4.1-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e4f8951cfabfd7919f88790cd6b2b5d93f30629f951023ad6724b027a059d70
|
|
BLAKE2b-256 checksum How to use checksums |
0715b48e67e596d500518c5e829b0a4ac0c2ed0b44b8910c61825c08c6e1d098
|
| 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 Nov 28, 2026.
Transparency logSecurity for mcp-guard-lint 0.4.1
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
Both files in this release have been uploaded with provenance metadata.
Attestation for mcp_guard_lint-0.4.1.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 Nov 28, 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.