[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"pack-detail-mcp-database-connectors-zh":3,"seo:pack:mcp-database-connectors:zh":92},{"code":4,"message":5,"data":6},200,"操作成功",{"pack":7},{"slug":8,"icon":9,"tone":10,"status":11,"status_label":12,"title":13,"description":14,"items":15,"install_cmd":91},"mcp-database-connectors","🗃️","#0891B2","new","本周新建","MCP 数据库连接器全家桶","10 个 MCP 服务器，给 AI agent 安全连上 Postgres \u002F MySQL \u002F MongoDB \u002F Redis \u002F SQLite —— 每一件都自带只读模式、schema 自省和审计日志，让 agent 不再瞎猜字段，也不会一条 SQL 干掉生产表。",[16,28,35,42,49,56,63,70,77,84],{"id":17,"uuid":18,"slug":19,"title":20,"description":21,"author_name":22,"view_count":23,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3283,"216cb667-d5ae-5400-99d5-63dd528e1690","postgres-mcp-pro-index-tuning-safe-sql-tools","Postgres MCP Pro — Index Tuning + Safe SQL Tools","Postgres MCP Pro is an MCP server for PostgreSQL that runs safe SQL, explains plans, and recommends indexes so agents can tune databases faster.","MCP Hub",77,0,"en","mcp","MCP",{"id":29,"uuid":30,"slug":31,"title":32,"description":33,"author_name":22,"view_count":34,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3284,"e3c6ca46-f9f3-5f60-8ff3-7316792032f3","pgedge-postgres-mcp-read-only-by-default-web-ui","pgEdge Postgres MCP — Read-Only by Default + Web UI","pgEdge Postgres MCP is a Go MCP server for Postgres with read-only defaults, optional HTTP auth, and a web UI for database exploration and diagnostics.",79,{"id":36,"uuid":37,"slug":38,"title":39,"description":40,"author_name":22,"view_count":41,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3559,"0b7eef82-ddb4-52b1-93a3-d64a27bfc5b9","dryrun-offline-postgresql-mcp-no-db-creds","DryRun — Offline PostgreSQL MCP (No DB Creds)","DryRun snapshots your PostgreSQL schema once and provides offline linting plus migration\u002Fquery checks via CLI + MCP, without sharing prod credentials.",8,{"id":43,"uuid":44,"slug":45,"title":46,"description":47,"author_name":22,"view_count":48,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3363,"2c4d8def-3374-5876-87e9-73d83580f5f8","mcp-server-mysql-read-only-mysql-mcp-for-claude-code","mcp-server-mysql — Read-Only MySQL MCP for Claude Code","mcp-server-mysql is an MCP server for Claude Code that connects to MySQL (optionally via SSH tunnels) so agents can inspect schemas and run read-only SQL.",68,{"id":50,"uuid":51,"slug":52,"title":53,"description":54,"author_name":22,"view_count":55,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3827,"f7c6c41e-d6aa-5f02-931d-1945b1bd7caa","mysql-mcp-server-secure-mysql-tools-via-mcp","MySQL MCP Server — Secure MySQL Tools via MCP","mysql_mcp_server is an MCP server for MySQL with pip install and Smithery client setup; expose DB actions to Claude Code safely (1,251★).",71,{"id":57,"uuid":58,"slug":59,"title":60,"description":61,"author_name":22,"view_count":62,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3285,"060ccb08-f4b6-5e96-ad28-3fc2cc23bd44","mongodb-mcp-server-npx-read-only-safety-by-default","MongoDB MCP Server — npx + Read-Only Safety by Default","MongoDB MCP Server exposes MongoDB queries and optional Atlas admin tools to MCP clients via npx or Docker, with a read-only mode that reduces risk.",74,{"id":64,"uuid":65,"slug":66,"title":67,"description":68,"author_name":22,"view_count":69,"vote_count":24,"lang_type":25,"type":26,"type_label":27},506,"31218ce0-3c2e-4186-9d68-c7606380c905","redis-mcp-server-official-redis-ai-agents-31218ce0","Redis MCP Server — Official Redis for AI Agents","Official Redis MCP server enabling AI agents to manage Redis data via natural language. Supports strings, hashes, lists, sets, streams, JSON, pub\u002Fsub, and vector search. MIT license.",127,{"id":71,"uuid":72,"slug":73,"title":74,"description":75,"author_name":22,"view_count":76,"vote_count":24,"lang_type":25,"type":26,"type_label":27},753,"f67139b3-1666-4c8a-93d9-29c9c29e6ab2","sqlite-mcp-local-database-ai-agents-f67139b3","Sqlite MCP — Local Database for AI Agents","Official MCP server for SQLite databases. Let Claude Code query, analyze, and modify local SQLite databases through natural language. Zero-config, instant setup.",121,{"id":78,"uuid":79,"slug":80,"title":81,"description":82,"author_name":22,"view_count":83,"vote_count":24,"lang_type":25,"type":26,"type_label":27},3716,"92258aef-329c-5d6b-b4b9-3f9784b23ee0","universal-db-mcp-17-databases-read-only-default","Universal DB MCP — 17 Databases, Read-Only Default","Universal DB MCP is a multi-DB MCP connector (stdio\u002Fhttp) with read-only default and caching; verified 782★ and documents 25x–100x speedups in README.",90,{"id":85,"uuid":86,"slug":87,"title":88,"description":89,"author_name":22,"view_count":90,"vote_count":24,"lang_type":25,"type":26,"type_label":27},203,"a3c39721-f393-4d77-a408-a32c721488e3","genai-toolbox-mcp-server-databases-google-a3c39721","GenAI Toolbox — MCP Server for Databases by Google","Open-source MCP server for databases by Google. Connect AI agents to PostgreSQL, MySQL, Cloud SQL, AlloyDB, and Spanner with built-in auth, connection pooling, and safety. 13K+ stars.",179,"tokrepo install pack\u002Fmcp-database-connectors",{"pageType":93,"pageKey":8,"locale":94,"title":95,"metaDescription":96,"h1":13,"tldr":97,"bodyMarkdown":98,"faq":99,"schema":115,"internalLinks":124,"citations":137,"wordCount":150,"generatedAt":151},"pack","zh","MCP 数据库连接器全家桶：Postgres \u002F MySQL \u002F Mongo \u002F Redis \u002F SQLite 10 件套","10 个 MCP 数据库连接器，默认只读 + schema 自省 + 审计日志，让 AI agent 安全连上 Postgres \u002F MySQL \u002F MongoDB \u002F Redis \u002F SQLite，不再瞎猜字段，也不会一条 SQL 干掉生产库。","10 个 MCP 服务器 —— 每种数据库一件，外加两个通用路由和一个零凭据 DryRun。默认只读、识 schema、带审计日志。装一次，指向任何 DSN，让 agent 别再瞎猜字段。","## 这个 pack 装了什么\n\n这是**更广的那个数据库 MCP 包**。[Postgres for Agent](\u002Fzh\u002Fpacks\u002Fpostgres-for-agents) 把单一引擎讲透；这个 pack 横切普通后端会用到的 5 种数据库 —— Postgres \u002F MySQL \u002F MongoDB \u002F Redis \u002F SQLite —— 外加两个通用路由器和一个不需要凭据的 DryRun，给真正怕事故的人。\n\n| # | 服务器 | 引擎 | 安全姿势 |\n|---|---|---|---|\n| 1 | Postgres MCP Pro | Postgres | 索引建议 \u002F EXPLAIN \u002F 安全 SQL 闸 |\n| 2 | pgEdge Postgres MCP | Postgres | 默认只读 + Web UI 审计 |\n| 3 | DryRun 离线 Postgres MCP | Postgres（只读 schema） | 零凭据、零连接 —— 拿 schema 文件解析 SQL |\n| 4 | mcp-server-mysql | MySQL | 只读模式，专为 Claude Code 调过 |\n| 5 | MySQL MCP Server | MySQL | 能力作用域 + 查询白名单 |\n| 6 | MongoDB MCP Server | MongoDB | `--read-only` 开关，npx 直装 |\n| 7 | Redis MCP Server（官方） | Redis | 命令级 ACL，Redis Inc. 官方构建 |\n| 8 | SQLite MCP | SQLite | 纯本地，按文件路径限范围 |\n| 9 | Universal DB MCP | 17 种引擎 | 全部适配器默认只读 |\n| 10 | GenAI Toolbox（Google） | Postgres \u002F MySQL \u002F Spanner \u002F AlloyDB | OAuth + IAM 感知，生产级别 |\n\n5 种引擎，3 档安全（只读 \u002F 能力作用域 \u002F 离线），一条命令装齐。\n\n## 为什么要做多数据库 MCP\n\n大部分团队不是单数据库。给用户面 Postgres 出功能的 agent，同样要读分析用 MySQL、会话用 Redis、目录用 MongoDB，还有开发本地的 SQLite。每个引擎各自接一份 ad-hoc MCP，最后就是 5 个服务器 \u002F 3 种凭据格式 \u002F 零统一审计的灾难现场。\n\n这个 pack 挑的是「在所有引擎上把同一组事情做对」的连接器：\n\n- **默认只读**，全部带 `--read-only` 或等价能力开关。要写就显式打开，没人替你默默放行\n- **schema 内省是一等工具**，agent 调 `list_tables` \u002F `describe_table` \u002F `list_indexes`，不用猜\n- **连接池内置**，agent 一轮推理打 20 次查询不会重连风暴\n- **审计日志默认开**，agent 跑的每条查询都进结构化日志，事后能 grep\n\n例外是 #3 DryRun —— 它根本不碰你的数据库。你扔给它 schema dump，它让 agent 起草 SQL、类型校验、解释执行计划，全程零凭据。适合 agent 在 junior 写迁移时陪练，没人需要碰生产。\n\n## 安装流程 —— 选 DB \u002F 开只读 \u002F 自省 \u002F 查询 \u002F 审计\n\n这五步节奏在 pack 里每个服务器都通用：\n\n```bash\n# 1. 选要让 agent 看见的 DB\ntokrepo install pack\u002Fmcp-database-connectors\n# 或者一个一个装：\ntokrepo install postgres-mcp-pro\ntokrepo install mongodb-mcp-server\n\n# 2. 接进 host，只读 ON\n# Claude Code 示例（~\u002F.claude\u002Fmcp.json）:\n{\n  \"mcpServers\": {\n    \"postgres\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@pgEdge\u002Fpg-mcp\", \"--read-only\"],\n      \"env\": { \"DATABASE_URL\": \"$READONLY_DSN\" }\n    }\n  }\n}\n\n# 3. 永远先 introspect 再 query\n#   提示词：「列出所有表，描述 orders 表，\n#            然后写一条上周营收的查询」\n\n# 4. 执行 —— agent 跑 SELECT，你读结果\n\n# 5. 审计 —— grep 服务器日志\ntail -f ~\u002F.tokrepo\u002Flogs\u002Fpostgres-mcp-pro.log\n```\n\nMySQL 换成 `mcp-server-mysql`，Mongo 换成 `mongodb-mcp-server`，Redis 换成官方 `redis-mcp-server`。这 5 步完全一样 —— 学一次就够了，这就是这个 pack 的价值。\n\n## 只读模式：为什么每一个开关都要拨\n\n默认放开写权限的 MCP 是把 LLM 幻觉变成生产事故最快的方式。经典翻车现场：agent 推理一条 UPDATE，WHERE 写漏了，半张表被刷掉。\n\n这个 pack 里每个服务器都把默认值翻过来了：**agent 必须显式申请写能力，host 配置必须显式批准。** 两步显式 opt-in，恰好是任何能 DROP TABLE 的能力该有的姿势。\n\n确实需要写的时候 —— 跑迁移、灌测试数据 —— 用一个专用角色（`mcp_writer`），只给特定 schema 的 grant，永远不要用超级用户。配合 Neon 分支、pgEdge 克隆或 Docker fixture，事故半径直接压缩到一个一次性数据库。\n\n## 常见踩坑\n\n- **schema dump 烧 token**。500 张表的生产 schema 跑 `list_tables` 直接打爆 agent 上下文。按单 schema 过滤，或塞个白名单\n- **通用 DB MCP 也躲不开方言差异**。它能管 17 种数据库，但 JSON 列在 Postgres 和 MySQL 里语义不一样 —— agent 偶尔会把 Postgres 风格的 SQL 喂给 MySQL。system prompt 里加一句提示\n- **Redis ACL 是按命令级，不是按 key 级**。官方服务器尊重 ACL，但 `KEYS *` 仍然 O(N)，要设 `--max-scan-keys`，否则 agent 一把锁死事件循环\n- **Mongo `--read-only` 拦写但不拦 `eval`**。老的 Mongo MCP 还允许跑服务端 JS。坚持用本 pack 里 2026 年后的构建，已经把 `$where` \u002F `$function` 剥掉\n- **DryRun 的 schema 要保持新**。它设计上离线，永远看不到你昨天加的列。把 schema 导出做进 CI\n\n## 跟其他 pack 的关系\n\n只关心 Postgres 深度（Neon、Supabase、分支），看 [Postgres for Agent](\u002Fzh\u002Fpacks\u002Fpostgres-for-agents)。要更广的 MCP（浏览器、GitHub、文件系统），看 [MCP Server Stack](\u002Fzh\u002Fpacks\u002Fmcp-server-stack)。生产配置通常是每个 pack 各取一件：本 pack 一个数据库连接器 + 通用 MCP 工具箱 + 向量 DB 做语义召回。",[100,103,106,109,112],{"q":101,"a":102},"为什么不用一个通用 DB MCP，要十个干嘛？","通用 MCP（DBHub \u002F GenAI Toolbox \u002F Universal DB MCP）覆盖大多数场景很漂亮 —— 一个服务器，多个 DSN。但每个引擎都有通用层抹平不了的细节：Postgres 的 EXPLAIN ANALYZE、Mongo 的聚合管道、Redis 的 ACL 语义。Pack 里的引擎专用服务器把这些当一等工具暴露。需要广度用通用 MCP，需要深度用引擎专用的。",{"q":104,"a":105},"只读模式真的拦得住，还是 agent 一句话就能绕过？","协议层就拦死了。只读开了之后，MCP 服务器只注册 `query` \u002F `describe_table`，根本不向 host 暴露 `insert` \u002F `update` \u002F `delete`。Agent 调不了不存在的工具。再保险一层：搭配数据库侧的只读角色（Postgres role）或 Redis ACL，从 DB 那头也撤掉写命令权限。",{"q":107,"a":108},"Claude Code \u002F Cursor \u002F Codex CLI 都能用吗？","三家都能用，加上 Cline \u002F Roo Code \u002F Windsurf \u002F GitHub Copilot \u002F Gemini CLI。MCP 是标准 —— TokRepo CLI 会根据你跑哪个 host 写对应的 config。同一个服务器二进制对所有 host 都生效。",{"q":110,"a":111},"跟 Postgres for Agent 那个 pack 区别在哪？","Postgres for Agent 是单引擎深耕 —— 5 个 Postgres 服务器，包含 Neon \u002F Supabase，分支化任务流，RLS 踩坑。本 pack 是横切 —— Postgres \u002F MySQL \u002F Mongo \u002F Redis \u002F SQLite 每个一两件。技术栈多语言选这个，全 Postgres 选那个。",{"q":113,"a":114},"DryRun 看不到真实数据，能解决什么？","两件事。第一，让 junior + agent 安全写 SQL —— 截图里不会泄露凭据，也不会误手 DELETE。第二，可以放进 CI 当门禁：每个 PR 提议的 SQL 拿 DryRun 跑一遍生产 schema dump，引用了不存在的列就直接 fail。",{"@context":116,"@type":117,"name":13,"description":118,"numberOfItems":119,"publisher":120},"https:\u002F\u002Fschema.org","CollectionPage","10 个 MCP 服务器，给 AI agent 安全连上 Postgres \u002F MySQL \u002F MongoDB \u002F Redis \u002F SQLite。",10,{"@type":121,"name":122,"url":123},"Organization","TokRepo","https:\u002F\u002Ftokrepo.com",[125,129,133],{"url":126,"anchor":127,"reason":128},"\u002Fzh\u002Fpacks\u002Fpostgres-for-agents","Postgres for Agent","Postgres 单引擎深度版（Neon \u002F Supabase \u002F 分支）",{"url":130,"anchor":131,"reason":132},"\u002Fzh\u002Fpacks\u002Fmcp-server-stack","MCP Server Stack","更广的 MCP 工具箱，本 pack 是其中数据库这一层",{"url":134,"anchor":135,"reason":136},"\u002Fzh\u002Fpacks\u002Fdb-schema-migration","数据库 Schema 设计 + 迁移包","schema 层，本 pack 是连接层，二者配套",[138,142,146],{"claim":139,"source_name":140,"source_url":141},"Model Context Protocol 标准","modelcontextprotocol.io","https:\u002F\u002Fmodelcontextprotocol.io",{"claim":143,"source_name":144,"source_url":145},"MongoDB 官方 MCP server","mongodb-js\u002Fmongodb-mcp-server","https:\u002F\u002Fgithub.com\u002Fmongodb-js\u002Fmongodb-mcp-server",{"claim":147,"source_name":148,"source_url":149},"Redis 官方 MCP server","redis\u002Fmcp-redis","https:\u002F\u002Fgithub.com\u002Fredis\u002Fmcp-redis",880,"2026-05-22T13:00:00Z"]