Content
---
# DM Database MCP Server
## Project Introduction
This project is a MCP (Microservice Communication Protocol) server based on DM database, providing the following functions:
- **List tables in the database**: List all tables in the specified database through the `list_tables` tool.
- **Execute read-only SQL queries**: Execute read-only SQL queries through the `execute_query` tool (only `SELECT`, `SHOW`, `DESCRIBE` and `EXPLAIN` statements are supported).
- **Show table structure**: Show the structure of the specified table through the `describe_table` tool.
## Usage
You can directly download the dm-mcp-server binary file under windows and add it to PATH.
### Install with go install
```bash
go install github.com/wangzhaobo168/dm-mcp-server
```
### DM MCP Server Configuration Example:
```
{
"mcpServers": {
"db-mcp-server": {
"command": "dm-mcp-server",
"args": [
],
"env": {
"DM_PORT": "Port number, default is 5236",
"DM_HOST": "Host address",
"DM_USERNAME": "Account",
"DM_PASSWORD": "Password",
"DM_SCHEMA": "Schema name"
}
}
}
```
## Check dm-mcp-server version:
```bash
dm-mcp-server --version
```
## Quick Start
### 1. Environment Requirements
- **Go Version**: 1.16 or higher.
- **DM Database**: DM database has been installed and configured.
- **Dependency Library**: Make sure the `github.com/mark3labs/mcp-go` library is installed.
### 2. Install Dependencies
Run the following command in the project root directory to initialize Go Modules and download dependencies:
```bash
go mod init dm-mcp-server
go mod tidy
```
### 3. Configure Database Connection
Before running the service, you need to configure the DM database connection information. You can set it in the following ways:
- **Command Line Parameters**: Specify through command line parameters when starting the service.
- **Environment Variables**: Set through environment variables.
#### Command Line Parameters
```bash
go run main.go \
-username <username> \
-password <password> \
-host <host address> \
-port <port> \
-schema <schema name>
```
## Project Structure
```
dm-mcp-server/
├── main.go # Main program entry
├── tools/ # Tool implementation
│ ├── list_tables.go # List table tool
│ ├── execute_query.go # Execute query tool
│ └── describe_table.go # Show table structure tool
├── utils/ # Tool function
│ ├── config.go # Configuration management
│ └── db.go # Database connection
├── go.mod # Go Modules file
└── README.md # Project documentation
```
## Contribution Guidelines
Welcome to submit Issues and Pull Requests to improve this project. Please ensure that the code style is consistent and pass the test.
## License
This project is licensed under the [MIT License](LICENSE).
---
### Additional Instructions
- If the `github.com/mark3labs/mcp-go` library is not available, please replace it with another compatible MCP implementation.
- If you need to support more database operations, you can add new tools in the `tools` package.
---
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
markitdown
Python tool for converting files and office documents to Markdown.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
TrendRadar
TrendRadar: Your hotspot assistant for real news in just 30 seconds.