mcp-dm8-server
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-dm8-servershow me all tables in SYSDBA"
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-dm8-server
由 lianekai 维护的 TypeScript 版达梦 DM8 Model Context Protocol (MCP) 服务,提供表结构浏览和只读查询能力,便于在支持 MCP 的客户端(如 Claude Desktop、mcp-router、mcp-use)中直接操作达梦数据库。
目录
Related MCP server: mysql-mcp-zag
主要特性
list_tables、describe_table、execute_query覆盖 Schema 列表、表结构和只读 SQL 操作。参数统一校验,自动规避 schema/table 注入风险,并强制限制为 SELECT/SHOW/DESCRIBE/EXPLAIN。
支持环境变量、CLI 以及
.env文件组合配置,易于部署。默认使用 stdio 传输,可与任意 MCP 客户端对接。
环境要求
Node.js >= 16(推荐 16.x;若使用 18.x 需追加
--openssl-legacy-provider,原因是 Node 18 内置的 OpenSSL 3 默认禁用旧算法,而达梦官方dmdb驱动仍依赖 legacy provider)。npm >= 9 或兼容包管理器。
达梦 DM8 数据库实例及具备权限的账号。
达梦 Node 原生驱动依赖(
dmdb已在package.json中声明,必要时按官方文档安装系统库)。
安装与构建
git clone https://github.com/lianekai/mcp-dm8-server.git
cd mcp-dm8-server
npm install
npm run build构建完成后即可运行:
DM_HOST=127.0.0.1 DM_PORT=5236 DM_USERNAME=SYSDBA DM_PASSWORD=密码 DM_SCHEMA=SYSDBA \
node dist/index.js也可以直接使用 npx 调用已经构建好的 CLI(等价于 node dist/index.js,更方便在 Codex 或其他 MCP 调度器中引用):
npx mcp-dm8 --host 127.0.0.1 --port 5236 --username SYSDBA --password 密码 --schema SYSDBA注意:首次执行前需要先运行
npm run build生成dist/cli.js。
配置方式
支持命令行参数、setConfig 运行时注入、环境变量/.env。优先级:CLI > 运行时 > 环境变量。
配置项 | CLI 参数 | 环境变量 | 默认值 |
用户名 |
|
| 无 |
密码 |
|
| 无 |
主机 |
|
| 无 |
端口 |
|
| 5236 |
默认 Schema |
|
| 无 |
示例 .env:
DM_HOST=localhost
DM_PORT=5236
DM_USERNAME=SYSDBA
DM_PASSWORD=••••••
DM_SCHEMA=SYSDBA查看版本:
node dist/index.js --version快速启动
在 node 版本选择上,请注意:使用 Node.js 16.x 时可以直接启动;若使用 Node.js 18.x,则必须通过命令行参数显式追加 --openssl-legacy-provider 以启用被默认禁用的旧 OpenSSL 算法,否则启动会失败。
npm 脚本:仓库内已提供
npm run start:dm8,会自动为当前进程注入NODE_OPTIONS=--openssl-legacy-provider。Windows 环境若需兼容,可改用cross-env NODE_OPTIONS=--openssl-legacy-provider node dist/index.js。Shell 启动器:执行
./start-dm8.sh --host 127.0.0.1 --port 5236 --username SYSDBA --password 密码 --schema SYSDBA,脚本会自动附加 legacy provider 并将参数透传给dist/index.js。Direnv 环境变量:仓库根目录提供
.envrc,如果你使用 direnv,在项目目录执行一次direnv allow,进入目录时会自动设置NODE_OPTIONS=--openssl-legacy-provider。若不需要该行为,可删除或忽略.envrc。
在 MCP 客户端中注册
Claude Desktop
claude_desktop_config.json 追加:
{
"mcpServers": {
"dm8": {
"command": "node",
"args": ["/path/to/mcp-dm8-server/dist/index.js"],
"env": {
"DM_HOST": "127.0.0.1",
"DM_PORT": "5236",
"DM_USERNAME": "SYSDBA",
"DM_PASSWORD": "your-password",
"DM_SCHEMA": "SYSDBA"
}
}
}
}mcp-router / mcp-use
config.json 追加:
{
"servers": {
"dm8": {
"command": "node",
"args": ["/path/to/mcp-dm8-server/dist/index.js"],
"env": {
"DM_HOST": "127.0.0.1",
"DM_PORT": "5236",
"DM_USERNAME": "SYSDBA",
"DM_PASSWORD": "your-password",
"DM_SCHEMA": "SYSDBA"
}
}
}
}如果想直接使用源码运行,可把
args替换为npx tsx src/index.ts,并确保本地已安装tsx。
Codex CLI
构建产物(若尚未执行过):
npm run build。编辑
~/.codex/config.toml,确保将项目路径标记为可信,例如:[projects."/Users/your-user/software/mcp/mcp-dm8-server"] trust_level = "trusted"在同一文件的
[mcp_servers]段落追加达梦服务定义:[mcp_servers.dm8] command = "node" args = [ "/Users/your-user/software/mcp/mcp-dm8-server/dist/index.js", "--host", "127.0.0.1", "--port", "5236", "--username", "SYSDBA", "--password", "your-password", "--schema", "SYSDBA" ]如果希望在运行时切换配置,可把上述敏感参数改为环境变量并结合
.env,或使用--username等 CLI 参数覆盖。保存后重新启动 Codex CLI 会话(或执行
codex reset)以加载新的 MCP 服务器。随后在 Codex 中执行list_tables/describe_table/execute_query等工具即可访问 DM8。
可用工具说明
工具名 | 描述 | 关键参数 |
| 列出指定 Schema 的所有表 |
|
| 显示列类型、长度、可空属性 |
|
| 执行只读 SQL |
|
所有工具都会对 schema/table 名称做正则校验,并在执行前自动设置 Schema。
开发与测试指南
npm run dev # tsx watch
npm test # Vitest 单元测试
npm run build # 生成 dist + d.ts默认
dmdb.outFormat = dmdb.OUT_FORMAT_OBJECT,如需兼容旧格式可在src/utils/db.ts修改。
常见问题
Q: 驱动安装失败怎么办? 参考达梦官方《Node.js 框架 | 达梦技术文档》,确保系统具备 snappy/snappyjs 等依赖。
Q: 可以执行 DML/DDL 吗? 当前仅允许只读操作,如需扩展请严格控制权限并补充测试。
Q: 如何反馈问题? 在 Issues 提交或发起 PR。
Available Tools
3 toolsdm8_describe_table显示 DM8 表结构B
返回列名、类型、长度以及是否可空信息
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | 数据库 Schema,默认为配置中的 DM_SCHEMA | |
| table | Yes | 表名称 |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided; the description lacks disclosure of behavioral traits such as being read-only, authentication needs, or potential side effects. While it implicitly suggests a read operation, this is not explicitly stated, leaving room for ambiguity.
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 single, efficient sentence that conveys all necessary information without extraneous content. It is well-structured and avoids redundancy.
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?
Given the tool's simplicity and lack of output schema, the description adequately covers what is returned (column names, types, lengths, nullable). However, it might omit additional metadata like default values or precision, leaving minor gaps.
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%, with each parameter having a clear description. However, the tool description adds no further detail beyond the schema, maintaining a baseline score. No additional semantic value provided.
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 explicitly states it returns column name, type, length, and nullable information, which clearly defines the tool's function. It distinguishes from siblings: dm8_list_tables lists table names, dm8_execute_query executes queries, while this tool provides table schema metadata.
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?
No guidance on when to use this tool vs alternatives. The description implies it is for obtaining table structure, but it does not mention situations where dm8_list_tables or dm8_execute_query would be more appropriate, nor any prerequisites or context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm8_execute_query执行 DM8 只读 SQLA
仅允许 SELECT/SHOW/DESCRIBE/EXPLAIN 语句
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | 只读 SQL 语句 | |
| schema | No | 数据库 Schema,默认为配置中的 DM_SCHEMA |
TDQS
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 discloses the core behavioral trait (read-only, allowed statement types) but lacks details on error handling for non-allowed statements, authentication requirements, rate limits, or return format. This is adequate but not comprehensive.
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 single concise sentence that front-loads the key restriction. Every word serves a purpose, with no wasted 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 read-only query execution tool with no output schema, the description provides enough information to understand its purpose and restrictions. However, it could be slightly improved by noting what happens if an invalid statement is submitted, but given the simplicity, it is largely complete.
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% with both parameters described. The description adds meaningful value by specifying the allowed statement types for the query parameter, going beyond the schema's '只读 SQL 语句'. This helps the agent construct valid queries.
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 clearly states the tool executes read-only SQL queries and lists exactly which statement types are allowed (SELECT/SHOW/DESCRIBE/EXPLAIN). This distinguishes it from sibling tools dm8_describe_table and dm8_list_tables, which are more specific table operations.
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 provides clear context that only certain statement types are allowed, implicitly indicating when to use this tool (for custom read-only queries) and when not to (for modifications). However, it does not explicitly mention alternatives or exclusion cases beyond the allowed types.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
dm8_list_tables列出 DM8 数据库中的所有表B
返回指定 Schema 下的所有表名
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | 数据库 Schema,默认为配置中的 DM_SCHEMA |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states the basic operation. It does not disclose default behavior when schema is omitted, error handling, ordering, or permissions. For a listing operation, this leaves agents uncertain about side effects or constraints.
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 single, front-loaded sentence with no wasted words. It efficiently conveys the core functionality.
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 list tool with one optional parameter, the description is mostly adequate. However, it lacks details on output format and what happens if schema is not specified (e.g., uses default schema). An explicit mention of the expected output (e.g., 'list of table names') would improve completeness.
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 input schema is fully covered (100%), and the parameter description clarifies the default value. The tool description adds no additional meaning beyond the schema. Baseline 3 is appropriate.
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 clearly states that the tool returns all table names under a specified Schema, using a specific verb ('返回') and resource ('所有表名'). It distinctly differentiates from siblings: dm8_describe_table describes a specific table and dm8_execute_query runs arbitrary queries.
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?
No guidance is provided on when to use this tool versus the siblings. There is no mention of when not to use it, prerequisites, or alternatives. The description merely states the function without context.
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.
3 tool updates
v1.1.0- First observed
dm8_describe_table - First observed
dm8_execute_query - First observed
dm8_list_tables
TDQS
Each tool has a clearly distinct purpose: listing tables, describing a table's schema, and executing read-only queries. No overlap in functionality.
All tools follow a consistent 'dm8_verb_noun' pattern (e.g., list_tables, describe_table, execute_query). Naming is predictable and uniform.
3 tools is minimal but appropriate for a read-only database inspector. Covers basic operations without being wasteful.
The set covers listing tables, describing a table, and querying data. Lacks operations like retrieving row counts or schema listing, but is adequate for a focused read-only utility.
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
- dataOAuthco.thinair
Read-only PostgreSQL, MySQL, SQL Server access via MCP — 24 dialect-aware hosted tools.
Governed data discovery, exact queries, decisions, simulations, and runtime utilities over MCP.
Query, join, profile, clean and convert CSV/JSON/Parquet with server-side DuckDB over MCP.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with Oracle databases through MCP by executing SELECT queries, describing table structures, and listing available tables with secure, read-only access.3192MIT
- AlicenseNot gradedqualityCmaintenanceEnables SQL query execution and database structure browsing via MCP tools and resources.MIT
- AlicenseNot gradedqualityCmaintenanceRead-only SQL Server MCP server enabling safe database queries, table listing, and schema inspection with built-in security protections.MIT
- AlicenseBqualityCmaintenanceRead-only MCP server for exploring and analyzing SQL Server objects (tables, views, triggers, stored procedures) from Claude Code.8907MIT
Appeared in Searches
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/lianekai/mcp-dm8-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server