pyobfus-mcp

io.github.zhurong2020由 GitHub 帳號 zhurong2020 發布v0.3.17更新於 Oct 30, 2026

9 local Python protection tools, delivery checks and traceback reverse mapping. No telemetry.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

本機 MCP 伺服器,讓 AI 程式助理以 pyobfus 掃描、混淆並驗證 Python 專案,檢查交付產物,並還原混淆後的堆疊追蹤。

可以做什麼
  • 掃描 Python 專案中的混淆風險、辨識框架並提出建議預設集
  • 產生 pyobfus.yaml 設定,或以單次呼叫完成混淆、位元組編譯與匯入冒煙測試
  • 列出並說明各預設集,建議社群版或 Pro 版本並附上下一步指令
  • 出貨前檢查輸出目錄或 wheel 是否夾帶對照檔、私鑰或原始原始碼
  • 利用已儲存的對照檔還原堆疊追蹤中的混淆識別字
  • 回傳啟動 Pro 試用的結構化指引
適用情境
適合要發布 Python 程式、希望由助理準備並執行混淆、確認受保護的建置仍可匯入,並透過還原正式環境堆疊持續除錯的情境。也適合在出貨前確認交付產物沒有外洩對照檔或金鑰。
執行需求
以 PyPI 套件 pyobfus-mcp 透過 stdio 在本機執行,可用 uvx 免安裝啟動或以 pip 安裝,會一併取得 pyobfus 與 MCP Python SDK。不需要 API 金鑰或環境變數。預設不連外網,僅在主動開啟相依性驗證時才連線。交付檢查需要 pyobfus 0.7.1 以上版本。
安裝前請注意
protect_project 會寫出混淆產物,並在產物旁(而非其中)寫入私有的反混淆對照檔;generate_pyobfus_config 僅在 write 為真時寫入 pyobfus.yaml。verify_cmd 會執行任意指令,須以 PYOBFUS_MCP_ALLOW_VERIFY_CMD 開啟。試用工具只回傳指引,不會啟動試用或購買;Pro 預設集會提到結帳連結與價格。verified 僅代表編譯與匯入冒煙測試通過,不代表應用行為已被測試。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 pyobfus-mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

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, GitHub Copilot, Windsurf, Zed, Codex, CodeBuddy, 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

Version 0.3.17 exposes 9 tools: 7 Community tools and 2 tier/trial guidance tools.

ToolWhat 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). verified covers compilation and an import smoke test, plus verify_cmd if you pass one; it does not mean your application's behaviour was tested. 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, verify_dependencies_online=false, use_project_config=true)Config-aware pre-flight scan for eval/exec, dynamic attribute access, and framework reflection. Set use_project_config=false for the legacy config-free scan. Opt into public-PyPI dependency-name verification with verify_dependencies_online=true; outbound network access remains off by default. 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.
check_delivery(path, build_report?, provenance_manifest?)Before shipping, check an output directory or .whl for a mapping file, a private key or an original source, and for files the build did not produce. Read-only; requires pyobfus >=0.7.1; older Core returns FeatureUnavailable.
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.

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

Or install with pip

bash
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):

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

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

Cursor

Edit ~/.cursor/mcp.json:

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

Windsurf

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

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

Zed

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

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

Claude Code

bash
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:

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

Independent security scan

The published PyPI package (not a local build) has been scanned with Cisco's open-source mcp-scanner — a live initialize → tools/list handshake followed by YARA malware-signature and dependency-vulnerability analysis against the eight tools exposed at that time. Result as of pyobfus-mcp 0.3.6 (2026-08-20): 8/8 tools SAFE, 0 findings. Full reproducible command, raw output, and an honest statement of what this scan does and doesn't cover: docs/MCP_SECURITY_SCAN.md.

License

Apache-2.0. Same as the main pyobfus package. The server exposes Community tools and tier/trial guidance; Pro build features remain licence-gated.

Links

來源:pyobfus_mcp/README.md,提交 ed5b28c

工具

9

protect_project

One call to protect a Python project end-to-end AND verify it still works: scans risks, picks a framework-aware preset, obfuscates, then byte-compiles + import-smoke-tests the output in isolated subprocesses and returns verified:true/false. Writes a private de-obfuscation mapping alongside (not inside) the output. Use this when the user wants to 'protect/obfuscate before shipping' and expects a green check, not just a transform.

輸入參數path必填presetverifytimeoutoutput_dirverify_cmdsave_mappingtrace_marker

check_obfuscation_risks

Scan a Python project for patterns that may break obfuscation (eval/exec, dynamic attribute access, framework reflection, unsafe model loading). Returns severity counts, detected frameworks (FastAPI/Django/Flask/Pydantic/Click/SQLAlchemy/ML), and a suggested preset. Also locates requirements*.txt / pyproject.toml and, only if verify_dependencies_online=true, checks each declared dependency against public PyPI to flag AI-hallucinated ('slopsquatting') package names -- off by default, this tool makes no outbound network calls unless you opt in. By default the scan honors the project's pyobfus config; set use_project_config=false for the legacy config-free scan.

輸入參數path必填use_project_configverify_dependencies_online

generate_pyobfus_config

Generate a pyobfus.yaml for a Python project. Auto-detects frameworks and applies the matching preset. By default returns the YAML text without writing to disk; set write=true to persist.

輸入參數path必填writepreset_override

unmap_stack_trace

Reverse obfuscated identifiers in a stack trace using a pyobfus mapping.json. Accepts the trace as plain text and the path to a mapping file produced by --save-mapping.

輸入參數trace必填mapping_path必填

check_delivery

Check an output directory or .whl right before shipping: fails on a pyobfus mapping file, a private key or an original source file inside it, and warns about Python files the build did not produce or Pro options the build skipped. Pass the build's --build-report and --provenance-manifest JSON for the full check. Read-only: files are hashed, never imported or executed, and contents are not returned.

輸入參數path必填build_reportprovenance_manifest

list_presets

List every pyobfus preset available, grouped by tier (community / framework-aware / Pro).

無需輸入參數。

explain_preset

Describe what a named preset changes: exclude names count, exclude patterns, preserve_param_names, docstring handling. For Pro presets, returns full pro_unlock metadata (trial command, checkout URL, price, money-back guarantee).

輸入參數name必填

recommend_tier

Analyze a Python project and recommend pyobfus tier (community vs Pro) with reasons. Combines a preflight scan with a sensitive-string-literal heuristic. Returns free_action and pro_action with concrete next-step commands.

輸入參數path必填

start_pro_trial

Return structured guidance for starting the 5-day pyobfus Pro trial. Does NOT invoke the side effect — the user runs `pyobfus-trial start` in their shell. Detects whether a trial is already active and surfaces the appropriate next step plus post-trial purchase URL.

無需輸入參數。

版本歷史

6
  1. v0.3.17最新Oct 30, 2026
  2. v0.3.16Oct 26, 2026
  3. v0.3.15Oct 23, 2026
  4. v0.3.14Oct 20, 2026
  5. v0.3.13Oct 14, 2026
  6. v0.3.12Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分