Skip to main content

pyobfus-mcp — Model Context Protocol server for pyobfus

pyobfus-mcp exposes pyobfus — the Python obfuscator — to any MCP-capable AI coding agent: Claude Desktop, Claude Code, Cursor, Windsurf, Zed, Codex, and anything else that speaks the Model Context Protocol.

Once configured, you can say:

"Check if this FastAPI project is safe to obfuscate, then generate a pyobfus.yaml for it."

and the agent will autonomously call check_obfuscation_risks and generate_pyobfus_config — no copy/paste of CLI commands, no manual config editing.

Tools exposed

Tool What it does
protect_project(path, output_dir?, preset?, verify?, verify_cmd?, save_mapping?) One-call, self-verifying pipeline. Scans risks, picks a framework-aware preset, obfuscates, then byte-compiles and import-smoke-tests the output in isolated subprocesses and returns verified: true/false (+ confidence). Writes a private de-obfuscation mapping alongside (never inside) the output. Reach for this when the user wants to "protect/obfuscate before shipping" and expects a green check, not just a transform.
check_obfuscation_risks(path) Pre-flight scan for eval/exec, dynamic attribute access, framework reflection. Returns severity counts, detected frameworks, and a suggested preset.
generate_pyobfus_config(path, preset_override?, write?) Auto-detect framework → generate pyobfus.yaml. Returns the YAML text without writing by default; write=True persists to disk.
unmap_stack_trace(trace, mapping_path) Reverse obfuscated identifiers in a production stack trace using a mapping.json.
list_presets() Enumerate every preset (community / framework-aware / Pro).
explain_preset(name) Describe what a named preset changes: exclusions, docstring handling, parameter preservation.
recommend_tier(path) Analyze a project and recommend community vs Pro, with reasoning and concrete next-step commands.
start_pro_trial() Return structured guidance for starting the 5-day Pro trial.

All tools return dicts with a status field, a free-text ai_hint, and a machine-readable next_tool field ({tool, reason, args}) so an agent can chain steps deterministically. verify_cmd in protect_project runs an arbitrary command and is therefore opt-in behind PYOBFUS_MCP_ALLOW_VERIFY_CMD=1.

Install

Zero-install (recommended)

If you have uv, no separate install step is needed — point your client at uvx and it fetches pyobfus-mcp (plus pyobfus and the MCP SDK) into an ephemeral environment on first run. No API key required.

{
  "mcpServers": {
    "pyobfus": {
      "command": "uvx",
      "args": ["pyobfus-mcp"]
    }
  }
}

Or install with pip

pip install pyobfus-mcp

This pulls pyobfus and the MCP Python SDK automatically. Then use "command": "pyobfus-mcp" in the per-client configs below.

Configure

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "pyobfus": {
      "command": "pyobfus-mcp"
    }
  }
}

Restart Claude Desktop. The pyobfus tools appear in the tool list.

Cursor

Edit ~/.cursor/mcp.json:

{
  "mcpServers": {
    "pyobfus": {
      "command": "pyobfus-mcp"
    }
  }
}

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "pyobfus": {
      "command": "pyobfus-mcp"
    }
  }
}

Zed

In ~/.config/zed/settings.json:

{
  "context_servers": {
    "pyobfus": {
      "command": {
        "path": "pyobfus-mcp",
        "args": []
      }
    }
  }
}

Claude Code

claude mcp add pyobfus pyobfus-mcp

Example session

User:  Can you check whether this Python project is safe to obfuscate?
       Path: /Users/me/code/my-api

Agent: [invokes check_obfuscation_risks("/Users/me/code/my-api")]
       I found 2 high-severity and 3 medium-severity patterns. FastAPI is
       detected, so I'd suggest the `fastapi` preset. Want me to generate
       the config?

User:  Yes please, write it.

Agent: [invokes generate_pyobfus_config("/Users/me/code/my-api",
         preset_override="fastapi", write=True)]
       Wrote pyobfus.yaml. Next: pyobfus /Users/me/code/my-api -o dist/
       -c pyobfus.yaml

Debugging obfuscated code with your AI assistant

The killer feature: keep AI-assisted debugging even after you obfuscate.

User:  Here's a crash from prod. Can you help?
       [pastes traceback full of I0, I1, I2...]

Agent: [invokes unmap_stack_trace(trace, "path/to/mapping.json")]
       Reversed. The crash is in Calculator.add() called from
       main() — 'Calculator' object has no attribute 'add_x'. Looks like
       a typo in the method call site…

Verifying tool integrity

Tool poisoning / "rug-pulls" — a server's tool descriptions silently changing after you've reviewed and trusted them — are the #1 threat in the 2026 MCP security baseline. pyobfus-mcp-verify checks the currently-installed package's tool descriptions/schemas against a manifest frozen at release time:

pyobfus-mcp-verify
# OK: tool descriptions match the shipped manifest (digest 5cf4c902d460...).

A mismatch (exit code 1) means the installed tools differ from what the release shipped — worth investigating before trusting the server. This is a self-consistency digest, not a cryptographic signature: it proves the package matches its own shipped manifest, not that a specific party signed it. For stronger assurance, compare the printed digest against the one published in the GitHub Release notes for the version you installed.

License

Apache-2.0. Same as the main pyobfus package. The pyobfus Pro features remain license-gated; this MCP server only wraps the community-tier tools.

Links

Download files

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

Source Distribution

pyobfus_mcp-0.3.6.tar.gz (48.1 kB view details)

Uploaded Source

Built Distribution

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

pyobfus_mcp-0.3.6-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file pyobfus_mcp-0.3.6.tar.gz.

File metadata

  • Download URL: pyobfus_mcp-0.3.6.tar.gz
  • Upload date:
  • Size: 48.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyobfus_mcp-0.3.6.tar.gz
Algorithm Hash digest
SHA256 f0d802cc1ccfc13f4c17a04aca33f4ff801f9cc1cef79a30ead1f80cee20ce4a
MD5 e840ee2e78bdd441aec825e6c3b709f7
BLAKE2b-256 eea49d8680297a13e8f583307cf3121835ae3aaec1ab3dc6534ecc13e6cf7db3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyobfus_mcp-0.3.6.tar.gz:

Publisher: release.yml on zhurong2020/pyobfus

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

File details

Details for the file pyobfus_mcp-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: pyobfus_mcp-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyobfus_mcp-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1cfd8ecf346277e9620168478899e03280f8ee2f56f1a2d0b084af6fcbcdba23
MD5 fff42f5aa598dd37754d097c3b367cda
BLAKE2b-256 d0e3fc0f45c314b825c5ee0f5665b8d510dd1297ff927d9828ea943dc50a94f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyobfus_mcp-0.3.6-py3-none-any.whl:

Publisher: release.yml on zhurong2020/pyobfus

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

2 files

This release

0.3.6 This release

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page