Skip to main content

mcpcheck-py

Python License: MIT

A linter for MCP (Model Context Protocol) config files. Works on every client that reads mcp.json / .mcp.json / claude_desktop_config.json / Zed's context_servers: Claude Desktop, Claude Code, Cursor, Cline, Windsurf, Zed.

Stdlib-only Python port of @mukundakatta/mcpcheck. Catches hardcoded secrets, dangerous commands, missing transports, malformed env blocks, plaintext HTTP with tokens, and shell-metachar injection.

Note: there's a separate package called mcp-config-check on PyPI by a different author. This package is the user's own port and uses the -py suffix to disambiguate.

Install

pip install mcpcheck-py

Usage

from mcpcheck import lint

result = lint("/path/to/mcp.json")

result.fatal           # True if the file failed to parse
for issue in result.issues:
    print(issue.line, issue.severity, issue.rule_id, issue.message)

You can also lint in-memory configs:

from mcpcheck import lint_source

source = '''
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "ghp_abcdef1234567890abcdef1234567890" }
    }
  }
}
'''
result = lint_source(source, file="<inline>")

Result shape

@dataclass
class Issue:
    rule_id: str
    severity: str           # "error" | "warning" | "info"
    message: str
    json_path: str          # dotted path, e.g. "mcpServers.github.env.GITHUB_TOKEN"
    line: int = 1

@dataclass
class LintResult:
    file: str
    fatal: bool
    issues: list[Issue]

Rules

Rule id Severity Checks
invalid-json error File doesn't parse as JSON / JSONC.
empty-servers warning No mcpServers / servers / context_servers key, or empty.
duplicate-server-name warning Two servers share a case-insensitive name.
unknown-field info Server has a field outside the known set.
missing-transport warning Server has neither command (stdio) nor url (sse / streamable-http).
dangerous-command error sudo, curl | sh, docker --privileged, host-root mounts, rm -rf /.
hardcoded-secret error Provider-shaped key (OpenAI, Anthropic, GitHub, AWS, Slack, etc.) in env values.
plaintext-http-with-token warning http:// URL combined with a bearer/auth header.
invalid-env-var-name warning env key doesn't match ^[A-Z_][A-Z0-9_]*$.
empty-env-value warning env value is empty or whitespace.

Supported clients

mcpcheck.CLIENT_PATHS exposes the same path table the JS sibling uses, so you can build editor / CI integrations that auto-discover configs:

  • cursor -- ~/.cursor/mcp.json
  • claude-desktop -- ~/Library/Application Support/Claude/claude_desktop_config.json, ...
  • claude-code -- ~/.claude.json, **/.mcp.json
  • windsurf -- ~/.codeium/windsurf/mcp_config.json
  • zed -- ~/.config/zed/settings.json
  • cline -- **/.cline/mcp.json, **/cline_mcp_settings.json

API differences from the JS sibling

  • Stdlib only -- JSONC (comments + trailing commas) handled by a small hand-rolled tolerant scanner instead of jsonc-parser. Strict JSON files go through json.loads directly.
  • Returns a LintResult dataclass instead of the JS object literal.
  • Spec entrypoint is lint(config_path) -- mirror of the spec's lint(config_path) -> LintResult. lint_source covers the in-memory case.
  • Fewer rules than the full JS sibling -- the Python port focuses on the high-signal subset (secrets, dangerous commands, structure). Run the JS CLI for the full surface.

See the JS sibling's README for the broader rationale.

Metadata

Release files for mcpcheck-py 0.1.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 mcpcheck-py 0.1.0
File Size Uploaded Provenance Actions
mcpcheck_py-0.1.0.tar.gz 12.0 kB Without provenance Details for mcpcheck_py-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcpcheck-py 0.1.0
File Interpreter ABI Platform Actions
mcpcheck_py-0.1.0-py3-none-any.whl Python 3 none any Details for mcpcheck_py-0.1.0-py3-none-any.whl

Total release size: 24.5 kB

Release files / mcpcheck_py-0.1.0.tar.gz

Download URL mcpcheck_py-0.1.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0a8630205a4aa778f28e314deaadaa981235c6a551a4f7673ffd65c31af72b6c
BLAKE2b-256 checksum
How to use checksums
9102f18d585be279d69e91423b6e98eb9d2ca4e807e001d837a0e1adfaa601e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / mcpcheck_py-0.1.0-py3-none-any.whl

Download URL mcpcheck_py-0.1.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dd711eadc55f0af5771793bee20195c67ee68274c32895837b33f5864b111a5a
BLAKE2b-256 checksum
How to use checksums
09437c8d3580fd1c05e5126cc6fe2058ed24a2df4fbbb318e205be37ccc6064e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for mcpcheck-py 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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