MCP ExplorerExplorer

Dm Mcp Server

@wangzhaobo168on a year ago
3 MIT
FreeCommunity
AI Systems
dm-mcp-server is a service for DaMeng database providing table listing, read-only SQL execution, and table structure display.

Overview

What is Dm Mcp Server

dm-mcp-server is a Microservice Communication Protocol service based on the Dameng Database, providing functionalities such as listing database tables, executing read-only SQL queries, and displaying table structures.

Use cases

Use cases for dm-mcp-server include database management tasks, integration with other microservices for data retrieval, and providing a lightweight interface for executing SQL queries.

How to use

To use dm-mcp-server, download the binary for Windows or install it via Go by running ‘go install github.com/wangzhaobo168/dm-mcp-server’. Configure the database connection through command-line arguments or environment variables before starting the service.

Key features

Key features include listing tables in the database, executing read-only SQL queries (only supporting SELECT, SHOW, DESCRIBE, and EXPLAIN statements), and displaying the structure of specified tables.

Where to use

dm-mcp-server can be used in environments where the Dameng Database is deployed, particularly in microservices architecture for database interactions.

Content


达梦数据库 MCP 服务

项目简介

本项目是一个基于达梦数据库的 MCP(Microservice Communication Protocol)服务,提供了以下功能:

  • 列出数据库中的表:通过 list_tables 工具列出指定数据库中的所有表。
  • 执行只读 SQL 查询:通过 execute_query 工具执行只读 SQL 查询(仅支持 SELECTSHOWDESCRIBEEXPLAIN 语句)。
  • 显示表结构:通过 describe_table 工具显示指定表的结构。

使用方法

windows 下可以直接下载 dm-mcp-server 二进制文件,并添加到 PATH 中。

使用 go install 安装

go install github.com/wangzhaobo168/dm-mcp-server

达梦MCP Server 配置示例:

{
    "mcpServers": {
        "db-mcp-server": {
        "command": "dm-mcp-server",
        "args": [
        ],
        "env": {
            "DM_PORT": "端口号,默认5236",
            "DM_HOST": "主机地址",
            "DM_USERNAME": "账号",
            "DM_PASSWORD": "密码",
            "DM_SCHEMA": "模式名"
        }
    }
}

检查 dm-mcp-server 版本:

dm-mcp-server --version

快速开始

1. 环境要求

  • Go 版本:1.16 或更高版本。
  • 达梦数据库:已安装并配置好达梦数据库。
  • 依赖库:确保安装了 github.com/mark3labs/mcp-go 库。

2. 安装依赖

在项目根目录下运行以下命令初始化 Go Modules 并下载依赖:

go mod init dm-mcp-server
go mod tidy

3. 配置数据库连接

在运行服务之前,需要配置达梦数据库的连接信息。可以通过以下方式设置:

  • 命令行参数:启动服务时通过命令行参数指定。
  • 环境变量:通过环境变量设置。

命令行参数

go run main.go \
  -username <用户名> \
  -password <密码> \
  -host <主机地址> \
  -port <端口> \
  -schema <模式名>

项目结构

dm-mcp-server/
├── main.go                # 主程序入口
├── tools/                 # 工具实现
│   ├── list_tables.go     # 列出表工具
│   ├── execute_query.go   # 执行查询工具
│   └── describe_table.go  # 显示表结构工具
├── utils/                 # 工具函数
│   ├── config.go          # 配置管理
│   └── db.go              # 数据库连接
├── go.mod                 # Go Modules 文件
└── README.md              # 项目文档

贡献指南

欢迎提交 Issue 和 Pull Request 来改进本项目。请确保代码风格一致,并通过测试。

许可证

本项目采用 MIT 许可证


补充说明

  • 如果 github.com/mark3labs/mcp-go 库不可用,请替换为其他兼容的 MCP 实现。
  • 如果需要支持更多数据库操作,可以在 tools 包中添加新的工具。

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers