DaMeng MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
DaMeng MCP Server
A Model Context Protocol (MCP) server for DaMeng (达梦) Database, enabling LLMs to interact with DaMeng databases through standardized tools and resources.
Features
SQL Query Execution: Execute any SQL query on DaMeng database
Table Resources: Access database tables as MCP resources
Schema Discovery: Automatically discover and list available tables
Connection Pooling: Efficient database connection management
Error Handling: Comprehensive error handling and logging
Type Hints: Full type annotations for better IDE support
Related MCP server: Doris-MCP-Lite
Installation
Prerequisites
Python 3.9 or higher
DaMeng Database server running
dmPython driver installed
Install from source
git clone https://github.com/yourusername/dameng-mcp-server.git
cd dameng-mcp-server
pip install -e .Install dependencies
pip install -r requirements.txtInstall dmPython Driver
pip install dmPythonOr download from DaMeng Official Website
Configuration
Create a .env file in the project root:
# Database Configuration
DAMENG_HOST=localhost
DAMENG_PORT=5236
DAMENG_USER=SYSDBA
DAMENG_PASSWORD=your_password
DAMENG_DATABASE=your_schema
# Optional: Logging
LOG_LEVEL=INFOUsage
Running the Server
python -m dameng_mcp_serverUsing with Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"dameng": {
"command": "python",
"args": ["-m", "dameng_mcp_server"],
"env": {
"DAMENG_HOST": "localhost",
"DAMENG_PORT": "5236",
"DAMENG_USER": "SYSDBA",
"DAMENG_PASSWORD": "your_password"
}
}
}
}Usage
Using the Python Client
An interactive Python client is provided with AI capabilities:
cd examples
python mcp_client.pyThe client supports the following commands:
/sql <query>- Execute SQL directly/tables [pattern]- List tables/describe <table>- Describe table structure/schemas [pattern]- List schemas/quit- Exit
Using with Claude Desktop
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"dameng": {
"command": "python",
"args": ["-m", "dameng_mcp_server"],
"env": {
"DAMENG_HOST": "localhost",
"DAMENG_PORT": "5236",
"DAMENG_USER": "SYSDBA",
"DAMENG_PASSWORD": "your_password"
}
}
}
}Basic Python Usage
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
async def main():
server_params = StdioServerParameters(
command="python",
args=["-m", "dameng_mcp_server"]
)
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
# Initialize session
await session.initialize()
# List available tools
tools = await session.list_tools()
print(f"Available tools: {[t.name for t in tools.tools]}")
# Execute a query
result = await session.call_tool(
"execute_sql",
{"query": "SELECT * FROM your_table LIMIT 10"}
)
print(result.content[0].text)
asyncio.run(main())Available Tools
execute_sql
Execute SQL queries on the DaMeng database.
Parameters:
query(string, required): The SQL query to execute
Example:
result = await session.call_tool("execute_sql", {
"query": "SELECT COUNT(*) FROM users"
})list_tables
List all tables in the database.
Parameters:
pattern(string, optional): Filter table names by pattern (e.g., 'SYS%')
Example:
result = await session.call_tool("list_tables", {
"pattern": "SYS%"
})describe_table
Get detailed information about a table's structure.
Parameters:
table_name(string, required): The name of the table
Example:
result = await session.call_tool("describe_table", {
"table_name": "SYSUSER"
})get_schema_info
Get information about database schemas.
Parameters:
schema_pattern(string, optional): Filter schemas by pattern
Example:
result = await session.call_tool("get_schema_info", {
"schema_pattern": "SYS%"
})Available Resources
Database tables are exposed as resources with the URI pattern:
dameng://{table_name}/dataExample:
# Read a table as a resource
resource = await session.read_resource("dameng://users/data")Development
Running Tests
pytest tests/Code Formatting
black src/
isort src/Type Checking
mypy src/Project Structure
dameng-mcp-server/
├── src/
│ └── dameng_mcp_server/
│ ├── __init__.py
│ ├── server.py # Main MCP server implementation
│ ├── config.py # Configuration management
│ ├── database.py # Database connection handling
│ └── tools.py # MCP tool definitions
├── tests/
│ ├── __init__.py
│ ├── test_server.py
│ └── test_database.py
├── examples/
│ ├── basic_client.py # Basic usage example
│ └── advanced_client.py # Advanced usage example
├── docs/
│ ├── installation.md
│ └── api.md
├── .env.example # Example environment variables
├── .gitignore
├── LICENSE
├── README.md
├── pyproject.toml # Project configuration
└── requirements.txt # DependenciesAPI Reference
Server Configuration
Environment Variable | Description | Default |
| Database host |
|
| Database port |
|
| Database user |
|
| Database password | (required) |
| Database/schema name |
|
Debugging
Quick Debug
Run the built-in debug script:
python debug.pyThis will check:
Python version
Dependencies
Environment configuration
Database connection
Project structure
For detailed debugging guide, see DEBUGGING.md.
Troubleshooting
Connection Issues
Verify DaMeng database is running:
# Check if port 5236 is accessible
telnet localhost 5236Check credentials in
.envfileEnable debug logging:
LOG_LEVEL=DEBUGCommon Errors
Missing dmPython: Install with
pip install dmPythonConnection refused: Check DAMENG_HOST and DAMENG_PORT
Authentication failed: Verify DAMENG_USER and DAMENG_PASSWORD
Contributing
Contributions are welcome! Please:
Fork the repository
Create a feature branch
Make your changes
Add tests
Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Model Context Protocol - The protocol specification
DaMeng Database - The database system
dmPython - The Python driver
Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Roadmap
Add connection pooling support
Implement transaction management tools
Add query result caching
Support for prepared statements
Add streaming result support
Implement database backup/restore tools
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
The AI that understands raw data: Schema over your tables and databases, as MCP tools.
List datasets, schemas, run APL queries, and use prompts for exploration, anomalies, and monitoring.
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Dameng databases through natural language or direct SQL operations. Provides a web interface for listing tables, executing queries, and viewing table structures with MCP protocol support for AI model integration.1-
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to explore database schemas, execute read-only SQL queries, and perform data analysis on Apache Doris or MySQL-compatible databases through a standardized MCP interface with built-in analytical prompts.1MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for DaMeng database, enabling AI assistants to execute SQL queries, list tables, describe table structures, and retrieve schema information.31 npm7MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Dameng databases through MCP, supporting query execution, schema exploration, and connection management.MIT