Skip to main content
Glama
Yukuiii

any-db-mcp

by Yukuiii

any-db-mcp

English | 简体中文

让大模型通过 MCP (Model Context Protocol) 安全地操作数据库。支持 MySQL / MariaDB / PostgreSQL / SQLite / Microsoft SQL Server / Oracle

npm version

特性

  • 统一适配:MySQL / MariaDB / PostgreSQL / SQLite / MSSQL / Oracle 共用同一套工具接口

  • 双传输模式:stdio 本地子进程 + Streamable HTTP 远程,后者带 stateful session 与可选 Bearer Token 鉴权

  • MCP Resources 暴露 schema:db://tablesdb://table/{name}db://table/{schema}/{name} 让客户端主动消化库结构,大幅减少每次对话重复 describe 的 token 开销

  • 三档权限模式readonly / readwrite / full,启动时由环境变量决定,运行时不可篡改(5 层防 LLM 提权设计)

  • 事务支持:单工具批量提交,任一失败自动回滚

  • 连接弹性:TCP keepalive + 连接丢失自动重建并重试 + 健康检查工具

  • 一次调研到位describe_table 一次返回列定义、索引、行数估算、数据采样,减少 LLM 来回试探

  • 响应耗时透明:所有 SQL 类工具返回 elapsedMs,便于 LLM 感知性能并调整策略

  • 统一 JSON 响应:所有工具返回结构化 JSON,便于 LLM 解析

  • 零部署:通过 npx 一行命令即可在任意 MCP 客户端中使用

Related MCP server: MCP SQL Server

工具一览

Tool

说明

受权限模式约束

connect

动态连接数据库,返回当前数据库的表信息列表与权限模式

disconnect

主动断开连接并释放连接池(幂等)

connection_status

查看当前连接状态、ping 健康度、表信息列表与权限模式

query

执行只读查询(SELECT / SHOW / DESCRIBE),响应最多返回前 1000 行

execute

执行单条写操作(DML,或 full 模式下 DDL)

transaction

在事务中顺序执行多条 SQL,任一失败回滚

list_tables

列出当前连接数据库的所有表名与表注释

describe_table

一次返回指定表的列定义、索引、估算行数与数据采样

search_schema

按关键词搜索表名、列名和字段类型

explain

获取 SQL 执行计划(不实际执行原 SQL),辅助优化

权限模式(PERMISSION_MODE)

Mode

query

execute / transaction

DDL

适用场景

readonly

生产环境查询、数据探索

readwrite ⭐默认

✓ DML(INSERT/UPDATE/DELETE)

常规业务操作

full

✓ DML + DDL

迁移、初始化、Schema 演进

安全保证PERMISSION_MODE 只能在 server 启动时通过环境变量设定。AppConfig 在加载后被 Object.freeze 深冻结,且任何工具的 inputSchema 都不暴露权限相关参数,杜绝 LLM 通过"重连提权"等手段绕过限制。

快速开始

通过 npx 使用(推荐)

在 MCP 客户端配置中添加:

{
  "mcpServers": {
    "any-db-mcp": {
      "command": "npx",
      "args": ["-y", "@sakura0v0/any-db-mcp"],
      "env": {
        "PERMISSION_MODE": "readwrite",
        "DB_TYPE": "mysql",
        "DB_HOST": "localhost",
        "DB_PORT": "3306",
        "DB_USER": "root",
        "DB_PASSWORD": "your_password",
        "DB_NAME": "your_database"
      }
    }
  }
}

本地源码运行

npm install
npm run build
node dist/index.js

对应 MCP 客户端配置:

{
  "mcpServers": {
    "any-db-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/any-db-mcp/dist/index.js"],
      "env": {
        "PERMISSION_MODE": "readwrite"
      }
    }
  }
}

环境变量

变量

说明

默认值

PERMISSION_MODE

权限模式:readonly / readwrite / full

readwrite

DB_TYPE

数据库类型:mysql / mariadb / postgresql / sqlite / mssql / oracle

mysql

DB_HOST

数据库主机

localhost

DB_PORT

数据库端口

3306(MySQL/MariaDB)/ 5432(PG)/ 1433(MSSQL)/ 1521(Oracle)

