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.
Install ORM Lens
Built from the published package, never by AI.
claude mcp add orm-lens -- uvx orm-lensRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"orm-lens": {
"args": [
"orm-lens"
],
"command": "uvx"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"orm-lens": {
"args": [
"orm-lens"
],
"command": "uvx"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"orm-lens": {
"args": [
"orm-lens"
],
"command": "uvx"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add orm-lens -- uvx orm-lens{
"mcpServers": {
"orm-lens": {
"args": [
"orm-lens"
],
"command": "uvx"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add orm-lens uvx orm-lensGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
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
ANo 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 →Turns GitHub repositories into architecture diagrams, written explanations, Mermaid source and narrated explainer videos. Built for developers who want to understand a codebase, and for AI agents that need to read one.
Mocks, records, and chaos-tests HTTP(S) dependencies for development and testing. One port serves many protocols, including gRPC, WebSockets, and LLM chat APIs. Built for developers and testers who need stand-in services during tests.
Provides MCP server and CLI tools that let AI coding agents build, test and manage iOS and macOS projects with Xcode and simulators. It is aimed at developers working on Apple platform apps.
Creates editable draw.io diagrams in AI chat from Mermaid, PlantUML, CSV or draw.io XML. Built for people who want diagrams from text prompts that stay editable in draw.io.
Indexes your code, git history, tests and decisions on your machine so AI coding agents can query the index instead of re-reading files. Built for developers who want fewer files opened and clearer answers about change risk and code health.
Gives your AI assistant hosted codebase intelligence for repos indexed on repowise.dev. Use it to ask how code works, what a change may break, and which tests to run.
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.
