tarpit-guard MCP Server
Detects obfuscated "tarpit" code so AI agents stop before burning tokens on it.
tarpit-guard scores 71 (Good), licensed MIT and written in Python. It installs as a local process. It declares 1 tool. Filed under Uncategorized. GitHub shows 4 stars. Package registries report about 427 downloads a week. Install configs are generated for 12 clients. Being listed in the registry is not the same as being vendor-official.
Good trust
71 of 100 from six public signals. Nobody can buy a point.
- Listed in the official MCP registry.
- OSI-style license: mit.
License, quality and maintenance
Quality: Grade C
66/100 for listing completeness. Lost points: 1 of 1 tools barely described, short summary, no docs link.
How quality is graded
Where the 71 comes from
22 + 20 + 5 + 10 + 4 + 10 = 71. Each factor is capped, so no single signal can carry a listing.
Active in the official MCP registry, plus a known vendor namespace.
Registry: 22 of 30 points.How recently the repository saw a commit or release.
Maintenance: 20 of 20 points.GitHub stars and weekly downloads, on a log scale.
Popularity: 5 of 20 points.A clear, OSI-style open-source license.
License: 10 of 10 points.Not archived, a secure install path, a pinned version.
Security: 4 of 10 points.A real summary, a README with depth, listed tools.
Docs: 10 of 10 points.Install
Pick your client, copy the config, paste it in.
Needs Cursor or VS Code installed on this device. The button opens the app and asks you to confirm before it adds the server.
{ "mcpServers": { "maniram-1-tarpit-guard": { "command": "uvx", "args": [ "tarpit-guard" ] } }}
Environment variables
This server does not declare environment variables.
Tools1Tool docs quality grade F
All capabilitiesPyArmor
About
English | Español
A pre-flight guard for AI code-analysis agents. It scores a file or repository for signs of deliberate anti-analysis hardening, the obfuscation and "token-burning" tricks that tools like BLA apply to make AI reverse-engineering expensive, and tells an agent, before it spends a budget, whether a target is a tarpit and what to do instead.
One ~1K-token check that prevents a 60K-token mistake.
Tested on 219 real files: 132 of 132 obfuscated files caught, 0 of 87 normal libraries wrongly flagged. See how it compares.
Contributions welcome, especially real-world samples that widen the test corpus. See Contributing, or pick up a good first issue.
Table of contents
- The problem
- What this is, and what it is not
- How it works
- Signals
- Tool fingerprints
- Scoring and thresholds
- Install
- CLI usage
- Use in CI
- Use it in Claude
- MCP usage (for agents)
- Example output
- Project layout
- Limitations and false positives
- Roadmap
- FAQ
- Contributing
- Privacy Policy
- License
The problem
Source-hardening tools defend software by making it hostile to static analysis. A tiny, readable source file is transformed into a large, deliberately confusing one that still behaves identically:
| Original | Hardened | |
|---|---|---|
| Size | 418 B | 184 KB (~440x) |
| Lines | 15 | 2,998 |
| Secret string in cleartext | yes | no (encrypted) |
| Output when run | identical | identical |
The hardened file pads real logic with decoy functions, wraps branches behind opaque-predicate math, encrypts string literals behind runtime decoder loops, and plants jargon "canaries" written specifically to mislead a reading agent.
For an AI agent, the trap is cost. Read-and-trace the whole thing and you burn input tokens on ingestion and reasoning tokens on dead ends, and often still reach a wrong conclusion. The cheap counter is not to out-analyze the obfuscation. It is to detect the tarpit first and stop: don't read it, don't trace it, skip it or hand it to a human. A ~1K-token check replaces a 60K-token dead end.
tarpit-guard is that detection step.
What this is, and what it is not
It is a detector and triage guard. It answers one question: does this look deliberately hardened, and if so, what is the cheaper way in? It emits a score, the signals that fired, and a recommended strategy.
It is not a deobfuscator, a cracker, or a secret extractor. It never reverses anyone's protection or recovers hidden values. That is precisely the reverse-engineering these hardening tools exist to stop, and building it would make this project the thing it is meant to warn about. The line is deliberate and permanent: tarpit-guard reads shape, never meaning.
How it works
The engine is pure Python standard library. No dependencies, no network, nothing to install for the core. It runs entirely on local text.
- Repository sweep (directory mode): walk the tree, skipping
node_modules,.git,dist,build, and the like, and look for tool fingerprints. - Per-file analysis: for each candidate file, compute a set of cheap structural and statistical signals from the raw text. No execution, no parsing of untrusted code.
- Weighted score: combine the signals into a 0 to 100 score and a confidence derived from how many independent signals fired.
- Verdict: above the threshold, the file is a tarpit. The engine returns the evidence and a recommended strategy instead of a pile of extracted facts.
Because every signal is a count or ratio over text, the check is orders of magnitude cheaper than the analysis it protects.
Signals
Detection keys on signals that benign code, even heavily minified code, essentially never produces. This is deliberate. The hard problem is not spotting that a file is machine-generated (minified bundles are too). It is telling hostile obfuscation apart from ordinary minification. Size and line-length are explicitly not primary signals, because that is exactly what minification trips.
| Signal | Weight | What it catches |
|---|---|---|
opaque_predicate_density | 0.28 | Math.imul tautology chains that guard real branches behind always-true math (BLA) |
hex_identifier_array | 0.28 | dense _0x... string-array identifiers (javascript-obfuscator family) |
decoder_loops | 0.22 | fromCharCode + charCodeAt loops that reconstruct encrypted string literals at runtime (adds to the score only; text, zip and crypto libraries use these too) |
obfuscator_control_tricks | 0.12 | self-defending / control-flow tricks (!![], .split('|') dispatch) |
decoy_vocabulary_density | 0.06 | planted jargon clusters (enclave / attestation / TPM / canary) meant to mislead a reader |
garbled_identifier_ratio | 0.04 | mangled names such as encodeFrozenScopeV4ue7 |
On top of the weighted score, four categorical markers apply a decisive floor, because they are signatures essentially impossible in hand-written or merely-minified code: a dense _0x identifier array, booleans and undefined written as hex literals (!0x1, void 0x0, the js-confuser tell), Math.imul opaque-predicate chains, or repeated !![] self-defending tricks. Any one present pushes the file over the line. See benchmark/ for how these hold up on 92 real library files and 114 obfuscated ones.
PyArmor adds another categorical marker: pyarmor_bootstrap. It requires both a versioned pyarmor_runtime_* import of __pyarmor__ and the corresponding bytes-backed __pyarmor__ initialization call. This combination identifies the generated bootstrap structure rather than relying on a textual mention of PyArmor.
Conversely, a file dominated by 1 to 2 character identifiers (the minification tell, 60 to 70% in jQuery/Lodash builds versus about 10% in hostile files) with none of those markers is recognized as benign minification and capped low, with the strategy "read the original source or a source map, not the bundle."
The evidence block reports the raw counts (Math.imul, hex identifiers, decoder pairs, decoy hits, short-identifier ratio, and so on) so a human or agent can sanity-check why a file scored as it did.
Tool fingerprints
Some artifacts are near-certain evidence of deliberate hardening on their own, independent of file contents. Directory scans report them separately as a strong standalone signal:
| Fingerprint | Tool |
|---|---|
.bla-hardened/ directory | BLA |
.blarc | BLA |
bla-harden-summary.json | BLA |
pyarmor_runtime_[0-9a-fA-F]{6}/ directory | PyArmor |
pyarmor_runtime.pyd | PyArmor |
pytransform/ directory (legacy runtime) | PyArmor |
The fingerprint map is a plain table in detector.py and is meant to grow as more hardeners are catalogued.
Scoring and thresholds
- Score: 0 to 100, the weighted sum of signals.
- Confidence: rises with the number of independent signals that cross their own half-way mark. Four or more means full confidence.
- Threshold: default 55. At or above it,
hardenedis true. Tunable with--threshold(CLI) or thethresholdargument (MCP).
Evaluation
eval_corpus.py scores a labelled corpus (corpus/) of clean source, real minified bundles, and hostile obfuscation, and reports false positives and false negatives. It doubles as a regression test (non-zero exit on any miss).
v0.2 results (threshold 55):
| Bucket | File | Score | Verdict |
|---|---|---|---|
| clean | jquery.source.js / lodash.source.js | 0.0 | ok |
| clean | detector.py (contains the decoy word list) | 9.5 | ok |
| minified | jquery.min.js | 0.0 | ok |
| minified | lodash.min.js | 0.0 | ok |
| minified | pako.min.js (heavy fromCharCode use) | 22.0 | ok |
| obfuscated | bla_hardened_app.js | 78.0 | TARPIT |
| obfuscated | js-confuser_sample.js | 78.0 | TARPIT |
| obfuscated | js-obfuscator_sample.js | 85.0 | TARPIT |
| obfuscated | pyarmor_sample.py | 85.0 | TARPIT |
0 false positives, 0 false negatives. Highest benign score 22.0, lowest hostile score 78.0, a +56 margin. For a much larger test on real libraries, see benchmark/. (For contrast, v0.1 leaned on file size and scored minified jQuery above a real obfuscated file. That regression is what this corpus exists to prevent.)
How it compares
Both tools ran on the same 219 JavaScript files with default settings: 132 files made by three real obfuscators, and 87 normal files from popular npm libraries. Full method, caveats and a one-command rerun are in benchmark/.
Install
From PyPI:
pip install tarpit-guard # core CLI, standard library only
pip install "tarpit-guard[mcp]" # adds the FastMCP server (fastmcp>=2.0)
Or run it without installing (needs pipx):
pipx run tarpit-guard path/to/code
For development (from a clone):
git clone https://github.com/ManiraM-1/tarpit-guard.git
cd tarpit-guard
pip install -e ".[mcp]"
Requires Python 3.9+.
CLI usage
tarpit-guard path/to/file.js # score a single file
tarpit-guard path/to/repo # scan a tree + report fingerprints
tarpit-guard path/to/repo --quiet # only show flagged files
tarpit-guard path/to/repo --top 10 # only show the 10 highest-scoring files
tarpit-guard path/to/repo --json # machine-readable report
tarpit-guard path/to/repo --threshold 45
tarpit-guard --mcp # start the MCP server instead (needs the [mcp] extra)
python -m tarpit_guard.cli path/to/file.js # if the console script is not on PATH
See SCHEMA.md for the frozen --json and MCP output schema contract.
Exit codes make it a drop-in CI gate:
| Code | Meaning |
|---|---|
0 | nothing flagged |
1 | at least one tarpit found |
2 | path not found |
# e.g. fail a job if a dependency ships hardened artifacts
- run: tarpit-guard ./vendor --quiet
Use in CI
In normal (non-JSON) mode the CLI exits 1 when at least one file is flagged and 0 when none are, so it can gate a build directly. --quiet only changes the output — it prints flagged files — and does not change the exit code. --top N likewise only limits how many results are printed (applied after --quiet); the exit code still reflects every scanned file. --json always exits 0, so a JSON-mode job must parse the flagged count itself if it needs to fail the build.
Using the CLI
You can run Tarpit Guard directly in your GitHub Actions workflow using pipx:
name: tarpit-guard
on: [pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pipx run tarpit-guard . --quiet
Use as a GitHub Action
You can also use Tarpit Guard as a reusable GitHub Action. The action handles Python setup and package installation automatically:
name: Tarpit Guard
on: [pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ManiraM-1/tarpit-guard@main
with:
path: .
threshold: "55"
quiet: "true"
The action supports the following inputs:
| Input | Description | Default |
|---|---|---|
path | File or directory to scan | . |
threshold | Score threshold at which a file is flagged | 55 |
quiet | Only print files at or above the threshold. Accepts true or false | true |
version | Exact PyPI version of tarpit-guard to install. Empty installs the latest version | "" |
Use it in Claude
Claude Desktop (one click, nothing else to install). Download tarpit-guard-<version>.mcpb from the latest release and double-click it, or drag it into the Claude Desktop window. You can also open Settings > Extensions > Advanced settings > Install Extension... and pick the file. Claude Desktop sets up Python and the dependencies for you.
Claude Code. Install the plugin from this repository. It adds a tarpit-check skill that tells Claude to run the tarpit-guard CLI before reading suspicious code:
/plugin install tarpit-guard --marketplace ManiraM-1/tarpit-guard
The extension gives Claude the three MCP tools below; the plugin's skill runs the same checks through the CLI. Then ask, for example, "check vendor/app.min.js for a tarpit before you read it". To build the extension yourself, run mcpb/build.sh (needs Node.js and Python 3.11+).
MCP usage (for agents)
Install with the MCP extra, then run the server over stdio:
pip install "tarpit-guard[mcp]"
tarpit-guard-mcp # or: tarpit-guard --mcp, or: python -m tarpit_guard.mcp_server
To add it to an MCP client such as Claude Desktop, Cursor or VS Code, use this config. It needs uv, and nothing has to be installed first:
{
"mcpServers": {
"tarpit-guard": {
"command": "uvx",
"args": ["--from", "tarpit-guard[mcp]", "tarpit-guard-mcp"]
}
}
}
Or run it in Docker, mounting the code to check read-only:
docker build -t tarpit-guard .
docker run -i --rm -v "$PWD:/work:ro" tarpit-guard
It exposes three read-only tools:
| Tool | Use |
|---|---|
check_file(path) | score one file before reading it |
check_source(text, label) | score a raw snippet without touching disk |
scan_repo(root, threshold) | sweep a tree for fingerprints and tarpit files |
The intended agent loop:
encounter unfamiliar file
|
v
check_file(path)
|
hardened? --no--> analyze normally
|
yes
|
v
stop: don't read or trace it,
skip the file, or flag it
for a human
The guard turns "read everything and hope" into a deliberate, budgeted decision.
Example output
$ tarpit-guard ./BLA
Tool fingerprints found (strong signal of deliberate hardening):
[bla] dir: ./BLA/.bla-hardened
[bla] file: ./BLA/.blarc
[bla] file: ./BLA/.bla-hardened/bla-harden-summary.json
[TARPIT] score= 78 conf=1.00 ./BLA/.bla-hardened/app.js
182865B / 2998 lines, Math.imul x246, decoder_pairs=8, garbled_idents=190, decoy_hits=487
fired: opaque_predicate_density, decoder_loops, decoy_vocabulary_density
-> Treat as a tarpit. Stop here: do not read, trace, or try to deobfuscate
this file. Skip it and move on, or flag it for a human.
[ok] score= 0.0 conf=0.00 ./BLA/app.js
Project layout
tarpit-guard/
|- pyproject.toml
|- README.md
|- LICENSE
|- .gitignore
|- eval_corpus.py # scores corpus/, reports false positives/negatives
|- corpus/ # labelled samples: clean / minified / obfuscated
|- tarpit_guard/
|- __init__.py # public API: analyze_file, analyze_text, repo_fingerprints
|- detector.py # scoring engine (stdlib only)
|- cli.py # command-line entry point
|- mcp_server.py # FastMCP wrapper
|- mcpb/ # Claude Desktop extension: manifest, icon, build.sh
|- plugin/ # Claude plugin: tarpit-check skill (Markdown only)
Limitations and false positives
This is a v0.2 heuristic, and honesty about its edges matters more than a clean pitch:
- Tested, but on a finite set. The benchmark covers 92 real library files and 114 obfuscated files from four tools (BLA, javascript-obfuscator, js-confuser, PyArmor), with no false alarms and no misses at the default threshold. Two of the rules were tuned while building that benchmark, so treat it as strong evidence rather than proof. Obfuscators it has never seen may still slip through, and new false alarms are welcome as issues.
- Minified vs hardened is handled, not solved. v0.2 correctly passes minified jQuery and Lodash while flagging both obfuscators, using short-identifier dominance plus categorical markers. An exotic bundler or a deliberately minification-mimicking obfuscator could still fool it, which is what growing the corpus guards against.
- Static only. It reads the file as text. It does not and should not execute anything it scans.
- Thresholds are empirical. 55 is the default, with a margin from about 22 (the highest normal file, pako.min.js) to 78 (the lowest obfuscated file) on the current corpus, but it is tuned, not derived. Expect to revisit it per language and per codebase.
Roadmap
- False-positive corpus: normal + minified + obfuscated samples to calibrate against (
corpus/,eval_corpus.py). - Detect a second hardener family (javascript-obfuscator) alongside BLA.
- Separate hostile obfuscation from ordinary minification.
- More tool fingerprints (webpack/terser signatures, obfuscator.io variants).
- Grow the corpus (more real bundles, more obfuscators) and pin thresholds against it.
- Per-language signal profiles (JS/TS vs Python vs WASM-glue).
FAQ
Does this crack or defeat BLA? No. It detects that hardening is present and recommends a cheaper strategy. It never reverses the protection or extracts secrets.
Is "burning all the AI's tokens" real? Partly. Hardening genuinely raises the cost of static analysis and genuinely hides string secrets. It does not always exhaust a budget, but it reliably wastes one: an agent that reads and traces a hardened file spends heavily and often still reaches the wrong conclusion. tarpit-guard exists so the agent notices early and stops instead.
Why stdlib-only for the core? Portability and auditability. The thing that inspects untrusted code should itself be tiny, dependency-free, and easy to read.
Contributing
Contributions are very welcome. This is early, and the most valuable help is data, not just code. A detector is only as good as the corpus it is tested against. See CONTRIBUTING.md for the full guide.
Good first contributions:
- Add a corpus sample. Drop a real file into
corpus/clean/,corpus/minified/, orcorpus/obfuscated/, then runpython eval_corpus.py. If it misclassifies your sample, that is a genuine, useful bug. Open an issue or PR with the file and its correct label. - Add a hardener fingerprint. If you know another obfuscator's tell-tale artifacts (config files, output directories, identifier patterns), add them to
FINGERPRINT_FILES/FINGERPRINT_DIRSor as a new signal indetector.py. - Report a false positive. If
tarpit-guardflags legitimate code (a particular bundler, a language it handles badly), that is exactly what we want to hear: a sample plus the score it got. - Per-language profiles. The signals are JS-centric today. Python, WASM-glue, and others could use their own tuning.
New here? Browse the good first issues. Please also read the Code of Conduct. To report a security problem privately, see SECURITY.md. Release notes live in CHANGELOG.md.
Ground rule: this is a detector, not a deobfuscator. PRs that reverse, strip, or extract secrets from hardened code are out of scope and will not be merged. The tool reads shape, never meaning.
Workflow: fork, branch, make sure python eval_corpus.py still exits clean (0 false positives / negatives), and open a PR describing what you changed and why. New detection behavior should come with a corpus sample that demonstrates it.
Privacy Policy
tarpit-guard collects no data. It runs locally, makes no network requests while it runs, and stores nothing. Installing it downloads packages from PyPI. Full policy: PRIVACY.md.
License
MIT (see LICENSE).
Frequently asked questions
What is tarpit-guard MCP Server?
Detects obfuscated "tarpit" code so AI agents stop before burning tokens on it.
How do I install tarpit-guard MCP Server in Claude Desktop, Cursor, or VS Code?
Pick your client in the Install section on this page and copy the generated config into the client's config file. Step-by-step guides: Claude Desktop, Cursor, and VS Code. tarpit-guard MCP Server runs locally from the PyPI package tarpit-guard with the command uvx tarpit-guard.
Is tarpit-guard MCP Server free and open source?
Yes. tarpit-guard MCP Server is released under the MIT license, an OSI-approved open-source license, so you can use, modify, and self-host it under those terms.
Does tarpit-guard MCP Server support remote (HTTP) connections?
No remote endpoint is listed for tarpit-guard MCP Server. It runs locally on your machine over stdio, started by your MCP client.
What tools does tarpit-guard MCP Server provide?
tarpit-guard MCP Server provides 1 tool: pyarmor_runtime.pyd. See the full tool list for descriptions and parameters.
How is tarpit-guard MCP Server's trust score calculated?
tarpit-guard MCP Server scores 71 out of 100 (Good). The score adds six capped public signals: registry status, maintenance, popularity, license, documentation, and security. Nobody can pay for points. Read the methodology for the full formula.
Reviews
No reviews yet—Be the first to review
No published reviews yet. Used it? Tell the next person how it went.
Sign inA verified email is required to review this server.
Add badge to your README
Paste either snippet into the repository README. The image links to this listing.