Wraps the mostajs/orm library so Claude and other AI tools can generate TypeScript EntitySchema definitions, validate them against 24 conceptual rules, and produce SQL migrations by diffing schema versions. You get three tools: generate a schema from a prompt describing entities and relations, lint schemas for common modeling mistakes, and create migration SQL from before/after snapshots. Available as a hosted HTTP endpoint or local stdio process. The local version can read your filesystem for cross-file validation rules. Useful if you're building a data model interactively with an AI assistant and want type-safe schema generation plus automated migration scripts without leaving the conversation.
MCP server for @mostajs/orm — lets AI dev tools (Claude, Cursor, Cline…) generate
EntitySchemas, lint them (24 rules), and produce SQL migrations directly from a prompt.
| Tool | What it does |
|---|---|
mostajs_generate_schema | Build a typed EntitySchema (TS) from an entity name + fields (+ relations). Runs the validator on the result. |
mostajs_validate | Lint one or more EntitySchemas with the built-in conceptual validator (24 rules). |
mostajs_create_migration | Diff two schema sets → SQL migration (diffSchemas + generateMigrationSQL). |
All three reuse @mostajs/orm's public API — no logic is reinvented.
A public instance runs at https://orm-mcp.amia.fr/mcp (Streamable HTTP). Add it to your MCP client:
{
"mcpServers": {
"mostajs-orm": { "url": "https://orm-mcp.amia.fr/mcp" }
}
}
Clients that only speak stdio can bridge it:
npx mcp-remote https://orm-mcp.amia.fr/mcp
Visiting
https://orm-mcp.amia.fr/mcpin a browser returns a JSON-RPC405— that is expected (MCP is POST-only). The human-readable info page is the root/.
npx @mostajs/orm-mcp # stdio transport — the AI tool spawns this process
Local MCP config (Claude Desktop / Cursor / Cline):
{
"mcpServers": {
"mostajs-orm": { "command": "npx", "args": ["-y", "@mostajs/orm-mcp"] }
}
}
In stdio mode, mostajs_validate also accepts a sourceRoot to enable cross-file rules (it reads the local filesystem — disabled on the hosted server for safety).
PORT=14510 npx @mostajs/orm-mcp # or: npx @mostajs/orm-mcp --http
Serves the MCP endpoint at /mcp (POST) and a health/info page at /.
Want to see the schemas this server generates actually run? Sample
18-mcp-to-running-app
takes it the whole way: this MCP generates the EntitySchema for an e-commerce model
(users/products/orders), then @mostajs/orm
applies them and the app runs on sqljs (SQLite WASM, zero native binary). Its
scripts/02-report.sh produces a standalone HTML report — the MCP exchange next to the
real insert/select output.
npx @mostajs/orm-samples scaffold 18-mcp-to-running-app ~/my-mcp-app
cd ~/my-mcp-app && bash scripts/02-report.sh # → report.html
AGPL-3.0-or-later — © Dr Hamid MADANI. Commercial licensing for @mostajs/orm: drmdh@msn.com.