Skip to main content

Model Context Protocol server for pyobfus — the Python obfuscator. Lets Claude Desktop, Claude Code, Cursor, Windsurf, and Zed call pyobfus tools (preflight risk check, zero-config init, reverse stack-trace mapping) directly from an agent conversation.

Project description

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

All tools return dicts with a status field and an ai_hint field suggesting the next action.

Install

pip install pyobfus-mcp

This pulls pyobfus and the MCP Python SDK automatically.

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…

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

Project details


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.1.1.tar.gz (10.2 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.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyobfus_mcp-0.1.1.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyobfus_mcp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cb08a862eb896695c1df1ff2606682d483f70d32ca4d5b074341a9e79d56ac77
MD5 13069252042b792bb3c54a169904133d
BLAKE2b-256 5d55e07177fb25e28a9d2e7361464ea39e5f9e55e726e9535be8b6e95ca33443

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyobfus_mcp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyobfus_mcp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a07a4b6a217f43d674f9be0d6295cfe4eab8cc74a5c6ad47ff8bc52efabbf4e9
MD5 7497c921f2f1b7f21860983380afcad8
BLAKE2b-256 31c45ba839a7b2d40f32e3a15543c030e4cbe9c0de667ec666c151efacd66095

See more details on using hashes here.

Supported by

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