DB_USER

数据库用户名

root

DB_PASSWORD

数据库密码

(空)

DB_NAME

默认数据库

(空)

DB_SCHEMA

仅 PostgreSQL/MSSQL/Oracle:schema 名称;空值表示所有非系统 schema

(空)

DB_FILEPATH

SQLite 数据库文件路径

(空)

DB_ENCRYPT

仅 MSSQL:是否启用 TLS 加密

true

DB_TRUST_SERVER_CERTIFICATE

仅 MSSQL:是否信任自签证书

false

QUERY_TIMEOUT_MS

query 工具响应超时时间(ms)

30000

MCP_TRANSPORT

传输方式:stdio(默认) / http

stdio

MCP_HTTP_HOST

仅 http:监听主机,公网暴露请显式设 0.0.0.0 并配 token

127.0.0.1

MCP_HTTP_PORT

仅 http:监听端口

3000

MCP_HTTP_PATH

仅 http:MCP endpoint 路径

/mcp

MCP_AUTH_TOKEN

仅 http:可选 Bearer Token,设置后所有请求需带 Authorization: Bearer <token>

(空,不鉴权)

不配置 DB_* 时,Server 启动后不自动连接,需 LLM 主动调用 connect 工具。

数据库连接示例

LLM 调用 connect 工具时的入参示例:

MySQL

{
  "type": "mysql",
  "host": "localhost",
  "port": 3306,
  "user": "root",
  "password": "xxx",
  "database": "mydb"
}

MariaDB

{
  "type": "mariadb",
  "host": "localhost",
  "port": 3306,
  "user": "root",
  "password": "xxx",
  "database": "mydb"
}

PostgreSQL

{
  "type": "postgresql",
  "host": "localhost",
  "port": 5432,
  "user": "postgres",
  "password": "xxx",
  "database": "mydb",
  "schema": "billing"
}

SQLite

{
  "type": "sqlite",
  "filepath": "/path/to/database.db"
}

Microsoft SQL Server

{
  "type": "mssql",
  "host": "localhost",
  "port": 1433,
  "user": "sa",
  "password": "xxx",
  "database": "mydb",
  "schema": "sales",
  "encrypt": true,
  "trustServerCertificate": false
}

Oracle

{
  "type": "oracle",
  "host": "localhost",
  "port": 1521,
  "user": "app",
  "password": "xxx",
  "database": "FREEPDB1",
  "schema": "BILLING"
}

Oracle 使用 oracledb Thin mode;database 参数可填写 service name,也可填写完整 TNS connect string。

协议兼容数据库可直接复用现有适配器:

  • TiDB / OceanBase 等 MySQL 协议兼容数据库 → 选 type: mysql

  • CockroachDB / YugabyteDB 等 PG 协议兼容数据库 → 选 type: postgresql

传输方式 (Transport)

支持两种 transport,通过 MCP_TRANSPORT 切换。

stdio (默认)

最常见的本地集成方式,client 以子进程方式启动 server,通过标准输入输出通信。无需端口/网络,Claude Code、Cursor 等 IDE 默认走这条路径。

Streamable HTTP

MCP spec 2025-03-26 实现:POST /mcp 接收 JSON-RPC,响应可为 JSON 或 SSE 流;GET /mcp 用于建立长连接接收 server-initiated 消息;DELETE /mcp 关闭 session。每个 session 由服务端生成 Mcp-Session-Id 头并返回,客户端后续请求需带回。

# 本地开发:监听 127.0.0.1,无鉴权
MCP_TRANSPORT=http npx @sakura0v0/any-db-mcp

# 远程访问:绑 0.0.0.0 + Bearer Token + 反向代理 TLS
MCP_TRANSPORT=http \
MCP_HTTP_HOST=0.0.0.0 \
MCP_HTTP_PORT=3000 \
MCP_AUTH_TOKEN="$(openssl rand -hex 32)" \
npx @sakura0v0/any-db-mcp

