db-mcp-server

db-mcp-server is a skill for Claude Code, Codex from redgreat/db_mcp_server. It costs 67 tokens per session (2,194 once invoked), scanned A, original, MIT.

A set of database tools for exploring and working with MySQL and PostgreSQL databases. It can inspect connections and schemas, run queries, generate documentation and entity-relationship diagrams, review SQL, and analyze performance.

In plain words
What is it for?
Use it to inspect databases and tables, describe schemas, run limited queries, review SQL, create database documentation or ER diagrams, and investigate performance.
Why use it?
It provides a structured way to discover database details and query data while emphasizing connection checks, read-only work, query limits, and explicit permissions for changes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/redgreat/db_mcp_server/db-mcp-server
Any agent
npx skills add redgreat/db_mcp_server --skill db-mcp-server
Clone the repo
git clone --depth 1 https://github.com/redgreat/db_mcp_server

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for db-mcp-server

README.md
[![agentmods](https://agentmods.dev/badge/skills/redgreat/db_mcp_server/db-mcp-server.svg)](https://agentmods.dev/skills/redgreat/db_mcp_server/db-mcp-server)
Your own site
<a href="https://agentmods.dev/skills/redgreat/db_mcp_server/db-mcp-server"><img src="https://agentmods.dev/badge/skills/redgreat/db_mcp_server/db-mcp-server.svg" alt="Measured on agentmods" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,194 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.02194
Opus 5 $0.00034 $0.01097
Sonnet 5 $0.00013 $0.00439
Haiku 4.5 $0.00007 $0.00219

Measured 2d ago against content hash f6ccc5da095c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

db-mcp-server scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.dsh/skills/db-mcp-server/SKILL.md · 168 lines

How it starts

The opening of the file, as written. The whole thing — 168 lines — stays where its author put it; the contents beside it link to each section on GitHub.

数据库 MCP 工具使用指南

🎯 核心原则

  1. 先查连接,再操作 — 不知道 connection_id 时必须先调 mcp__dbmcp__list_connections,禁止猜测 ID
  2. 逐层探索 — 按 list_connectionslist_databaseslist_tablesdescribe_table 的顺序探索
  3. 只读优先 — 查询用 mcp__dbmcp__execute_query,写入/DDL 用 mcp__dbmcp__execute_sql(需确认权限)
  4. 默认数据库 — 大部分工具的 database 参数可选,不传则使用连接的默认数据库
  5. 明确告知 — 每次操作后向用户说明 connection_iddatabase、工具名称;若返回 OSS 链接须给出可点击地址
  6. 大表慎用execute_query 必须带 LIMIT;文档/ER 库表过多时优先 markdown 或 include_columns: false

支持的数据库类型mysqlpostgresql

🔧 可用工具列表(22 个)

所有工具名前缀为 mcp__dbmcp__,例如:mcp__dbmcp__list_connections

基础探索工具

工具 用途 必需参数 示例
list_connections 列出所有可用数据库连接 {"search": "mysql"}
list_databases 列出指定连接的数据库 connection_id {"connection_id": 1}
list_tables 列出指定数据库的表 connection_id {"connection_id": 1, "database": "mydb"}
list_views 列出视图 connection_id {"connection_id": 1}
list_procedures 列出存储过程 connection_id {"connection_id": 1}
describe_table 查看表结构(字段、类型、键) connection_id, table {"connection_id": 1, "table": "users"}

查询与执行工具

工具 用途 必需参数 权限
execute_query 执行 SELECT 查询(只读) connection_id, sql
execute_sql 执行任意 SQL(DDL/写入) connection_id, sql 写/DDL

⚠️ 重要提示:

  • execute_query 只能执行 SELECT/SHOW/DESCRIBE/EXPLAIN 等只读语句
  • execute_sql 可以执行 INSERT/UPDATE/DELETE/CREATE/DROP/ALTER 等语句,需要相应权限
  • 所有 SQL 查询必须带 LIMIT,避免返回大量数据

文档与图表工具

工具 用途 必需参数 特色功能
export_db_doc 导出数据字典文档 connection_id 支持 markdown/pdf,可上传 OSS
generate_er_diagram 生成 ER 图 connection_id 业务域分析 + Mermaid 图,支持 pdf/markdown
generate_data_flow 生成数据流图 connection_id 分析表间数据流向
export_ddl 导出完整 DDL connection_id 包含表、视图、存储过程、触发器

📊 输出格式选项:

  • format: "markdown" - Markdown 文本(适合预览和编辑)
  • format: "pdf" - PDF 文件(需要服务器安装中文字体)
  • upload_to_oss: true - 上传到对象存储并返回下载链接

Read the full file on GitHub · 168 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 168 lines · 67 tokens per session scan A f6ccc5da095c

Subscribe to this mod's changes

db-mcp-server is a skill published in the GitHub repository redgreat/db_mcp_server (2 stars, last pushed 2d ago), licensed MIT. It adds 67 tokens to every session and 2,194 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

alloydb-basics

Manages clusters, instances, and backups for AlloyDB for PostgreSQL, and integrates with AlloyDB Model Context Protocol (MCP) tools for automated database operations. Use when creating, configuring, or administering AlloyDB databases. Do NOT use for general PostgreSQL instances (e.g. Cloud SQL) or other GCP databases.

google/skills · 72 tokens

postgresql-table-design

Use this skill when designing or reviewing a PostgreSQL-specific schema. Covers best-practices, data types, indexing, constraints, performance patterns, and advanced features.

wshobson/agents · 37 tokens

db-repair

Auto-fix gbrain's Postgres access so the brain stays available. When any gbrain command or MCP tool result carries a GBRAINDBACCESS marker (or an operator reports the brain database is down), run the hardcoded gbrain db-repair ladder: diagnose, apply the safe tier, verify. The action is ALWAYS the hardcoded command …

garrytan/gbrain · 96 tokens

claimable-postgres

Provision instant temporary Postgres databases via Claimable Postgres by Neon (neon.new) with no login, signup, or credit card. Supports REST API, CLI, and SDK. Use when users ask for a quick Postgres environment, a throwaway DATABASEURL for prototyping/tests, or "just give me a DB now". Triggers include: "quick…

neondatabase/mcp-server-neon · 123 tokens

dsql

Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, diagnose cluster performance, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, foreign key…

awslabs/agent-plugins · 229 tokens

volcengine-rds-postgresql

使用火山引擎 RDS PostgreSQL,帮助用户完成 RDS PostgreSQL 相关的实例管理、数据库操作、账号管理和运维任务,可直接调用 uv run ./scripts/callrdspostgresql.py 脚本获取实时结果。.

bytedance/agentkit-samples · 63 tokens