Finds what will hurt in a Django project - cascade impact, N+1 queries, unsafe migrations, unscoped tenant reads - as an MCP server and a CLI. Tested against 18 public projects.
- ✓Open-source license (MIT)
- ✓Actively maintained (<30d)
- ✓Clear description
- ✓Topics declared
- ✓Documented (README)
claude mcp add django-chainsaw-mcp -- uvx django-chainsaw-mcp{
"mcpServers": {
"django-chainsaw-mcp": {
"command": "uvx",
"args": ["django-chainsaw-mcp"]
}
}
}MCP Servers overview
# django-chainsaw-mcp










**An MCP server and CLI that analyses a Django project rather than describing
it.** Not *what is in here* — *what will hurt*: what a delete takes with it,
which migration breaks the pods still running, which query returns another
tenant's row, what a `save()` sets off three hops away.
There is **no model in the loop**. Every answer comes from the AST and Django's
own app registry, so the same input gives the same output, and nothing leaves
the machine. It is an MCP server so an assistant can ask it questions, and a CLI
so CI can gate on the answers.
22 checks: 19 need the app registry (16 Django, three of those DRF as well), one
needs only Python, one reads FastAPI, one reads SQLAlchemy.
**[Why this exists →](docs/why.md)**
## Install
**It has to run in an interpreter that can import your project.** Everything
here reads the app registry, which means `django.setup()`, your settings and
your apps:
```bash
/path/to/project/.venv/bin/python -m pip install django-chainsaw-mcp
```
A plain `uvx django-chainsaw-mcp` starts and then fails every check, because
`uvx` gives it an isolated environment with no trace of your project. To avoid
installing, hand `uv` the dependencies instead:
```bash
uvx --with-requirements requirements.txt --from django-chainsaw-mcp django-chainsaw check
```
Two environment variables point it at the project:
| Variable | Example |
| --- | --- |
| `DJANGO_CHAINSAW_PROJECT_PATH` | `/srv/app` — the directory settings are importable **from** |
| `DJANGO_CHAINSAW_SETTINGS_MODULE` | `myproject.settings` |
`django-chainsaw project-info` proves the setup before anything else, and says
which half is missing. **[Five minutes end to end →](docs/quickstart.md)**
mcp-name: io.github.syrian963/django-chainsaw-mcp
## One command
```bash
django-chainsaw check --tenant-root myapp.Organisation
```
```
44 finding(s): 1 critical, 14 high, 29 medium
CRITICAL
--------
[deploy-safety] RemoveField drops 'legacy_code' while code still uses it
shop/0002_remove_product_legacy_code
During a rolling deploy the old pods keep running against the new
schema and will fail.
fix: Ship a release that stops using it, deploy that everywhere,
then ship this migration.
```
Every analysis, merged, worst first, one exit code.
## On a pull request
This is the part that decides whether a tool like this survives. Point `tenancy`
at a five year old project and it returns two hundred candidates; nobody reads
two hundred candidates, somebody adds `continue-on-error`, and it runs forever
with nobody looking.
```bash
django-chainsaw tenancy --since main # only what this branch changed
django-chainsaw tenancy --baseline # everything old, ratcheted
django-chainsaw check --sarif out.json # annotate the diff, on the line
```
`--since` compares at the **merge base**, so a branch that is behind main is not
blamed for other people's work. `--baseline` keeps existing findings in the
report and stops them blocking; anything new fails the build, and fixing an old
one is reported so the number only ever goes down. Findings are fingerprinted on
file plus identity, never the line, so adding an import does not resurrect
twenty findings nobody touched.
`--sarif` writes the format GitHub and GitLab annotate a pull request with, so
findings land **on the line** instead of in a log nobody opens.
**[baseline.md](docs/baseline.md)** · **[cli.md](docs/cli.md)**
## As an MCP server
```bash
claude mcp add django-chainsaw --scope local \
--env DJANGO_CHAINSAW_PROJECT_PATH=/srv/app \
--env DJANGO_CHAINSAW_SETTINGS_MODULE=myproject.settings \
-- /srv/app/.venv/bin/python -m django_chainsaw_mcp.server
```
Ask it `project_info` first: the smallest call that proves both the transport
and the Django boot. Five prompts carry the ordering the tools do not —
`before_deploy`, `why_is_this_slow`, `what_breaks_if_i_delete`, `triage`,
`review_this_branch`.
**[Claude Desktop, Cursor, VS Code, Windsurf, Zed, Docker →](docs/clients.md)**
## Or as one HTML file
```bash
django-chainsaw report --out findings.html --title myproject
```

