django-mcp-sql: Instructions file for Claude Code

CLAUDE.md

django-mcp-sql CLAUDE.md is an instructions file for Claude Code from thepapermen/django-mcp-sql. It costs 589 tokens per session, scanned A, original, MIT.

Project-specific instructions for django-mcp-sql, a standalone Python package that lets an MCP service read data from SQL databases through Django.

In plain words
What is it for?
Use them when making non-trivial changes, setting up database roles or OAuth, or running the package's standalone tests.
Why use it?
They give coding agents the architecture, configuration rules, and safety constraints needed to change the package without breaking its database or OAuth behavior.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is thepapermen/django-mcp-sql's own configuration. It tells Claude Code how to work on django-mcp-sql itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything django-mcp-sql configures →

Reuse

Borrowing it

Nothing to install: this file belongs to thepapermen/django-mcp-sql. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/thepapermen/django-mcp-sql/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/thepapermen/django-mcp-sql

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for django-mcp-sql CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/thepapermen/django-mcp-sql/claude-md/github.svg)](https://agentmods.dev/instructions/thepapermen/django-mcp-sql/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/thepapermen/django-mcp-sql/claude-md"><img src="https://agentmods.dev/badge/instructions/thepapermen/django-mcp-sql/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for django-mcp-sql CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/thepapermen/django-mcp-sql/claude-md"><img src="https://agentmods.dev/badge/instructions/thepapermen/django-mcp-sql/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 589 This file is loaded in full into every session.
When invoked 589 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00589 $0.00589
Opus 5.5 $0.00236 $0.00236
Sonnet 5.5 $0.00118 $0.00118
Haiku 4.5 $0.00059 $0.00059

Measured 25d ago against content hash 7c32ed809cbb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

django-mcp-sql CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 41 lines

How it starts

The opening of the file, as written. The whole thing — 41 lines — stays where its author put it; the contents beside it link to each section on GitHub.

mcp_sql — agent guidance

The full architecture, file map, settings shape, OAuth surface, curated-view pattern, naming map, and the complete "Watch out" list live in docs/architecture.md (shipped in the wheel). Read it before touching anything non-trivial here. Operational runbooks: docs/role-setup.md (DB role + grants) and docs/oauth.md (OAuth + MCP transport).

This package is distributed standalone as django-mcp-sql (see pyproject.toml, RELEASING.md). It must stay consumer-agnostic: no imports from the surrounding project in production code OR tests; every consumer-specific value comes from the MCP_SQL settings dict. The test suite runs standalone via make test here (settings: tests/settings.py).

Load-bearing invariants (full rationale in docs/architecture.md)

  • Only SET LOCAL, never bare SET — transaction-mode pgbouncer would leak session GUCs onto reused backends. session.enter_readonly_session is the single helper; never inline a partial copy.
  • The default DB alias must never serve MCP reads. The guarantee is the executor's connection.alias == DB_ALIAS assert, NOT the router (routers can't intercept explicit connections[...]). The router only blocks migrations on the read alias.
  • Parser check ordering is a pinned contract (test_parser.TestCheckOrdering) — security reasons fire before ergonomic ones so audit rows name the real problem. Reorder with care.
  • run_query results are fenced: rows (and error) come back as a per-response random-UUID <untrusted-data-…> string, not a list — the prompt-injection boundary. list_tables/describe_table are not fenced.
  • MCPOAuth2Authentication is mounted on /mcp/sql/ only — never in REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"]; the view self-declares IsAuthenticated so stock DRF defaults can't pierce the package.
  • Per-request FastMCP instantiation is deliberate (tool closures over the authenticated user). Tools are async def, dispatch ORM work via sync_to_async(..., thread_sensitive=False), and every dispatch is wrapped in _close_conns_after — keep all three properties for any new tool.
  • Curated-view migrations live in the OWNING app, use CREATE OR REPLACE VIEW forward SQL (column-additive) and carry state_operations=[CreateModel(..., managed=False)].

Read the full file on GitHub · 41 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 27d ago Changed · +69 lines · +1,222 tokens per session ad2c86e77808
  2. 2mo ago First seen · 41 lines · 589 tokens per session scan A 7c32ed809cbb

Subscribe to this mod's changes

django-mcp-sql CLAUDE.md is an instructions file published in the GitHub repository thepapermen/django-mcp-sql (4 stars, last pushed today), licensed MIT. It adds 589 tokens to every session, about $0.0024 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

django-mcp-sql CLAUDE.md compared with instructions from other repositories

django-mcp-sql CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
django-mcp-sql CLAUDE.mdthepapermen/django-mcp-sqlInstructions file4todayMITA589Claude Code
plan-forge caching.instructions.mdsrnichols/plan-forgeInstructions file62d agoMITA733GitHub Copilot
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot