u/dorukyelken

Model Database Protocol
▲ 18 r/generativeAI+4 crossposts

Model Database Protocol

Model Database Protocol – Stop letting LLMs write raw SQL

I built an open-source MCP server that sits between LLMs and your database. Instead of letting the model generate raw SQL, it sends structured intents like:

{"intent": "list", "entity": "orders", "filters": {"total__gte": 100}, "limit": 10}

MDBP validates everything against a schema registry, enforces access policies (field-level, role-based, row filters), builds parameterized queries via SQLAlchemy, and returns LLM-friendly responses.

**Why?**
- LLMs hallucinate table/column names → MDBP catches it with schema validation
- Raw SQL from LLMs = injection risk → MDBP uses parameterized queries only
- No access control → MDBP enforces per-entity, per-role policies

**Features:**
- Auto-discovers your DB schema (zero config to start)
- All transports: stdio, SSE, Streamable HTTP, WebSocket
- Works with Claude Desktop, Cursor, and any MCP client
- Supports SELECT, JOIN, GROUP BY, HAVING, UNION, INSERT, UPDATE, DELETE
- Row-level filtering for tenant isolation

Python Library: pip install mdbp
GitHub: https://github.com/DorukYelken/Model-Database-Protocol

Happy to answer questions or hear feedback!
github.com
u/dorukyelken — 20 hours ago