# ORM Lens MCP server

> Performs static analysis on Django and SQLAlchemy models to detect N+1 queries, migration risks, and generate ER diagrams.

- Repository: https://github.com/FROWNINGdev/orm-lens
- Page: https://hostedmcp.org/servers/frowningdev/orm-lens
- Transport: stdio
- Stars: 110
- License: MIT
- Latest version: 1.18.0

## Install

### Claude Code

```sh
claude mcp add orm-lens -- uvx orm-lens
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "orm-lens": {
      "command": "uvx",
      "args": [
        "orm-lens"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "orm-lens": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "orm-lens"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"orm-lens","type":"stdio","command":"uvx","args":["orm-lens"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "orm-lens": {
      "command": "uvx",
      "args": [
        "orm-lens"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add orm-lens -- uvx orm-lens
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.orm-lens]
command = "uvx"
args = ["orm-lens"]
```

### Gemini CLI

```sh
gemini mcp add -s user orm-lens uvx -- orm-lens
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "orm-lens": {
      "command": "uvx",
      "args": [
        "orm-lens"
      ]
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `ORM_LENS_ROOT` | no | no |  |

## FAQ

### Does ORM Lens require a running database or virtual environment?

No, it uses static parsing, meaning it works without a database, a running server, or a working virtual environment.

### How do I use ORM Lens with an AI agent?

You can install it via pip with the MCP extra to provide 14 read-only tools that answer schema questions.
