XeSQL MCP Server
A high-performance Model Context Protocol (MCP) server that enables secure and efficient interaction with MySQL-compatible databases including MySQL, MariaDB, TiDB, OceanBase, AWS RDS, and Aurora MySQL.
✨ Key Highlights
- 🏗️ Professional Architecture: Modular design with singleton patterns and clean separation of concerns
- ⚡ High Performance: Full async/await implementation with intelligent connection pooling
- 🛡️ Enterprise Security: Multi-layer security with parameter validation and sensitive data protection
- 🔧 Universal Compatibility: Support for 6+ MySQL-compatible database systems
- 📊 Production Ready: Comprehensive logging, error handling, and resource management
- 🎯 MCP Standard: Built on FastMCP framework with complete MCP protocol compliance
🚀 Core Features
MCP Protocol Implementation
- Standard Tools & Resources: Complete MCP tool and resource definitions
- FastMCP Framework: Built on robust FastMCP foundation for reliability
- Async Communication: Non-blocking MCP message handling
Database Operation Tools
- Universal SQL Execution: Execute any SQL statement with intelligent type detection
- Table Structure Analysis: Comprehensive table metadata and schema information
- Test Data Generation: Automated test data creation with customizable parameters
- Query Optimization: Smart result handling for different SQL operation types
Advanced Architecture
- Singleton Connection Pool: Efficient resource management with automatic cleanup
- Smart Configuration: Multi-instance support with environment variable override
- Async-First Design: Built from ground up for asynchronous operations
- Modular Structure: Clean separation of tools, resources, utilities, and configuration
📋 Prerequisites
- Python >= 3.12
- XeSQL/MySQL/MariaDB/TiDB/OceanBase database instance
- Network access to database server
🛠️ Installation
1. Install from PyPI (Recommended)
pip install xesql-mcp-server
2. Configure database connection
Edit dbconfig.json with your database credentials:
{
"dbPoolSize": 5,
"dbMaxOverflow": 10,
"dbPoolTimeout": 30,
"dbType-Comment": "The database currently in use,such as XeSQL/MySQL/MariaDB/UbiSQL OceanBase/RDS/Aurora MySQL DataBases",
"dbList": [
{ "dbInstanceId": "xesql_1",
"dbHost": "localhost",
"dbPort": 2281,
"dbDatabase": "xesql_db",
"dbUsername": "root",
"dbPassword": "123456",
"dbType": "XeSQL",
"dbVersion": "V2.0.0",
"dbActive": true
},
{ "dbInstanceId": "mysql_2",
"dbHost": "localhost",
"dbPort": 3306,
"dbDatabase": "mysql_db",
"dbUsername": "root",
"dbPassword": "123456",
"dbType": "MySQL",
"dbVersion": "8.0",
"dbActive": false
},
{ "dbInstanceId": "tidb_3",
"dbHost": "localhost",
"dbPort": 4000,
"dbDatabase": "tidb_db",
"dbUsername": "root",
"dbPassword": "123456",
"dbType": "UbiSQL",
"dbVersion": "8.5.3",
"dbActive": false
}
],
"logPath": "/path/to/logs",
"logLevel": "info"
}
# dbType
Oceanbase Instance is in MySQL/MariaDB/TiDB OceanBase/RDS/Aurora MySQL DataBases.
# dbActive
Only database instances with dbActive set to true in the dbList configuration list are available.
# logPath
MCP server log is stored in /path/to/logs/mcp_server.log.
# logLevel
TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL
3. Configure MCP Client
Add to your MCP client configuration file:
{
"mcpServers": {
"xesql-mcp-client": {
"command": "xesql-mcp-server",
"env": {
"config_file": "/path/to/your/dbconfig.json"
},
"disabled": false
}
}
}
Note: Replace /path/to/your/dbconfig.json with the actual path to your configuration file.
4. Clone the repository (Development Mode)
git clone https://github.com/j00131120/mcp_database_server.git
cd mcp_database_server/xesql_mcp_server
# Import project into your IDE
5. Configure MCP Client for Development
{
"mcpServers": {
"xesql-mcp-server": {
"command": "/bin/uv",
"args": ["run", "xesql_mcp_server/server.py"],
"cwd": "/path/to/your/project",
"env": {
"config_file": "/path/to/your/dbconfig.json"
},
"disabled": false,
"autoApprove": ["describe_table", "sql_exec", "generate_demo_data"]
}
}
}
# command
uv absolute path
# cwd
project absolute path
# config_file
dbconfig.json file path
Metadata
Release files for xesql-mcp-server 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xesql_mcp_server-1.0.3.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xesql_mcp_server-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / xesql_mcp_server-1.0.3.tar.gz
| Download URL | xesql_mcp_server-1.0.3.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3dcdbad81e91bd286020f35711ff2a39ac1199a1340101e5cabddc9ce6e874e9
|
|
BLAKE2b-256 checksum How to use checksums |
aab7cde68402483110feb7d0b49102443b24f7be793a270d13d211f705ac78ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / xesql_mcp_server-1.0.3-py3-none-any.whl
| Download URL | xesql_mcp_server-1.0.3-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2f80236a9d26401fd023dbf8ef0debd034bdbdfe7f81eaf6149ccdf328993385
|
|
BLAKE2b-256 checksum How to use checksums |
9af8f9d6fdf01c6074a89e0fdf7a1892d27ee1febdbc72625f989519d70d9794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|