Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

ORM Lens

MCP server by FROWNINGdev Community

Maps Django and SQLAlchemy models, relations and migrations through static analysis, without booting the project. Lets AI coding assistants answer schema questions over MCP. Built for developers working on ORM-based Python projects.

  • Score 78
  • 114 stars
  • MIT
  • Updated

Install ORM Lens

Built from the published package, never by AI.

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

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install ORM Lens in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the orm-lens block.

About

ORM Lens parses Django models and migrations, and SQLAlchemy models and Alembic revisions, from source code. It does not need a database, a running server or a working virtual environment. It can draw live ER diagrams, flag N+1 query loops, check migrations for risky operations, detect schema drift, and estimate blast radius for destructive changes.

The same analysis is available as a CLI, a VS Code extension, a GitHub Action and an MCP server. The MCP server gives AI assistants read-only access to schema information. It suits developers exploring unfamiliar ORM projects, reviewing schema changes in pull requests, and giving coding agents accurate schema context. The project is MIT licensed.

Written from the project's README and checked against it.

Tools it gives your assistant

  • scanCLI command that lists every app and model in a project, shown as a table.
  • nplusoneCLI command that finds N+1 query loops and suggests select_related or selectinload.
  • migration-riskCLI command that flags Django migrations and Alembic revisions that lock tables or may fail.
  • driftChecks whether migrations match the fields declared in models.py, without booting Django.
  • blast-radiusShows what a destructive migration affects, with an optional markdown PR comment.
  • impactFinds code across Django layers that would break if a field or model is removed.
  • erGenerates a Mermaid entity-relationship diagram of the whole schema.

What you need

  • Python 3.9+ (3.10+ for the MCP server)
  • pip install "orm-lens[mcp]" for the MCP server
  • ORM_LENS_ROOT set to the absolute path of your project
  • Docker, optional, for the Docker image (v0.6+)

Try asking

  • Which app owns the Order model and how is it connected to User?
  • Find N+1 query loops in this project and suggest select_related fixes.
  • Show migrations that could lock tables in this Django project.

Good to know

  • The MCP tools are described as read-only.
  • The --stats option needs a read-only query that you run yourself.
  • Formerly named django-orm-lens. The old pip package name still installs orm-lens.

Security check

A

No download-and-run commands, hidden instructions or signs of sending keys out were found.

Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to ORM Lens

All alternatives →

Compare with GitDiagram, mockserver or XcodeBuildMCP

ORM Lens: common questions

Does ORM Lens need a database or a running Django project?

No. The source says it works from static parsing, with no database, no runserver and no working venv.

Which ORMs does ORM Lens support?

Django models and migrations, and SQLAlchemy models and Alembic revisions.

Can the MCP server change my code?

The source describes the 14 MCP tools as read-only.

How do I install ORM Lens?

In Claude Code run claude mcp add orm-lens -- uvx orm-lens. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is ORM Lens the official server?

ORM Lens is a community project by FROWNINGdev, not verified by a company domain.

Is ORM Lens free?

The code is published under the MIT licence. The service it connects to may have its own pricing.

Is ORM Lens safe to use?

It scores 78 of 100. Grades: maintenance A, licence A, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.

What are alternatives to ORM Lens?

Similar MCP servers: GitDiagram, mockserver, XcodeBuildMCP, draw.io.

Does ORM Lens work with ChatGPT?

Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.

ORM Lens Install

Add to stack

Loading.