mcp-server-dmdb
This server provides read-only MCP tools for exploring and querying a Dameng DM8 database, plus optional write/DDL tools when explicitly enabled.
dm_ping: Check connectivity, server version, instance info, current user, and whether write/DDL switches are ondm_list_schemas: List accessible schemas/usersdm_list_tables: Search tables by schema/name pattern, with row stats, tablespace, and commentsdm_describe_table: Inspect columns, constraints, indexes, comments, and optional DDLdm_query: Run read-only SELECT with bound parameters, pagination, and automatic result truncationdm_table_sample: Quickly sample rows from a table without writing SQLdm_table_count: Get exact or estimated row countsdm_explain: View execution plans viaEXPLAIN FORdm_search_objects: Search across table names, column names, and column comments (including Chinese)dm_execute_dml(ifDM_ALLOW_WRITE=true): Perform INSERT/UPDATE/DELETE with safeguards like forced WHERE and rollback limitsdm_execute_ddl(ifDM_ALLOW_DDL=true): Run CREATE/ALTER/DROP with confirmation requirements and audit logging
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-dmdb列出 TRADE_MARKET 模式下的所有表"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-dmdb
达梦 DM8 的 MCP server,基于官方 dmdb Node.js 驱动,用 TypeScript 实现。默认纯只读,写操作与改表结构分别由环境变量开关控制,未开启时对应工具根本不会注册。
安装
npm install -g mcp-server-dmdb@latest # 全局安装最新版
npx -y mcp-server-dmdb@latest # 或按需临时拉取最新版,不落盘@latest 始终拉取 npm 上最新的已发布版本(每次 npm publish 后自动生效),不锁具体版本号。
要求 Node >= 20(ESM only),无原生编译步骤。
Related MCP server: mcp-dm8-server
接入 MCP 客户端
在客户端的 MCP 配置里加一条:
{
"mcpServers": {
"dmdb-dev": {
"command": "npx",
"args": ["-y", "mcp-server-dmdb@latest"],
"env": {
"DM_HOST": "your-host",
"DM_PORT": "5236",
"DM_USER": "your-user",
"DM_PASSWORD": "your-password",
"DM_SCHEMA": "your-schema",
"DM_ALLOW_WRITE": "false",
"DM_ALLOW_DDL": "false"
}
}
}
}Windows 注意:MCP 客户端用 Win32
spawn启动进程,npx是.cmd包装脚本,常解析失败而表现为"客户端静默无响应"。建议改成直接指向node.exe和已安装包的绝对路径:{ "command": "C:/Program Files/nodejs/node.exe", "args": ["C:/Users/<you>/AppData/Roaming/npm/node_modules/mcp-server-dmdb/dist/index.js"] }先
npm install -g mcp-server-dmdb@latest装最新版,再用npm root -g确认上方路径。Linux / macOS 上npx写法没问题。
使用
按上文配好
DM_*连接信息。客户端以 stdio 方式启动本进程,自动完成
initialize握手并拉取tools/list。调用工具:默认 9 个只读工具;设
DM_ALLOW_WRITE=true出现dm_execute_dml,再设DM_ALLOW_DDL=true出现dm_execute_ddl,共 11 个。排查连接:先用
dm_ping确认连通性与两个写开关的运行时状态。
进程以本地子进程方式运行,凭据通过环境变量注入,不监听任何网络端口,无外部鉴权面。
支持的 MCP 协议
本 server 兼容 MCP(Model Context Protocol)2025-era 规范,基于官方 TypeScript SDK v2 实现。
维度 | 说明 |
传输方式 | stdio(标准输入/输出)。stdout 为 JSON-RPC 2.0 通道,所有日志走 stderr,避免污染协议流导致客户端静默卡死 |
SDK |
|
协议版本 |
|
能力声明 | 仅 |
工具调用 | JSON-RPC |
结果格式 | 以 |
连接模型 | 每次 stdio 连接对应一个独立 |
生命周期 | 捕获 |
兼容性边界
支持:stdio 传输、2025-06-18 握手、工具发现与调用、结构化输出(
outputSchema/structuredContent)。不支持:
SSE / Streamable HTTP 传输(仅 stdio);
OAuth 等网络鉴权(凭据由环境变量注入,进程本地运行,不暴露端口);
资源(
resources)订阅、提示模板(prompts)、服务端主动日志推送(logging通知)。
环境变量
变量 | 默认值 | 说明 |
|
| 数据库地址 |
|
| 端口 |
| 必填 | 用户名 |
| 必填 | 密码 |
| 无 | 登录 schema |
|
| 开启 |
|
| 开启 |
|
| 单次返回行数上限 |
|
| 硬顶, |
|
| 单个单元格字符上限 |
|
| 单次响应总字符上限 |
|
| 连接超时 |
|
| 网络超时(驱动原生) |
|
| JS 层兜底超时,触发即丢弃并重建连接 |
|
| 探活超时 |
| 自动 | 见下文"连接加密" |
|
|
|
|
|
|
工具清单
默认注册 9 个;DM_ALLOW_WRITE=true 加第 10 个;再开 DM_ALLOW_DDL=true 共 11 个。
工具 | 用途 | 开关 |
| 连接自检、服务端版本、实例信息、两个写开关的当前状态 | — |
| 列出可访问的模式 | — |
| 按模式 + 表名关键字列模糊搜表,带行数与表注释 | — |
| 列定义 + 主键/外键/唯一/检查约束 + 索引及包含列 + 注释 + 可选 DDL | — |
| 只读 SELECT,绑定参数 | — |
| 采样看数据,自动处理标识符引号与大小写 | — |
| 精确 | — |
| 执行计划 | — |
| 按关键字搜表名/列名/列注释(支持中文注释) | — |
| INSERT / UPDATE / DELETE,结构化入参 |
|
| CREATE / ALTER / DROP |
|
安全边界
SQL 语句必须连续通过五层检查才会执行,任一层失败即拒绝:
归一化 —— 词法扫描剥离注释(不误伤字符串字面量内的
--和/* */)顶层切分 —— 分号必须位于末尾,否则拒绝。服务端本身不拦多语句:
SELECT 1; SELECT 2会被归类为 PL/SQL 块,只能靠这一层关键字黑名单 —— 在已抹平字符串字面量的文本上按词边界匹配
服务端判定 ——
getStatementInfo()返回的语句类型;异常或缺失一律 fail-closed交叉裁决 —— 第 3 层与第 4 层结论必须一致
永久禁止(任何开关状态下都不放行):
TRUNCATE、DROP DATABASE/USER/SCHEMA/TABLESPACE/ROLE、ALTER DATABASE/SYSTEM/SESSION、SHUTDOWN、GRANT、REVOKE、SP_*、SF_*、DBMS_*、EXECUTE IMMEDIATE。
DDL 额外三道锁:
上面的永久黑名单
DROP TABLE/VIEW/INDEX/SEQUENCE与ALTER TABLE ... DROP COLUMN必须传confirm,值严格等于DROP <对象名>每条 DDL 写审计日志(stderr,不受
DM_LOG_LEVEL影响)
DML 保护:update/delete 强制要求 where;autoCommit=false 执行 → 超 max_rows_affected 即回滚,否则提交;建议先用 dry_run=true 统计命中行数。
达梦的 DDL 隐式提交,包不进事务,无法回滚。
已知行为与坑
连接加密默认关闭
dmdb 的 loginEncrypt 默认为 true,但其加密套件在 Node 17+ 的 OpenSSL 3 下会被拒绝:
errCode 6071 消息加密失败
error:0308010C:digital envelope routines::unsupported所以默认改为 false(想强制加密可显式设 DM_LOGIN_ENCRYPT=true)。本驱动只暴露 true/false,不能指定套件。
BIGINT 精度
DM8 的 BIGINT 主键普遍超过 2^53,驱动的默认 number 转换会静默抹平末三位:
真实值 1989221485636136962 -> 到达 JS 时变成 1989221485636137000fetchAsString: [dmdb.NUMBER] 修不了——DM8 里 BIGINT 与 NUMBER 是不同类型。本实现在检测到不安全整数后,只把出问题的那几列用字符串重读一次,因此正常数值列仍是数字,而 ID 保持完整精度。
分页
DM8 原生支持 LIMIT ? OFFSET ? 且可绑定参数(官方实测执行计划优于 ROWNUM/TOP)。dm_query 要求分页写在 SQL 里、值放 params,服务端不做子查询包装——包装会包不住 WITH CTE。
执行计划要用 EXPLAIN FOR
裸 EXPLAIN <sql> 不返回结果集,只回 rowsAffected。必须用 EXPLAIN FOR <sql>。也因此 EXPLAIN 不接受绑定参数,dm_explain 会把 params 安全地内联为字面量。
行数统计
ALL_TABLES.NUM_ROWS 来自统计信息,多数库未收集,值为 NULL。不要拿 dm_list_tables 里的 NUM_ROWS 当真实行数,用 dm_table_count。
语句类型码
getStatementInfo() 返回的是达梦内部码,与 dmdb 自带 .d.ts 声明的 STMT_TYPE_*(声称 SELECT=1)完全不同。实测值:
语句 | 码 | 语句 | 码 |
SELECT(含 FOR UPDATE) | 160 | DROP TABLE | 139 |
INSERT | 157 | ALTER TABLE | 146 |
UPDATE | 159 | TRUNCATE | 194 |
DELETE | 158 | EXPLAIN | 149 |
MERGE | 164 | COMMIT / ROLLBACK | 147 / 148 |
CREATE TABLE | 129 | SET SCHEMA | 153 |
CREATE VIEW / INDEX / SEQ | 131 / 133 / 196 | CALL / BEGIN / 多语句 | 162 |
SELECT ... FOR UPDATE 与普通 SELECT 同为 160,所以 FOR UPDATE 只能靠关键字拦截。
标识符大小写
实测环境中标识符大小写不敏感,data_after_sale 与 DATA_AFTER_SALE 都能命中。但这取决于服务端 CASE_SENSITIVE 参数,不是 DM8 的保证,所以字典查询一律用 UPPER(...) = UPPER(?) 比较。
开发
git clone https://github.com/SpringDamon/mcp-server-dmdb.git
cd mcp-server-dmdb
npm install
npm run build # tsc -> dist/
npm test # 构建 + node --test 跑门禁用例(43 条)下面两个脚本要连真实库,凭据只从环境变量读取,缺失即报错(见 scripts/env.mjs):
export DM_HOST=<host> DM_USER=<user> DM_PASSWORD=<pwd> DM_SCHEMA=<schema>
node scripts/probe-connect.mjs # 验证数据库连通性
node scripts/verify-dict.mjs # 导出字典视图真实列名
node scripts/e2e-mcp.mjs # 端到端 JSON-RPC 验证(43 项检查)依赖
运行时只有 3 个,刻意保持最小:
依赖 | 版本 | 说明 |
|
| MCP SDK v2,ESM-only。协议细节见上文「支持的 MCP 协议」 |
|
| 官方驱动,精确锁版本(非 semver,加 |
|
| schema 校验 |
开发依赖:typescript@^5.9.3(不用 7.x——那是 Go 重写的 tsgo)、@types/node@^22.19.1。
不引入 ORM:达梦没有 Prisma/Drizzle/Knex/MikroORM 方言,社区 fork(typeorm-dm、sequelize-dm8 等)周下载量仅个位数到两位数且基座老旧。更重要的是场景错配——ORM 的价值是实体映射,而 MCP 是运行时动态发现 schema,Entity 模型完全用不上。
测试用 Node 22 内置 node --test,不引 jest/vitest。
附录:字典视图真实列名
以下在真实 DM8 实例上实测所得,与 Oracle 文档有出入,勿照搬 Oracle 经验:
视图 | 关键列 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
注意不对称:索引位置列叫
COLUMN_POSITION,约束位置列叫POSITION。
SP_TABLEDEF(schema, table) 可用,返回 COLUMN_VALUE 列拼成的 DDL 文本。
目录结构
src/
├─ index.ts stdout 保护 + serveStdio + 退出清理
├─ server.ts createServer():建 McpServer 并按需注册工具
├─ config.ts 环境变量解析
├─ log.ts stderr-only 日志 + DDL/DML 审计
├─ db/
│ ├─ driver.ts 【唯一 import dmdb 的地方】CJS/ESM 互操作 + 真实语句类型码
│ ├─ connection.ts 懒加载/ping探活/毒化重连/mutex串行/大整数精确化重读
│ ├─ sql-guard.ts 五层门禁
│ ├─ identifiers.ts 标识符校验与引号
│ └─ types.ts
├─ tools/ register.ts(按开关注册)+ 每个工具一个文件
└─ format/ 序列化 / 三层截断 / markdown 渲染
scripts/ env.mjs(凭据校验)+ probe-connect / verify-dict / e2e-mcpLicense
Available Tools
9 toolsdm_describe_table查看表结构ARead-onlyIdempotent
返回一张表的完整结构:列定义(类型/长度/精度/可空/默认值)、主键、外键、唯一键、检查约束、索引及其包含的列、表注释与列注释,可选附带建表 DDL。写 SQL 之前调用它,避免猜列名和类型。注意:索引位置列在达梦里叫 COLUMN_POSITION,而约束位置列叫 POSITION,两者不同名。
| Name | Required | Description | Default |
|---|---|---|---|
| owner | No | 模式名。table 未带 schema 前缀时使用;不传则按当前用户可访问范围查找 | |
| table | Yes | 表名,支持 "TABLE" 或 "SCHEMA.TABLE" 两种写法,不区分大小写 | |
| include_ddl | No | 是否额外调用 SP_TABLEDEF 取建表 DDL,默认 false | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint and idempotentHint, so safety is covered. The description adds valuable behavioral context: the optional DDL invocation and a DM-specific gotcha that index position columns are named COLUMN_POSITION while constraint position columns are named POSITION. This helps the agent correctly interpret results without needing to discover the quirk at runtime.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences with no fluff: the first lists the complete output scope, the second gives the usage timing, and the third surfaces a critical naming distinction. Each sentence earns its place and the most important information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
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 correctly takes on the burden of explaining return values, which it does thoroughly by enumerating all structural components. It also includes the optional DDL behavior and the crucial column-name discrepancy warning, making it complete for an agent to invoke and interpret results correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and the input schema fully describes all four parameters. The description adds only a small overlap by mentioning optional DDL, which duplicates include_ddl. Per the calibration baseline, 3 is appropriate when the schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: '返回一张表的完整结构' and enumerates exactly what is returned (columns, keys, constraints, indexes, comments, optional DDL). It also distinguishes itself by explicitly stating it should be used before writing SQL to avoid guessing column names/types, clearly separating it from sibling tools like dm_query and dm_table_sample.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase '写 SQL 之前调用它,避免猜列名和类型' provides clear, explicit context for when to use this tool. However, it does not name alternatives or state when not to use it, so it falls short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_explain查看 SQL 执行计划ARead-onlyIdempotent
返回一条 SELECT 语句在达梦 DM8 上的执行计划(走 EXPLAIN FOR,达梦的裸 EXPLAIN 不返回结果集)。输出包含 OPERATION、TAB_NAME、IDX_NAME、SCAN_TYPE、ROW_NUMS、COST 等列。排查慢查询、确认有没有走索引时调用。只接受 SELECT;EXPLAIN 不支持绑定参数,传入的 params 会被内联为字面量(经转义)。
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | 要分析执行计划的 SELECT 语句 | |
| params | No | SQL 中的 ? 参数值。EXPLAIN 不支持绑定参数,这里的值会被安全地内联为字面量 | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already cover readOnlyHint=true, idempotentHint=true, destructiveHint=false, and the description adds substantial context on top: it discloses the implementation quirk that Dameng's bare EXPLAIN returns no result set so EXPLAIN FOR is used, enumerates the output columns (OPERATION, TAB_NAME, IDX_NAME, SCAN_TYPE, ROW_NUMS, COST), and warns that params are inlined as escaped literals because bind parameters are unsupported. These are exactly the non-obvious behaviors an agent needs.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a compact set of four sentences with no filler. The main purpose is front-loaded, and each sentence earns its place: the function, the EXPLAIN FOR quirk, the output columns, the call context, and the constraints. The length is proportionate to the tool's complexity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Even though there is no output schema, the description discloses the return columns so an agent knows what the result will look like. Combined with 100% parameter schema coverage and annotations covering the safety profile, nothing needed to invoke the tool correctly is missing. Minor omissions like error behavior for non-SELECT input are acceptable given the SELECT-only constraint is already stated.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
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 and the baseline is 3. The description reinforces the params-inlining behavior, but the schema's params description already states the same thing ('EXPLAIN 不支持绑定参数,这里的值会被安全地内联为字面量'), so the description adds little semantic value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb+resource: '返回一条 SELECT 语句在达梦 DM8 上的执行计划', which unambiguously states what the tool does. It also differentiates from siblings like dm_query by framing this as execution-plan analysis rather than query execution, and reinforces the purpose with the use case '排查慢查询、确认有没有走索引时调用'.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states when to call ('排查慢查询、确认有没有走索引时调用') and gives a clear exclusion ('只接受 SELECT'). It does not, however, name an alternative sibling tool (e.g., pointing to dm_query for actually executing the query), so the when-not guidance is situational but not tied to a named alternative.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_list_schemas列出可访问的数据库模式ARead-onlyIdempotent
列出当前连接用户在达梦 DM8 中可访问的全部模式(schema/用户)。不确定某个表属于哪个 schema、或想确认库里有哪些业务库时调用。主查询走 ALL_USERS;若权限不足会退回 SYSOBJECTS 按 TYPE$='SCH' 查询。
| Name | Required | Description | Default |
|---|---|---|---|
| response_format | No | 输出格式:markdown 便于阅读,json 便于程序处理 | markdown |
Output Schema
| Name | Required | Description |
|---|---|---|
| count | Yes | |
| schemas | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare read-only and idempotent behavior. The description adds valuable implementation details beyond annotations: it queries ALL_USERS and falls back to SYSOBJECTS with TYPE$='SCH' if permissions are insufficient. This gives the agent useful expectations about behavior and failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences deliver action, usage context, and fallback behavior without redundancy. The purpose is front-loaded, and every sentence contributes meaningful information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple zero-required-parameter list tool, the description covers purpose, use cases, data source, and permission fallback. An output schema exists, and annotations are rich, so nothing essential is missing for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The only parameter, response_format, is fully described in the schema with enum values and a clear description. Schema coverage is 100%, so the description does not need to compensate. It adds no additional parameter meaning, matching the baseline.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states a specific verb and resource: list all schemas/users accessible to the current connection user. It also names concrete invocation scenarios, distinguishing it from sibling table-oriented tools like dm_list_tables.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides clear when-to-use guidance: when unsure which schema a table belongs to, or when confirming available business schemas. It does not explicitly name alternative sibling tools or state when not to use it, but the context is clear enough.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_list_tables列出达梦中的表ARead-onlyIdempotent
按模式名和表名关键字列出达梦 DM8 中的表,附带行数统计、所在表空间和表注释。用于"这个库里有哪些表""我要找订单相关的表"这类探索。注意 NUM_ROWS 来自统计信息,本库多数表未收集统计信息因而为 NULL;需要准确行数请用 dm_table_count 做精确 COUNT。标识符不区分大小写,传 order 或 ORDER 都可以。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 返回行数,默认 50 | |
| owner | No | 模式名(schema),例如 HR、SALES。不传则列出当前用户可访问的全部模式下的表 | |
| offset | No | 跳过的行数,用于翻页 | |
| pattern | No | 表名模糊匹配关键字,不区分大小写,例如 ORDER 会匹配 data_order_main | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already mark the tool read-only and idempotent. The description adds useful behavior beyond annotations: NUM_ROWS is from statistics and may be NULL, and identifiers are case-insensitive. No contradictions with the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three compact sentences each earn their place: what the tool returns, when to use it and the count caveat, and the case-insensitivity note. Information is front-loaded and no filler is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only list tool with no required params and no output schema, the description covers the return shape (row count, tablespace, comment), the main data-quality caveat, and the alternative for exact counts. Remaining defaults and format are already documented in the schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds context beyond schema by illustrating pattern matching ('ORDER matches data_order_main') and confirming case-insensitive identifiers, which helps the agent use owner/pattern correctly.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description states a specific action (list tables in DM8 by schema/name keyword) and the exact payload (row-count statistics, tablespace, comments). It clearly positions the tool as an exploration helper, which differentiates it from sibling tools like dm_describe_table or dm_table_count.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives explicit usage scenarios ('which tables are in this library', 'find order-related tables') and an explicit alternative: use dm_table_count when accurate row counts are required. This satisfies the when/when-not/alternatives criterion.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_ping检查达梦连接与权限开关ARead-onlyIdempotent
检查到达梦 DM8 数据库的连接是否正常,返回服务端版本、实例名、当前连接用户,以及 DM_ALLOW_WRITE / DM_ALLOW_DDL 两个写权限开关的当前状态。排查"连不上"或"提示没有写权限"时先调用本工具。本工具只读取会话与实例元数据,不查询任何业务表。
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| connected | Yes | |
| startTime | No | |
| ddlEnabled | Yes | |
| currentUser | Yes | |
| instanceName | No | |
| writeEnabled | Yes | |
| serverVersion | Yes | |
| reconnectCount | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already declare readOnlyHint, idempotentHint, and destructiveHint, so the bar is lower. The description adds useful behavioral context beyond annotations: it reads session and instance metadata only, touches no business tables, and returns permission-flag status. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three short sentences with no filler. The first sentence states the core function and outputs, the second gives the exact trigger condition for use, and the third clarifies scope. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a no-parameter diagnostic tool with annotations and an output schema, the description is complete: it explains what the tool does, what it returns, when to use it, and what it will not do. No critical information an agent needs to select and invoke it correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters and schema coverage is effectively complete, so there is no parameter detail the description needs to add. Baseline for zero-parameter tools is 4, and the description correctly focuses on output and behavior instead.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description names a specific verb-resource pair: checking whether the DM8 database connection is normal, and lists concrete returned values (server version, instance name, current user, permission switches). It is clearly distinguished from the sibling tools, which are about schemas, tables, queries, and explains that this tool only reads metadata rather than business tables.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit usage guidance: call this tool first when troubleshooting 'cannot connect' or 'no write permission' errors. It also implies a when-not by stating it does not query business tables, though it does not explicitly name alternative sibling tools for those cases.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_query执行只读 SELECT 查询ARead-onlyIdempotent
在达梦 DM8 上执行一条 SELECT 语句,返回列名与结果行。只放行 SELECT:INSERT/UPDATE/DELETE/DDL/多语句/存储过程调用都会被拒绝。分页请在 SQL 里写 LIMIT ? OFFSET ? 并把数值放进 params(DM8 原生支持绑定参数,已实测)。结果会自动按行数、单元格长度、总字符数三层截断,截断提示里会给出下一步建议。BIGINT 主键超出 JS 安全整数范围时会自动改用字符串重读,保证末几位不丢。
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | 要执行的 SELECT 语句。分页请在 SQL 内写 `LIMIT ? OFFSET ?`(DM8 原生支持且可绑定参数),把数值放进 params 数组,例如 sql="SELECT * FROM t WHERE a = ? LIMIT ? OFFSET ?", params=["x", 50, 0] | |
| params | No | 按位置绑定的参数,对应 SQL 中的 ? 占位符。禁止用它拼接标识符 | |
| max_rows | No | 本次查询返回的最大行数,不传则用 DM_MAX_ROWS 默认值 | |
| timeout_ms | No | 本次查询超时毫秒数 | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnly/idempotent/non-destructive annotations, the description discloses non-obvious runtime behavior: rejection of DML/DDL/multi-statements, three-layer result truncation with follow-up suggestions, and automatic re-read of big BIGINT keys as strings. No contradiction with annotations; context is added.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four dense, purposeful sentences: core function, safety boundary, pagination pattern, and edge-case behavior. Nothing is wasted and the most important scoping information is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers return shape, safety, pagination, truncation, and big-integer handling, which is substantial for a query tool with no output schema. It stops short of describing error surfaces (e.g., exact rejection message or JSON framing), but the essential invocation knowledge is present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the schema already documents parameters. The description adds practical guidance: pagination values must go in params, DM8 native binding is verified, and params must never be used to interpolate identifiers. This is meaningful extra semantic context beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens by stating '执行一条 SELECT 语句,返回列名与结果行', giving a concrete verb, resource, and output. It further narrows scope by enumerating rejected statement types, which clearly distinguishes dm_query from read-only sibling tools like dm_explain or dm_table_sample.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly says only SELECT statements are permitted and states how to paginate with LIMIT ? OFFSET ? and bound params. It does not explicitly name alternative sibling tools or say when to prefer them, but the inclusion/exclusion rules are unambiguous enough for an agent to decide when to call it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_search_objects按关键字搜索表和列ARead-onlyIdempotent
按关键字跨表搜索:表名、列名、列注释三处任一命中即返回,同时给出所属表、列类型和注释。适合"哪个表里有手机号字段""跟退款相关的列在哪"这类探索。中文注释也能搜(例如搜"订单")。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 返回行数,默认 50 | |
| owner | No | 限定模式名,不传则搜索全部可访问模式 | |
| offset | No | 跳过的行数 | |
| keyword | Yes | 搜索关键字,会同时匹配表名、列名和列注释,不区分大小写 | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already cover the safety profile (readOnlyHint, idempotentHint, destructiveHint). The description adds useful behavioral context beyond those: matching spans three attributes, results include owner table/type/comment, and Chinese comments are searchable. No contradiction with annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two compact sentences in Chinese, front-loaded with the search scope and immediately followed by practical examples. Zero fluff; every word contributes to understanding the tool's purpose and usage.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only search tool with full schema coverage and safety annotations, the description adequately covers behavior, return fields, and usage scenarios. Pagination and offset/limit are documented in parameters, and since there is no output schema, the returned fields are stated. Nothing essential is missing for correct invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so parameters are fully documented in the schema. The description's mention of keyword matching across three attributes duplicates the schema's keyword parameter description, adding minimal new semantic value beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb (跨表搜索) and resource (tables and columns), and specifies the matching criteria (表名、列名、列注释) and return contents (所属表、列类型、注释). This fully distinguishes it from siblings like dm_list_tables (table listing) and dm_describe_table (single-table detail) without ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Concrete example queries ('哪个表里有手机号字段', '跟退款相关的列在哪') clearly signal the exploration/discovery use case, and the '跨表搜索' phrase implies cross-schema scoping. However, it does not explicitly name alternatives or exclusion criteria, so it lacks the top-tier explicit routing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_table_count统计表行数ARead-onlyIdempotent
返回一张表的行数。默认执行精确 COUNT(*)。注意:达梦 ALL_TABLES.NUM_ROWS 来自统计信息,本库多数表未收集统计信息,该值通常为 NULL —— 所以不要拿 dm_list_tables 里的 NUM_ROWS 当真实行数,要用本工具。大表可以把 exact 设为 false,只读取统计估算值(可能不可用)。
| Name | Required | Description | Default |
|---|---|---|---|
| exact | No | 是否执行精确 COUNT(*)。默认 true;大表可设 false 只取统计信息估算值 | |
| owner | No | 模式名,table 未带前缀时使用 | |
| table | Yes | 表名,支持 "TABLE" 或 "SCHEMA.TABLE",不区分大小写 | |
| response_format | No | 输出格式 | markdown |
Output Schema
| Name | Required | Description |
|---|---|---|
| table | Yes | |
| exactCount | Yes | |
| lastAnalyzed | Yes | |
| estimatedRows | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Beyond the readOnly/idempotent annotations, the description discloses that the default is exact COUNT(*), that exact=false reads an estimate that may be unavailable because most tables lack statistics, and that ALL_TABLES.NUM_ROWS is unreliable. This adds real behavioral context and does not contradict the annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences: what it does, a critical caveat, and a usage tip. Every sentence carries necessary information and the main action is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a read-only row-count tool with a full schema and output schema, the description covers the essential caveats (NUM_ROWS unreliable, exact=false fallback) and points to the right sibling. Nothing needed to call it correctly is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds value by explaining the practical consequence of exact=false in this database (statistics usually unavailable), which enriches the schema's parameter descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with '返回一张表的行数' — a specific verb plus resource. It also distinguishes itself from dm_list_tables by warning that NUM_ROWS is usually NULL, so an agent can immediately tell this tool from its sibling.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly instructs not to use dm_list_tables' NUM_ROWS as the real row count and to use this tool instead. It also gives usage guidance for large tables: set exact=false to use statistical estimates when available.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm_table_sample采样查看表数据ARead-onlyIdempotent
从指定表取几行样本数据,省去手写 SELECT 的步骤,也不用处理标识符大小写和引号。想快速了解一张表里"数据长什么样"时用这个;需要条件过滤或聚合请用 dm_query。默认只取 5 行,避免把上下文打满。
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 采样行数,默认 5 | |
| owner | No | 模式名,table 未带前缀时使用 | |
| table | Yes | 表名,支持 "TABLE" 或 "SCHEMA.TABLE",不区分大小写 | |
| offset | No | 跳过的行数 | |
| response_format | No | 输出格式 | markdown |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The annotations already establish that the tool is read-only, idempotent, and non-destructive. The description adds useful behavioral context: it avoids writing SELECT, handles identifier case/quoting concerns, and caps sampling at 5 rows by default to avoid filling the context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences with no filler: purpose comes first, usage guidance follows, and the rationale for the default limit is included. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple read-only sampling tool with full parameter documentation and safety annotations, the description is nearly complete. It covers purpose, usage boundaries, and behavioral rationale. A small gap is that it does not describe the return format or acknowledge limit/offset semantics, though those are present in the schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the input schema already fully documents limit, offset, owner, table, and response_format. The description reinforces the default 5-row behavior and the table-oriented nature of the tool, but adds little parameter meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action: sampling rows from a specified table to inspect its data. It clearly differentiates this from dm_query by noting that filtering or aggregation belongs to that sibling tool.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says when to use this tool: when you want to quickly understand what data in a table looks like. It also gives an explicit exclusion: for conditional filtering or aggregation, use dm_query.
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. Dates show when Glama detected each change.
9 tool updates
v1.0.3- First observed
dm_describe_table - First observed
dm_explain - First observed
dm_list_schemas - First observed
dm_list_tables - First observed
dm_ping - First observed
dm_query - First observed
dm_search_objects - First observed
dm_table_count - First observed
dm_table_sample
TDQS
Every tool has a clearly distinct role: ping for connectivity, list_schemas, list_tables, describe_table, query, sample, count, explain, and search_objects. Even the overlapping conveniences (sample/count vs query) are explicitly differentiated by purpose and usage guidance.
All tools share the dm_ prefix and use snake_case, but word order varies slightly: list_schemas/list_tables/describe_table/search_objects are action-first, while table_sample/table_count are object-first. The prefix makes the set predictable and readable despite the minor inconsistency.
Nine tools is well-scoped for a DM8 database exploration/query server. Each tool addresses a distinct operation without bloat, covering connection checks, metadata discovery, querying, sampling, counts, and execution plans.
For a read-only database toolset, the surface is complete: connection validation, schema/table discovery, detailed schema inspection, free-form SELECT, quick sampling, exact counts, EXPLAIN, and cross-object search. No obvious dead ends or missing operations within the stated domain.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Paid remote MCP for governed database query review, SQL simulation, approvals, and audits.
- dataOAuthco.thinair
Read-only PostgreSQL, MySQL, SQL Server access via MCP — 24 dialect-aware hosted tools.
The Instant MCP server is a wrapper around the Instant Platform SDK that enables creating, managing, and updating InstantDB applications directly within an editor. It provides tools for fetching rules files for LLMs, retrieving and pushing app schemas, managing permission rules, and executing database queries. Key capabilities include schema management (get-schema, push-schema), permission management (get-perms, push-perms), query execution, and listing recent query history.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides a lightweight MySQL database interface via stdio, enabling query execution, data manipulation, schema inspection, and connection testing using FastMCP tools.3MIT
- AlicenseAqualityDmaintenanceProvides table structure browsing and read-only query capabilities for DM8 databases, enabling interaction through MCP clients like Claude Desktop.3509ISC
- AlicenseAqualityDmaintenanceMCP server enabling AI assistants to connect and query Dameng DM8 databases via JDBC. Supports SQL queries, listing tables, and describing schemas.323MIT
- AlicenseNot gradedqualityAmaintenanceMulti-database management tool and MCP server supporting MySQL, PostgreSQL, SQLite, and Dameng DM8, enabling AI assistants to query and manage databases via stdio or HTTP.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/SpringDamon/mcp-server-dmdb'
If you have feedback or need assistance with the MCP directory API, please join our Discord server