
pyobfus
by zhurong2020
pyobfus β the Python obfuscator
<p align="center"> <img src="https://raw.githubusercontent.com/zhurong2020/pyobfus/main/docs/assets/logo.jpeg" alt="pyobfus Logo" width="200"> </p>pyobfus (pronounced as "Python obfuscator") is a modern, AST-based python-obfuscator / code-obfuscator with framework-aware presets, reverse stack-trace mapping for AI-assisted debugging, and a machine-readable JSON CLI designed for Claude Code, Cursor, Codex, and MCP agents. A transparent, open-source alternative to PyArmor.
A Python code obfuscator built with AST-based transformations. Supports Python 3.9 through 3.14. Provides reliable name mangling, string encoding, control-flow flattening, AES-256 string encryption, and β unique to pyobfus β a reverse-mapping workflow that lets you (or your AI coding assistant) debug obfuscated stack traces without giving up the protection.
π§ What's new in v0.5.6 β Fixed a CLI bug where running any preset the normal, documented way (
--preset fastapi/django/flask/pydantic/click/sqlalchemy/ml/safe, no extra flags) could silently override the preset's own choices: parameter names got mangled despitepreserve_param_names=True, and docstrings got stripped despite--preset safe's core promise to keep them. Both now behave as documented. Full details in the CHANGELOG; see Pro Edition below.
π Companion MCP server: pyobfus-mcp
This repository ships two installable packages:
| Package | What it is | Install |
|---|---|---|
pyobfus | The Python obfuscator (CLI + library). | pip install pyobfus |
pyobfus-mcp | A Model Context Protocol (MCP) server that exposes pyobfus's tools to AI coding agents. | uvx pyobfus-mcp (zero-install) or pip install pyobfus-mcp |
The MCP server lives in pyobfus_mcp/ and is built on the official Model Context Protocol Python SDK (FastMCP). It registers eight MCP tools so Claude Desktop, Claude Code, Cursor, Windsurf, Zed, and Codex can call pyobfus directly from agent conversations β no shelling out:
| MCP tool | Implementation | Purpose |
|---|---|---|
protect_project | pyobfus_mcp/tools.py | One-call, self-verifying pipeline: scan β preset β obfuscate β byte-compile + import-smoke-test the output β return verified: true/false. The agent reports a green check instead of hoping the transform didn't break anything |
check_obfuscation_risks | pyobfus_mcp/tools.py | Pre-flight risk scan (eval/exec, dynamic attribute, framework reflection) |
generate_pyobfus_config | pyobfus_mcp/tools.py | Auto-det |
Related servers

n8n
Updated todayby n8n-io
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

mcp-server-fetch
OfficialUpdated todayA Model Context Protocol server providing tools to fetch and convert web content for usage by LLMs

@modelcontextprotocol/server-filesystem
OfficialUpdated todayMCP server for filesystem access