
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 分