scan, list, describe, hover and er read Prisma schemas as well as Django and SQLAlchemy models, and so do the MCP tools list_apps, list_models, describe_model, find_relations and er_diagram. Like everything else in the package it is static: .prisma files are read as text, with no Node, no Prisma CLI and no database. Node and TypeScript projects work with no configuration.
uvx orm-lens scan -f table # every model in the schema
uvx orm-lens er -f dbml # ER diagram: mermaid, dbml, d2, plantuml or dot
uvx orm-lens describe Post # one model: columns, keys and relations
The other commands don’t read Prisma yet, and neither does the VS Code extension. The Django analyses never see a Prisma model, and a Django or SQLAlchemy relation never points at one, even when a repository has a Django API and a Prisma front end that both have a User.
Every .prisma file in the workspace is read, except in node_modules, dist, build, virtualenvs, test directories (test, tests, __tests__) and hidden directories. Symlinks that lead outside the workspace are skipped.
In a workspace with no Django or SQLAlchemy project, the MCP server looks for a schema at most four directories down, which covers packages/db/prisma/schema/. If yours is deeper, point workspace_root at a directory closer to it. The CLI has no such limit.
Models are model and view blocks. The table name comes from @@map, or else from the model name. Other block attributes (@@index, @@unique, @@schema and so on) are kept as written under meta.
Columns are the scalar, enum, composite-type and Unsupported("...") fields, each with its attributes. JSON output adds nullable, and primaryKey for fields in @id or @@id.
Foreign keys come from @relation(fields: [...]). The relation is shown on the key column (authorId), as a ForeignKey, or as a OneToOneField when the key columns are unique. A composite key is one relation, shown on one of its columns. When two keys share a column, such as tenantId, both relations are kept. JSON output lists every column of the key in keyColumns, and the columns they point at in references. Diagram edges lead to those columns, so a key can point at a unique email instead of the id.
Relation fields (author User, posts Post[]) aren’t columns, so they are listed apart, under relationships. A many-to-many without a model of its own also appears once in the model’s fields, as a ManyToManyField through its _PostToTag table. MongoDB has no such table, so there the relation has none.
Delete policy comes from onDelete. Without it, Prisma’s own default is shown:
| Relation | Default |
|---|---|
| Optional: the relation field and every key column are optional | SET_NULL |
| Required | RESTRICT |
| Required, on SQL Server with real foreign keys | NO_ACTION |
One required key column makes the whole relation required, as it does in Prisma.
A schema can be split over files. Each file with a datasource block starts a schema, and a file without one belongs to the nearest directory, at or above its own, that has a file with a datasource. If that directory has several, such as schema.postgres.prisma next to schema.sqlite.prisma, the file can’t be matched to one of them. It is then grouped only with other files like it in its own directory.
Each schema is listed as an app named after the directory that owns it: apps/web/prisma/schema.prisma is web, and a schema at the repository root is prisma. When that name isn’t unique, or a Django or SQLAlchemy app already has it, the schema is named after its path instead (prisma_schema_postgres). Relations always stay inside their own schema.
orm-lens scan --format json marks these models with "orm": "prisma" and adds tableName, inheritedFields (always empty) and relationships. Django models serialize exactly as before.
The parser was run on the schemas of Cal.com, Documenso, Formbricks, Dub, Langfuse, Umami, Hoppscotch and Trigger.dev. It found all 547 models and views and all 862 foreign keys that a separate text count found in the same files. Dub’s 18 files were read as one schema.