Skip to main content

mcp-lint

CI PyPI Python 3.10+ License: MIT SARIF 2.1.0 Platform: Windows | macOS | Linux

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

image

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 npx and uvx package executions (including scoped packages without version pins).
  • MCP003: Detects hardcoded API keys and bearer tokens in env or args.
  • MCP004: Flags overly broad filesystem mounts (/, C:\, ~, /Users, /home, C:\Users).
  • MCP005: Flags unencrypted remote http:// MCP URLs (excluding localhost / 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.yaml to 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), privileged runas usage, and raw pwsh / powershell / cmd invocations.
  • Auto-Discovery Across OSes: Automatically locates %APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, and ~/.config/Claude/claude_desktop_config.json on 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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-guard-lint 0.4.0
File Size Uploaded Provenance Actions
mcp_guard_lint-0.4.0.tar.gz 11.2 kB With provenance Details for mcp_guard_lint-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-guard-lint 0.4.0
File Interpreter ABI Platform Actions
mcp_guard_lint-0.4.0-py3-none-any.whl Python 3 none any Details for mcp_guard_lint-0.4.0-py3-none-any.whl

Total release size: 23.1 kB

Release files / mcp_guard_lint-0.4.0.tar.gz

Download URL mcp_guard_lint-0.4.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
306eb1f22fd746abbfedc1c96d2567eaf7e0eb1529267db23242cbff2d97fa0d
BLAKE2b-256 checksum
How to use checksums
247de3f2a631a99540ab240c87b9051dccd60b3a1e720ca8cf1b21de4884e78f
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 log

Release files / mcp_guard_lint-0.4.0-py3-none-any.whl

Download URL mcp_guard_lint-0.4.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76effc139a527a6fa60f37f42b66ba00acf3c833fc0a07a1325a2e2b106959e8
BLAKE2b-256 checksum
How to use checksums
852c5f2be75367c00d7f888088eb1a8a6523d73a0726de807dce0762f18bb27e
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 log

Security for mcp-guard-lint 0.4.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcp_guard_lint-0.4.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 Nov 28, 2026.

Transparency log

A 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.

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