Skip to main content
MCP server CX Codex

Django ORM Lens — Claude Code MCP server: what it does & setup

Statically parses Django models, relations, and migrations without database access. Catches N+1 loops and flags risky schema changes directly inside agent chats.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add django-orm-lens -- uvx django-orm-lens
Open on GitHub

What Django ORM Lens does

This tool inspects Django codebases purely through static analysis. It works without an active database connection or runserver. Source files are parsed directly to map models and migration chains.

Linked to an assistant, the server provides 13 read-only tools. These enable agents to discover N+1 query loops, suggest select_related arguments, detect table-locking migrations, and estimate the blast radius of schema edits.

Accurate analysis requires setting DJANGO_ORM_LENS_ROOT to the absolute path of your Django project. Without this variable, the tool cannot discover the target repository files.

What it helps with

  • detect N+1 loops and suggest appropriate select_related calls
  • catch migrations that risk locking database tables
  • evaluate the blast radius of removing model fields
  • inspect relations and schema structure without booting a database

Example prompts for the agent

  • Inspect recent querysets for N+1 issues and suggest optimizations
  • Check new migrations for table locks before deployment
  • Map out foreign key dependencies for the Order model

How to install Django ORM Lens

Platform CLI

claude mcp add django-orm-lens -- uvx django-orm-lens

uvx runs the command named after the package; if the README names another one, use uvx --from django-orm-lens <command>

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about Django ORM Lens

How do I install Django ORM Lens in Claude Code?

Run claude mcp add django-orm-lens -- uvx django-orm-lens. The CLI registers the server and executes it on demand via uvx.

What does Django ORM Lens do?

It gives AI assistants 13 read-only tools to examine Django schemas, queries, and migrations purely via static code inspection.

Does it require a running database or active venv?

Neither a database nor a Python virtual environment is required. The analyzer parses files statically directly from the repository.

Similar MCP servers

All MCP servers for Backend and APIs →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor