
Drizzle MCP
io.github.Fredobumma由 GitHub 帳號 Fredobumma 發布v0.1.1更新於 Oct 29, 2026
Drizzle Studio for agents: explore your database through your Drizzle schema. Read-only by default.
概覽
本機 MCP 伺服器,讓編碼助理透過專案本身的 Drizzle schema 檢視資料庫,預設為唯讀。
- 可以做什麼
- 列出資料表,並描述欄位、鍵、索引、檢查條件與關聯
- 以欄位選擇、JSON 篩選、排序、分頁瀏覽資料列,並可帶出關聯資料列
- 統計總列數或依值分組計數,並執行單一唯讀 SQL 語句,最多回傳 100 列
- 檢視查詢計畫,在 Postgres 上可用 analyze 取得實際耗時
- 比對 schema 與線上資料庫,並列出 drizzle-kit 遷移的已套用或待套用狀態
- 僅在以寫入參數啟動時,透過 execute 工具修改資料
- 適用情境
- 適合需要讓助理了解 Drizzle 管理的 Postgres 或 SQLite 資料庫實際內容,並寫出符合真實 schema(含 TypeScript 名稱、關聯與預設值)的 Drizzle 程式碼時使用。若同時需要遷移,可搭配 drizzle-kit 自帶的 MCP 伺服器。
- 執行需求
- 透過 npx 在本機執行,需要 Node.js 22 以上版本,以及含 drizzle.config.ts 的專案。它會載入該設定與專案的 .env,並使用專案已安裝的驅動程式與 drizzle-orm 版本連線(pg、postgres.js、PGlite、better-sqlite3 或 libsql/Turso)。目前不支援 MySQL 與 Drizzle 1.0。不在專案資料夾啟動的用戶端需額外指定設定檔路徑參數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Drizzle MCP,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
drizzle-mcp
Drizzle Studio for agents. An MCP server that lets Claude Code, Cursor and other coding agents see your database through your Drizzle schema.
A generic database MCP sees tables and columns. This one reads the schema your code uses: TypeScript names next to SQL names, relations, enums and defaults. An agent can then answer "what's actually in the database?" and write Drizzle code that matches it.
For migrations, use Drizzle's own drizzle-kit mcp (drizzle-kit 1.0): it generates, pushes and checks them. drizzle-mcp reads what's in the database, read-only by default, so the two work side by side.
If it's useful to you, a star on GitHub helps other people find it. Questions, bug reports and ideas are welcome in the issues, and so are pull requests.
Here is what an agent gets back when it asks about a posts table:
Set up
Run it from the folder with drizzle.config.ts.
Claude Code
Cursor (.cursor/mcp.json) and VS Code (.vscode/mcp.json, with "servers" instead of "mcpServers"):
For clients that don't start servers in your project folder, such as Claude Desktop, add "--config", "/path/to/drizzle.config.ts" to args.
drizzle-mcp loads your config the way drizzle-kit does, including your .env. It connects with the database driver and the drizzle-orm version your project already has installed.
Tools
Filters are JSON, so values are always bound as parameters, never pasted into SQL:
If you edit the schema, the server picks up the change on the next call; no restart needed.
Safe by default
An agent shouldn't be able to wreck a database by accident, or because something it read told it to.
- Read-only. Every statement runs in a read-only transaction. SQLite reads use a read-only connection.
- One statement at a time.
select 1; commit; drop table usersis refused before it reaches the database. The Postgres drivers andbetter-sqlite3would refuse it again on their own; libsql would silently drop everything after the first statement. - Bounded. Statements time out after 15 seconds. Results are capped at 100 rows and fetched through a cursor, so a large table is never pulled into memory. Long values are cut short.
- Secrets hidden. Values in columns named like
password,token,secretorapiKeyare shown as[redacted]. - Writes are opt-in.
--allow-writesadds theexecutetool.querystays read-only either way.
Requirements
MySQL isn't supported yet.
drizzle-mcp needs Node.js 22 or newer. It's tested with drizzle-orm 0.45, the current stable release. Drizzle 1.0, now in release candidates, defines relations differently and isn't supported yet.
Options
How it works
- It loads
drizzle.config.tsand your.env, then imports the schema files the config points to (a file, a folder or a glob). Imports go through jiti, so TypeScript works without a build step. - It reads tables, columns and relations from drizzle-orm's own metadata. This is the same information
drizzle-kitand relational queries use. That's where the TypeScript names and relations come from. - It connects with your project's driver.
browseandcountbuild relational queries with your schema objects.queryruns plain SQL through the safeguards above.
Development
The tests run every tool against every driver. Postgres runs as PGlite, which is real Postgres compiled to WebAssembly. pg and postgres.js reach it over the Postgres wire protocol, so no Docker is needed.
Pull requests are welcome. Run pnpm check before opening one, and for anything large, open an issue first so we can agree on the approach.
License
MIT
來源:README.md,提交 b2bfde0
工具
0版本歷史
1- v0.1.1最新Oct 29, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分