安全约定:

  • 默认 MCP_HTTP_HOST=127.0.0.1,只接受本机回环。生产远程访问务必同时设置 MCP_AUTH_TOKEN 并通过反向代理(nginx / caddy)套 TLS。

  • 设置 MCP_AUTH_TOKEN 后所有请求需带 Authorization: Bearer <token>,使用常数时间比较抵御计时攻击。

  • HTTP 请求 body 上限 1 MB,防止简单 DoS。

  • 多 session 共享 db 单例数据库连接池:适合"个人远程访问",多用户场景应每 client 部署独立 server。

响应格式

所有工具返回统一的 JSON 结构。

成功响应

{
  "success": true,
  "rowCount": 2,
  "limit": 1000,
  "truncated": false,
  "timeoutMs": 30000,
  "rows": [
    { "id": 1, "name": "Alice" },
    { "id": 2, "name": "Bob" }
  ],
  "elapsedMs": 3
}

失败响应(MCP 协议层会同时设置 isError: true):

{
  "success": false,
  "error": "当前权限模式为 readonly,禁止任何写操作。"
}

表信息列表响应

list_tablesconnect 和已连接状态下的 connection_status 都会返回 tableCounttablestables 是结构化表信息数组,不是字符串数组;PostgreSQL/MSSQL/Oracle 会带 schema

{
  "success": true,
  "tableCount": 2,
  "tables": [
    { "schema": "public", "name": "users", "comment": "系统用户" },
    { "schema": "billing", "name": "orders", "comment": null }
  ],
  "elapsedMs": 4
}

schema 在 MySQL/SQLite 中为 nullcomment 来自数据库原生表注释,无注释或 SQLite 这类无原生表注释的数据库返回 null

search_schema 快速定位

search_schema 可按关键词搜索当前库的表名、列名和字段类型,适合大库中先定位相关表字段再调用 describe_table。响应最多返回前 50 个命中项,并带 failedTables 说明个别表结构读取失败的情况。

{
  "keyword": "email"
}

describe_table 增强响应

调用 describe_table 时可传入 schemasampleLimit(默认 3,0 表示不采样,最大 20)。响应一次性返回结构、索引、行数估算与采样数据:

{
  "success": true,
  "schema": "public",
  "table": "users",
  "columns": [
    { "name": "id", "type": "bigint", "nullable": false, "key": "PRI", "extra": "auto_increment", "defaultValue": null, "comment": "用户 ID" },
    { "name": "email", "type": "varchar(120)", "nullable": false, "key": "UNI", "extra": "", "defaultValue": null, "comment": "邮箱地址" }
  ],
  "indexes": [
    { "name": "PRIMARY", "columns": ["id"], "unique": true },
    { "name": "uk_email", "columns": ["email"], "unique": true }
  ],
  "rowCount": 12453,
  "rowCountIsEstimate": true,
  "sampleCount": 3,
  "sample": [
    { "id": 1, "email": "alice@example.com" },
    { "id": 2, "email": "bob@example.com" },
    { "id": 3, "email": "carol@example.com" }
  ],
  "elapsedMs": 12
}

行数估算策略

数据库

数据源

rowCountIsEstimate

备注

MySQL/MariaDB

information_schema.TABLES.TABLE_ROWS

true

InnoDB 估算,避免 COUNT(*) 全表扫描

PostgreSQL

pg_class.reltuples

true

依赖 ANALYZE,从未分析时为 null

MSSQL

sys.partitions

true

元数据估算,避免 COUNT(*) 全表扫描

Oracle

ALL_TABLES.NUM_ROWS

true

依赖统计信息,未收集时为 null

SQLite

SELECT COUNT(*)

false

本地文件,精确值

MCP Resources

除工具外,server 还暴露三个 MCP Resource,让客户端可以主动订阅库结构(配合 notifications/resources/list_changed,连接切换时自动刷新):

URI

类型

说明

db://tables

静态

当前库的所有表名 + 表注释 + 估算行数,JSON 格式,适合 LLM 一次摸清规模量级

db://table/{name}

动态模板

单表的列定义与索引,每张表自动一个 URI(由 server 根据当前库动态生成)

db://table/{schema}/{name}

动态模板

PostgreSQL/MSSQL/Oracle 跨 schema 精确定位单表结构