Grouped by **endpoint** is the view that matters: which pages carry this, and
through what call path. No server, no network, no build step — the CSS, the
script and the data are all in the file, so it works from a CI artifact or an
email attachment. **[report.md](docs/report.md)**
## The checks
<details>
<summary><b>Django projects</b> — these read the app registry, so they need <code>DJANGO_CHAINSAW_SETTINGS_MODULE</code> as well as the project path</summary>
| Tool | Answers |
| --- | --- |
| `project_info` | Does the target project load at all? Run this first when something is broken. |
| `list_models` | Every model with fields, relation kind, direction and `on_delete`. |
| `delete_impact` | Delete one row: what cascades, what blocks, what gets nulled. Transitive. |
| `find_n_plus_one` | Relation traversals in a template that each cost a query, and the fix. |
| `scan_templates` | The same across a directory, resolving context from views. |
| `migration_risk` | Migrations rated: blocks writes, rewrites the table, breaks running code. |
| `deploy_safety` | **Is this destructive migration safe to ship yet?** |
| `find_unscoped_queries` | **Which queries read data the caller may not own?** The IDOR shape. |
| `what_happens_on` | **What does this save actually trigger?** Follows the signal chain. |
| `missing_indexes` | Fields the code filters or sorts on that carry no index. |
| `datetime_audit` | Naive datetimes and field defaults that break when the clock moves. |
| `serializer_exposure` | What DRF serializers expose, including what the next migration will add. |
| `serializer_nplusone` | N+1 in DRF serializers, which is where it lives in an API project. |
| `explain_model` | **Everything about one model, plus the risks only visible combined.** |
| `endpoint_cost` | How many queries one request costs, before anybody sends one. |
| `api_contract` / `api_contract_check` | What this branch changes about the API, and who it breaks. |
| `escaping_side_effects` | Mail and tasks fired inside a transaction that can still roll back. |
| `bypassed_effects` | Bulk writes that skip everything the `save()` chain promised. |
| `race_conditions` | Counters read into Python, changed, and saved. Also unsafe upserts. |
| `money_precision` | **Where a decimal amount stops being exact.** |
| `celery_arguments` | **What the worker actually receives**, and whether it can even be called. |
| `queries_in_loops` | Queries written inside a loop, split by which of three fixes applies. |
| `defeated_prefetches` | Prefetches paid for and then re-queried by the accessor that reads them. |
| `request_impact` | Every finding grouped by the entry points that reach it, so the question becomes which endpoint to fix. |
| `choice_typos` | Literals a field's `choices` will never match: valid SQL, zero rows, no exception. |
| `multiplied_aggregates` | Counts and sums multiplied by a join across two multi-valued relations. |
| `dangling_references` | URL names, templates, signal senders and Celery tasks nothing will resolve. |
| `open_endpoints` | Sensitive fields on endpoints anybody can call. |
| `unused_eager_loading` | Joins and prefetches nothing in the response reads. |
| `check` | Run everything that applies, one severity-sorted list, one exit code. |
| `suggest_fixes` | **Findings turned into code, grouped by how safe each one is to apply.** |
</details>
<details>
<summary><b>Any Python project</b> — no Django, no settings module</summary>
| Tool | Answers |
| --- | --- |
| `project_profile` | What is this built on? Counted from the project's own imports. |
| `blocking_in_async` | **Which synchronous call stops the event loop for every request?** |
| `fastapi_exposure` | Endpoints that serialise more than they declare. |
| `sqlalchemy_nplusone` | Relationships loaded one row at a time, including during serialisation. |
| `amplification` | **Which endpoint can a stranger use to exhaust the database?** |
Plus the resource `django://models`. `check` profiles the project first and runs
what applies, and says **"does not apply, and here is why"** for the rest —
silence would read exactly like a clean result. Nothing about the FastAPI
support imports the project, so those checks run on a checkout with no
dependencies installed at all.
</details>
36 of the 37 tools declare `readOnlyHint`, so a client can stop asking
permission for each call; the exception is `api_contract_check` with
`update=True`, which writes the snapshot and says so.
**[Every tool, argument and output shape →](docs/tools.md)**
## What it will not tell you
Nothing here executes the target project or reads its data, which buys safety
and speed and costs certainty. Every What people ask about django-chainsaw-mcp
What is syrian963/django-chainsaw-mcp?
+
syrian963/django-chainsaw-mcp is mcp servers for the Claude AI ecosystem. Finds what will hurt in a Django project - cascade impact, N+1 queries, unsafe migrations, unscoped tenant reads - as an MCP server and a CLI. Tested against 18 public projects. It has 0 GitHub stars and its last recorded update is dated 2026-09-09.
How do I install django-chainsaw-mcp?
+
You can install django-chainsaw-mcp by cloning the repository (https://github.com/syrian963/django-chainsaw-mcp) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is syrian963/django-chainsaw-mcp safe to use?
+
Our security agent has analyzed syrian963/django-chainsaw-mcp and assigned a Trust Score of 95/100 (tier: Verified). See the full breakdown of passed checks and flags on this page.
Who maintains syrian963/django-chainsaw-mcp?
+
syrian963/django-chainsaw-mcp is maintained by syrian963. The last recorded GitHub activity is dated 2026-09-09, with 5 open issues.
Are there alternatives to django-chainsaw-mcp?
+
Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.
Deploy django-chainsaw-mcp to your cloud
Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.
Maintain this repo? Add a badge to your README
Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.
[](https://claudewave.com/repo/syrian963-django-chainsaw-mcp)<a href="https://claudewave.com/repo/syrian963-django-chainsaw-mcp"><img src="https://claudewave.com/api/badge/syrian963-django-chainsaw-mcp" alt="Featured on ClaudeWave: syrian963/django-chainsaw-mcp" width="320" height="64" /></a>More MCP Servers
Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.
User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
An open-source AI agent that brings the power of Gemini directly into your terminal.
Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface
The fastest path to AI-powered full stack observability, even for lean teams.
🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!