Skip to main content
MCP server CX Codex

ORM Lens — Claude Code MCP server: what it does, how to install

ORM Lens — an MCP server for Claude Code, Cursor, Codex and other platforms that statically analyzes Django and SQLAlchemy models, migrations, and N+1 queries.

MIT ★ 114 updated 2026-11-16

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

What ORM Lens does

ORM Lens parses model graphs, detects migration risks, and surfaces N+1 query patterns without booting a live database or virtual environment. It reads Django models and migrations alongside SQLAlchemy and Alembic revisions directly from source code.

The server runs via uvx or uv, providing read-only MCP tools to answer schema questions from ground truth. Point the environment variable ORM_LENS_ROOT at your project absolute path to get started.

The package is distributed under the MIT license with no paid tiers, subscriptions, or account requirements.

What it helps with

  • detect N+1 query loops in codebase
  • check Django and Alembic migrations for table locks
  • analyze model graphs without a running database
  • inspect database schema relationships statically

Example prompts for the agent

  • Show all N+1 queries using orm-lens
  • Find risky database migrations
  • Explain the Django model schema over MCP

How to install ORM Lens

Platform CLI

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

uvx runs the command named after the package; if the README names another one, use uvx --from 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 ORM Lens

How to install ORM Lens in Claude Code?

Run the command claude mcp add orm-lens -- uvx orm-lens in your terminal.

What does ORM Lens do?

It performs static analysis on Django and SQLAlchemy models, migrations, and queries without booting a database.

What is needed to run ORM Lens?

You need Python, uvx, and an absolute path to your target project configured via ORM_LENS_ROOT.

Similar MCP servers

All MCP servers for Agent setup: memory, context, orchestration →

Project sponsors

Companies that keep this analytics open