connect / disconnect 成功后会发送 notifications/resources/list_changed, 支持订阅的客户端会自动刷新可用资源列表。未连接时读 db://tables 返回 connected: false 的友好提示,读不存在的表返回 error 字段。

db://tables 返回示例:

{
  "connected": true,
  "databaseType": "postgresql",
  "tableCount": 2,
  "tables": [
    {
      "table": "users",
      "schema": "public",
      "comment": "系统用户",
      "rowCount": 12453,
      "rowCountIsEstimate": true
    },
    {
      "table": "orders",
      "schema": "billing",
      "comment": null,
      "rowCount": 98210,
      "rowCountIsEstimate": true
    }
  ]
}

list_tables / describe_table 工具的区别:Resources 是"声明式订阅",由客户端缓存并复用, 适合放进每次对话的上下文;Tools 是"命令式调用",适合需要最新数据(如刚做完写入)或需要采样数据时。

事务示例

LLM 调用 transaction 工具:

{
  "sqls": [
    "UPDATE accounts SET balance = balance - 100 WHERE user_id = 1",
    "UPDATE accounts SET balance = balance + 100 WHERE user_id = 2"
  ]
}

任一语句失败,事务自动回滚,所有改动撤销。

架构

src/
├── index.ts              入口:加载配置 → 注册工具 → 可选自动连接 → 按 transport 启动
├── transport.ts          stdio + Streamable HTTP 启动器(stateful session + Bearer)
├── config.ts             AppConfig 与 PermissionMode(启动后冻结,运行时不可改)
├── db.ts                 DatabaseManager 单例,持有当前 Adapter
├── adapters/
│   ├── types.ts          DatabaseAdapter 统一接口
│   ├── mysql.ts          mysql2/promise 连接池实现(MySQL/MariaDB)
│   ├── postgresql.ts     pg 连接池实现
│   ├── sqlite.ts         better-sqlite3 实现
│   ├── mssql.ts          mssql 连接池实现(SHOWPLAN_XML via transaction)
│   └── oracle.ts         oracledb Thin mode 连接池实现
└── tools/
    ├── index.ts          所有 Tools 注册入口
    ├── connect.ts        connect 工具
    ├── disconnect.ts     disconnect 工具
    ├── connection-status.ts connection_status 工具
    ├── query.ts          query 工具
    ├── execute.ts        execute 工具
    ├── transaction.ts    transaction 工具
    ├── list-tables.ts    list_tables 工具
    ├── describe-table.ts describe_table 工具
    ├── search-schema.ts  search_schema 工具
    ├── explain.ts        explain 工具
    ├── resources.ts      MCP Resources(db://tables + db://table/{name} + db://table/{schema}/{name})
    ├── permission.ts     权限检查 helper
    ├── response.ts       统一响应工厂 ok() / fail()
    └── sql-patterns.ts   SQL 类型正则 + 多语句拦截

License

MIT

Available Tools

10 tools
connectA

连接到数据库。支持 MySQL、MariaDB、PostgreSQL、SQLite、MSSQL、Oracle。传入连接参数后会建立新连接,之前的连接会被自动关闭。SQLite 只需要传 filepath 参数;PostgreSQL/MSSQL/Oracle 可通过 schema 指定命名空间,不传则列出所有非系统 schema;Oracle 的 database 参数表示 service name 或 TNS connect string;MSSQL 在 SQL Server 2019+ 默认要求加密,自签证书环境需将 trustServerCertificate 设为 true。连接成功后返回当前数据库的表信息列表与当前权限模式(权限模式仅由 server 启动配置决定,无法通过此工具修改)。

ParametersJSON Schema
NameRequiredDescriptionDefault
hostNo数据库主机地址(SQLite 不需要)localhost
portNo数据库端口(0 表示使用默认端口:MySQL/MariaDB 3306,PostgreSQL 5432,MSSQL 1433,Oracle 1521)
typeYes数据库类型
userNo数据库用户名(SQLite 不需要)
schemaNo仅 PostgreSQL/MSSQL/Oracle 使用:schema 名称;不传则列出所有非系统 schema
encryptNo仅 MSSQL 使用:是否启用 TLS 加密(SQL Server 2019+ 默认要求),默认 true
databaseNo数据库名(SQLite 不需要;Oracle 填 service name 或 TNS connect string)
filepathNoSQLite 数据库文件路径(仅 SQLite 使用)
passwordNo数据库密码(SQLite 不需要)
trustServerCertificateNo仅 MSSQL 使用:是否信任自签证书(开发/局域网常用),默认 false

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and discloses important side effects: previous connection is auto-closed, successful connection returns table info and permission mode, and permission mode cannot be modified. It omits error handling and timeout behavior, but covers key operational traits well.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The paragraph is front-loaded with the core action and supported databases, then details special cases efficiently using semicolons. It is information-dense but not repetitive, though a few clauses are redundant with the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 10 parameters, 6 database types, and no output schema, the description covers connection behavior, return values (table list and permission mode), and database-specific quirks. An agent has enough context to invoke it correctly without opening the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description reiterates some database-specific parameter usage (e.g., SQLite filepath, Oracle database as service name, MSSQL trustServerCertificate) but adds little beyond what the schema already states, so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (connect) and resource (database), lists all supported database types, and distinguishes from siblings by describing what happens on connection (previous connection closed, returns table info and permission mode).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear context for when to use it (to establish a connection before other operations) and implicitly warns that a new connection replaces the old one. However, it does not explicitly compare to siblings like disconnect or connection_status.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

connection_statusA

查看当前数据库连接的状态,返回是否已连接、数据库类型、ping 健康度(实测耗时)、表信息列表以及权限模式。LLM 在长时间未操作后或捕获到执行失败时可调用此工具确认连接可用性。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden, and it does deliver: it discloses that the tool performs a live ping with a measured latency and reports permission mode, which are behavioral traits not derivable elsewhere. It stops short of stating that the call is strictly read-only/non-mutating or whether it has side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose followed by usage guidance; every clause earns its place by describing returned fields or the trigger condition. The return-field enumeration is somewhat dense but directly substitutes for the absent output schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description must cover both behavior and return shape, and it does: it lists all result fields and the diagnostic purpose. An agent has everything needed to decide to call it and interpret the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so per the rubric the baseline is 4; there is nothing for the description to compensate for and it introduces no misleading parameter expectations.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Starts with a specific verb+resource ('查看当前数据库连接的状态') and enumerates exactly what the result contains: connection boolean, database type, ping health with measured latency, table list, and permission mode. This is clearly distinguishable from siblings like connect, disconnect, query, or list_tables.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states the two trigger conditions: after a long period of inactivity, or when an execution failure is captured. It does not name alternative tools or state when not to use it, but the conditional guidance is concrete and actionable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

describe_tableA

查看指定表的详细信息,一次返回:列定义/索引/外键/估算行数/数据采样。PostgreSQL/MSSQL/Oracle 跨 schema 同名表时应传 schema 精确定位。LLM 在写 SQL 前调用此工具可同时拿到字段结构、关联关系、表大小量级、字段真实取值示例,大幅减少猜测。

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes要查看的表名
schemaNo仅 PostgreSQL/MSSQL/Oracle 使用:schema 名称,用于跨 schema 精确定位
sampleLimitNo采样数据行数,默认 3,0 表示不采样,最大 20

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full disclosure burden. It usefully details the return payload (structure, relations, size magnitude, sample values), but says nothing about whether sampling executes real queries on large tables, permission/auth requirements, or read-only safety. The payload disclosure is valuable but behavioral traits are only partially covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences, front-loaded with the return contents, followed by the schema-locating rule and the pre-SQL usage note. No filler, though the final sentence slightly retreads the enumerated return list.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description must (and does) enumerate the return fields, making it callable without guessing. With no annotations either, it is nearly complete, with minor gaps only around cost/side effects of sampling.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters. The description adds genuine value beyond the schema by explaining when the 'schema' parameter matters (PostgreSQL/MSSQL/Oracle disambiguation across same-named tables), which the schema text only states flatly.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb+resource ('查看指定表的详细信息') and enumerates exactly what is returned: column definitions, indexes, foreign keys, estimated row count, and data sampling. This clearly distinguishes it from siblings like list_tables and search_schema, which do not return full structural detail.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit timing guidance ('LLM 在写 SQL 前调用此工具', call before writing SQL) and a conditional rule for when to pass schema. However, it does not name alternative tools (e.g. search_schema, list_tables) or state exclusions, so it falls short of the full when/when-not/alternatives standard.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

disconnectA

主动断开当前数据库连接并释放连接池。断开后再次执行 query / execute 等操作前需调用 connect 工具重新连接。未连接时调用也安全(幂等)。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does well: it discloses that the connection pool is released, that subsequent query/execute calls will fail until connect is invoked, and that the operation is idempotent and safe when already disconnected. It does not state the return/confirmation value, though no output schema exists to cover that.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three short sentences, front-loaded with the core action and effect, followed by the consequence and the idempotency note. No filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter, annotation-free lifecycle tool with no output schema, the description covers the action, its side effect on the connection pool, the required follow-up (connect), and the no-op case. Only the observable result of a successful call is left unstated, which is minor.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so there are no parameter semantics to explain; the baseline for a parameterless tool applies. Nothing in the description misrepresents the empty input schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('主动断开当前数据库连接并释放连接池'), and explicitly distinguishes itself from the sibling connect tool by naming it as the required follow-up action. An agent can tell immediately this tears down a connection rather than establishing or inspecting one.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides clear sequencing guidance: after disconnect, call connect again before query/execute. It also covers the edge case of calling while already disconnected. It does not spell out when an agent should prefer to keep a connection open versus close it, but the operative context is well covered.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

executeA

执行单条写操作。在 readwrite 模式下仅支持 DML(INSERT / UPDATE / DELETE);在 full 模式下额外支持 DDL(DROP / TRUNCATE / ALTER / CREATE / GRANT / REVOKE);readonly 模式禁用此工具。

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes要执行的 SQL 写操作语句

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden and does well: it discloses mode-dependent permission behavior (which statement classes are permitted or blocked per mode) and the single-statement constraint. It stops short of stating error behavior, whether operations are transactional/atomic, or confirmation requirements, but the permission gating is genuinely valuable context beyond the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single well-formed sentence, front-loaded with the core action and immediately followed by the mode-conditional constraints. No filler and every clause earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter write tool with no output schema and no annotations, the mode-gating rules are the essential missing context and are fully covered. Minor gaps remain around error/result behavior, but nothing critical for correct invocation is absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for the single 'sql' parameter, so the schema already documents it. The description adds the important semantic that the SQL must be a write statement (DML/DDL per mode), which is meaningful, but provides no syntax, batching, or format detail beyond that. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific operation (执行单条写操作 – execute a single write statement) and its exact scope, distinguishing it from the read-oriented 'query' sibling and the multi-statement 'transaction' sibling through the 'single write operation' framing. An agent can determine from the text that this tool mutates data rather than reading it.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It explicitly conditions use on connection mode: DML only in readwrite, DML+DDL in full, and disabled in readonly, which is strong usage guidance. It does not, however, explicitly route the agent to alternatives for multi-statement writes (transaction) or reads (query), leaving some inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

explainA

获取 SQL 的执行计划,辅助分析查询性能与优化。所有权限模式下均可调用(EXPLAIN 不实际执行原 SQL)。仅支持 SELECT / INSERT / UPDATE / DELETE / WITH 开头的语句;无需自带 EXPLAIN 前缀,适配器内部统一拼接。

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes要分析的 SQL(不需要自带 EXPLAIN 前缀)

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose key traits: the SQL is not actually executed (a meaningful safety guarantee), it works under every permission mode, and the adapter auto-prefixes EXPLAIN. It stops short of describing the shape of the returned plan or any cost/latency behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences, purpose front-loaded, followed by constraints and the prefix-handling detail. Nothing is redundant and every clause carries usable information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter tool with no output schema and no annotations, the description covers purpose, safety, permission scope, and input constraints. The one omission is any hint about the format of the returned execution plan, though without an output schema this is a minor gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There is only one parameter and schema description coverage is 100%, so the schema already documents 'sql' fully. The description's note about not needing the EXPLAIN prefix simply repeats what the schema field description says, adding no meaning beyond structured data — the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource — obtaining the SQL execution plan for performance analysis — and scopes it precisely (SELECT/INSERT/UPDATE/DELETE/WITH only). The note that EXPLAIN does not execute the original SQL implicitly separates it from execution siblings like execute and query, so an agent can distinguish it without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives clear context: callable in all permission modes, limited to five statement prefixes, and no manual EXPLAIN prefix required. It never explicitly names an alternative tool (e.g. 'use execute for actual execution'), so routing is left partly to inference, but the conditions for valid use are well defined.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_tablesA

列出当前连接数据库的所有表名与表注释。tables 字段为包含 schema/name/comment 的结构化列表。PostgreSQL/MSSQL/Oracle 未配置 schema 时返回所有非系统 schema 的表,已配置 schema 时只返回该 schema 的表。

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It usefully discloses the schema-scoping rule and that results are non-system schemas, but says nothing about permissions, behavior for other database types, or ordering limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three compact sentences with the main purpose front-loaded and behavioral detail following. No padding, though the opening sentence and the schema clause could be tightened slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema and no annotations, the description compensates by describing the returned 'tables' field structure (schema/name/comment) and the schema-filtering rule. Complete enough to call correctly, though permission and non-listed-DB behavior remain unspecified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes no parameters, so per the rubric the baseline is 4. The description correctly implies no input is needed beyond the active connection.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource ('列出...所有表名与表注释') and adds return scope (names and comments only), which cleanly separates it from describe_table and search_schema. An agent can tell which tool returns a flat table listing without opening any schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explains the schema-filtering behavior for PostgreSQL/MSSQL/Oracle, but frames it as return behavior rather than when to pick this tool over siblings like describe_table or search_schema. No explicit when-to-use or when-not-to-use guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

queryA

执行只读 SQL 查询(SELECT / SHOW / DESCRIBE)。响应最多返回前 1000 行,并通过 limit 字段告知本次返回上限;超过 QUERY_TIMEOUT_MS 会失败。执行计划请使用 explain 工具。

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes要执行的 SQL 查询语句

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose real behavioral traits: read-only safety, a hard 1000-row cap communicated via a limit field, and failure past QUERY_TIMEOUT_MS. It omits auth/connection prerequisites and what happens to rows beyond the cap, but the operational profile is well covered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight clauses with zero filler: capability and scope first, then limits, then the alternative tool. Every sentence earns its place and the most important constraint (read-only) is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter read tool with no output schema, the description covers the essentials an agent needs: allowed statement types, truncation behavior, timeout, and the explain alternative, including the limit field that stands in for an output schema. Missing only error/connection context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter and schema description coverage is 100%, so the schema already documents the sql parameter. The description adds no syntax or format guidance for the query string, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (执行只读 SQL 查询) and enumerates the accepted statement types (SELECT / SHOW / DESCRIBE), which separates it from write-oriented siblings like transaction and execute. An agent can identify the tool's job without opening the schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes execution-planning needs to the explain tool (执行计划请使用 explain 工具), a clear condition-to-alternative mapping. It does not, however, distinguish this tool from the sibling execute or transaction, leaving some ambiguity for an agent choosing between SQL execution paths.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

search_schemaB

按关键词搜索当前数据库 schema,匹配表名、列名和字段类型。适合在大库中快速定位相关表或字段,响应最多返回前 50 个命中项。

ParametersJSON Schema
NameRequiredDescriptionDefault
keywordYes搜索关键词,会与表名、列名、字段类型做大小写不敏感匹配

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the behavioral burden. It usefully discloses the result cap of 50 hits, which is real operational context absent from structured fields. However, it does not state that this is a non-mutating read, nor anything about truncation signaling or connection requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two compact clauses that front-load the action and scope, then the usage context. No padding or redundancy; could only be improved by adding the alternative tools, which is a content rather than structure issue.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description should ideally clarify what a hit looks like (table, column, type). It communicates the 50-result cap but leaves the shape of results to be discovered, which is a modest gap for a discovery-oriented tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the single keyword parameter and its case-insensitive matching behavior are already documented in the schema. The description restates the same matching scope without adding format or syntax guidance, so the baseline of 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (search) and resource (current database schema) with explicit match scope: table names, column names, and field types. It is clearly distinguishable from describe_table and list_tables in intent, though it does not name those siblings to reinforce the distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Suitable for quickly locating relevant tables or fields in a large database' gives an implied usage context, but never states when to prefer this over list_tables or describe_table, nor any preconditions (e.g. requires an active connection). The routing guidance is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

transactionA

在数据库事务中按顺序执行一组 SQL。任一语句失败则整体回滚;全部成功才提交。权限规则与 execute 一致:readonly 禁用;readwrite 仅 DML;full 支持 DML + DDL。常用于多步写操作的原子性保证(如转账、订单创建)。

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlsYes要按顺序执行的 SQL 语句数组,至少一条

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden and does well: it discloses rollback-on-any-failure, commit-only-on-full-success, and the permission matrix (readonly disabled, readwrite DML-only, full DML+DDL). It omits failure/error return behavior and whether SELECTs are permitted inside, leaving a small gap for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three tight sentences, front-loaded with the core transactional behavior, then permissions, then use cases. Every sentence adds distinct information with no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a one-parameter mutation tool with no annotations and no output schema, the description covers enough to call it confidently: atomicity contract, permission gating, and typical scenarios. It could be fuller on result/error reporting or handling of non-DML statements, but nothing essential is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% and the single 'sqls' parameter is already documented as an ordered array requiring at least one statement. The description's mention of sequential execution adds marginal reinforcement but no new syntax or format detail, so the baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb (execute) and resource (a group of SQL statements) with the defining constraint that they run inside a single database transaction. The all-or-nothing semantics clearly separate it from the sibling 'execute', which runs statements without an atomic wrapper.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives concrete usage context ('atomicity for multi-step writes such as transfers and order creation') and references 'execute' for the permission model, implying that single/non-atomic statements belong there. It stops short of an explicit when-not-to-use rule, so it is not quite a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 10 tool updatesv1.2.2
    • First observedconnect
    • First observedconnection_status
    • First observeddescribe_table
    • First observeddisconnect
    • First observedexecute
    • First observedexplain
    • First observedlist_tables
    • First observedquery
    • First observedsearch_schema
    • First observedtransaction

TDQS

A4.1/5.0

Scored across 10 tools

Disambiguation5/5

每个工具都有清晰独特的用途:connect/disconnect/connection_status 处理连接管理,query/execute/transaction 处理 SQL 执行且界限分明(只读 vs 单条写 vs 批量事务),list_tables/describe_table/search_schema 处理 schema 探索,explain 处理执行计划。描述明确说明了彼此的区别与适用场景。

Naming Consistency4/5

大部分工具采用一致的 verb_noun 或名词模式(list_tables, describe_table, search_schema, connection_status),但 connect, disconnect, query, execute, explain, transaction 为单个动词/名词,虽常见但与前者混合。整体仍可读且惯例常见,属轻微不一致。

Tool Count5/5

10 个工具覆盖连接生命周期、SQL 执行、schema 发现与性能分析,规模适中,每个工具都有明确职责,无冗余或缺失感。

Completeness5/5

覆盖了数据库交互的完整生命周期:连接管理(connect/disconnect/status)、只读查询(query)、写操作(execute)、事务(transaction)、schema 探索(list_tables/describe_table/search_schema)及执行计划(explain),无明显缺口。

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    A lightweight MySQL MCP server that enables LLMs to interact with databases through tools for schema inspection and query execution. It features LLM-friendly formatting, SSL support, and a secure read-only mode with query timeout protections.
    7
    344 npm
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that connects LLMs to SQL databases for development assistance, enabling query execution, schema exploration, and data manipulation while providing safety controls against destructive operations.
    5
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    A secure and efficient MCP server for MySQL database operations, enabling LLMs to execute SQL queries with read-only access by default and optional write permissions.
    3
    MIT
  • -
    license
    Not graded
    quality
    Not graded
    maintenance
    A multi-database MCP tool that enables LLM agents to securely query and write to databases via local stdio, supporting MySQL, Oracle, PostgreSQL, DM, SQLite and more.
    1
    -