xesql-mcp-server


Namexesql-mcp-server JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA Model Context Protocol (MCP) server that enables secure interaction with XeSQL/UbiSQL/MySQL DataBases.
upload_time2025-08-19 07:14:13
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12
licenseNone
keywords mcp xesql mysql tidb oceanbase model-context-protocol async connection-pool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MySQL 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)
```bash
pip install xesql-mcp-server
```

### 2. Configure database connection

Edit `dbconfig.json` with your database credentials:

```json
{
    "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:

```json
{
  "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)
```bash
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
```json
{
  "mcpServers": {
    "xesql-mcp-server": {
      "command": "/bin/uv",
      "args": ["run", "src/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
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "xesql-mcp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": "Frank Jin <j00131120@163.com>",
    "keywords": "mcp, xesql, mysql, tidb, oceanbase, model-context-protocol, async, connection-pool",
    "author": null,
    "author_email": "Frank Jin <j00131120@163.com>",
    "download_url": "https://files.pythonhosted.org/packages/d7/a4/17cd971dc415e4e3fce9d201c2c1469e3ff3c0e0eff4cb15175a5875ee16/xesql_mcp_server-1.0.0.tar.gz",
    "platform": null,
    "description": "# MySQL MCP Server\n\nA 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.\n\n## \u2728 Key Highlights\n\n- **\ud83c\udfd7\ufe0f Professional Architecture**: Modular design with singleton patterns and clean separation of concerns\n- **\u26a1 High Performance**: Full async/await implementation with intelligent connection pooling\n- **\ud83d\udee1\ufe0f Enterprise Security**: Multi-layer security with parameter validation and sensitive data protection\n- **\ud83d\udd27 Universal Compatibility**: Support for 6+ MySQL-compatible database systems\n- **\ud83d\udcca Production Ready**: Comprehensive logging, error handling, and resource management\n- **\ud83c\udfaf MCP Standard**: Built on FastMCP framework with complete MCP protocol compliance\n\n## \ud83d\ude80 Core Features\n\n### **MCP Protocol Implementation**\n- **Standard Tools & Resources**: Complete MCP tool and resource definitions\n- **FastMCP Framework**: Built on robust FastMCP foundation for reliability\n- **Async Communication**: Non-blocking MCP message handling\n\n### **Database Operation Tools**\n- **Universal SQL Execution**: Execute any SQL statement with intelligent type detection\n- **Table Structure Analysis**: Comprehensive table metadata and schema information\n- **Test Data Generation**: Automated test data creation with customizable parameters\n- **Query Optimization**: Smart result handling for different SQL operation types\n\n### **Advanced Architecture**\n- **Singleton Connection Pool**: Efficient resource management with automatic cleanup\n- **Smart Configuration**: Multi-instance support with environment variable override\n- **Async-First Design**: Built from ground up for asynchronous operations\n- **Modular Structure**: Clean separation of tools, resources, utilities, and configuration\n\n## \ud83d\udccb Prerequisites\n\n- Python >= 3.12\n- XeSQL/MySQL/MariaDB/TiDB/OceanBase database instance\n- Network access to database server\n\n## \ud83d\udee0\ufe0f Installation\n\n### 1. Install from PyPI (Recommended)\n```bash\npip install xesql-mcp-server\n```\n\n### 2. Configure database connection\n\nEdit `dbconfig.json` with your database credentials:\n\n```json\n{\n    \"dbPoolSize\": 5,\n    \"dbMaxOverflow\": 10,\n    \"dbPoolTimeout\": 30,\n    \"dbType-Comment\": \"The database currently in use,such as XeSQL/MySQL/MariaDB/UbiSQL OceanBase/RDS/Aurora MySQL DataBases\",\n    \"dbList\": [\n        {   \"dbInstanceId\": \"xesql_1\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 2281,\n            \"dbDatabase\": \"xesql_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"XeSQL\",\n            \"dbVersion\": \"V2.0.0\",\n            \"dbActive\": true\n        },\n        {   \"dbInstanceId\": \"mysql_2\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 3306,\n            \"dbDatabase\": \"mysql_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"MySQL\",\n            \"dbVersion\": \"8.0\",\n            \"dbActive\": false\n        },\n        {   \"dbInstanceId\": \"tidb_3\",\n            \"dbHost\": \"localhost\",\n            \"dbPort\": 4000,\n            \"dbDatabase\": \"tidb_db\",\n            \"dbUsername\": \"root\",\n            \"dbPassword\": \"123456\",\n            \"dbType\": \"UbiSQL\",\n            \"dbVersion\": \"8.5.3\",\n            \"dbActive\": false\n        }\n    ],\n    \"logPath\": \"/path/to/logs\",\n    \"logLevel\": \"info\"\n}\n# dbType\nOceanbase Instance is in MySQL/MariaDB/TiDB OceanBase/RDS/Aurora MySQL DataBases.\n# dbActive\nOnly database instances with dbActive set to true in the dbList configuration list are available. \n# logPath\nMCP server log is stored in /path/to/logs/mcp_server.log.\n# logLevel\nTRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL\n```\n\n### 3. Configure MCP Client\n\nAdd to your MCP client configuration file:\n\n```json\n{\n  \"mcpServers\": {\n    \"xesql-mcp-client\": {\n      \"command\": \"xesql-mcp-server\",\n      \"env\": {\n        \"config_file\": \"/path/to/your/dbconfig.json\"\n      },\n      \"disabled\": false\n    }\n  }\n}\n```\n\n**Note**: Replace `/path/to/your/dbconfig.json` with the actual path to your configuration file.\n\n### 4. Clone the repository (Development Mode)\n```bash\ngit clone https://github.com/j00131120/mcp_database_server.git\ncd mcp_database_server/xesql_mcp_server\n# Import project into your IDE\n```\n\n### 5. Configure MCP Client for Development\n```json\n{\n  \"mcpServers\": {\n    \"xesql-mcp-server\": {\n      \"command\": \"/bin/uv\",\n      \"args\": [\"run\", \"src/server.py\"],\n      \"cwd\": \"/path/to/your/project\",\n      \"env\": {\n        \"config_file\": \"/path/to/your/dbconfig.json\"\n      },\n      \"disabled\": false,\n      \"autoApprove\": [\"describe_table\", \"sql_exec\", \"generate_demo_data\"]\n    }\n  }\n}\n\n# command\nuv absolute path\n# cwd\nproject absolute path\n# config_file\ndbconfig.json file path\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Model Context Protocol (MCP) server that enables secure interaction with XeSQL/UbiSQL/MySQL DataBases.",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://gitee.com/frankjin/mcp-server/issues",
        "Changelog": "https://gitee.com/frankjin/mcp-server/tree/master/xesql_mcp_server/CHANGELOG.md",
        "Documentation": "https://gitee.com/frankjin/mcp-server/tree/master/xesql_mcp_server/README.md",
        "Download": "https://gitee.com/frankjin/mcp-server/tree/master/xesql_mcp_server",
        "Homepage": "https://gitee.com/frankjin/mcp-server",
        "Repository": "https://gitee.com/frankjin/mcp-server.git",
        "Source Code": "https://gitee.com/frankjin/mcp-server/tree/master/xesql_mcp_server"
    },
    "split_keywords": [
        "mcp",
        " xesql",
        " mysql",
        " tidb",
        " oceanbase",
        " model-context-protocol",
        " async",
        " connection-pool"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5a707876cada4a1476746f79e5e2e9b6f39724513f01772b896fd97e574104ad",
                "md5": "a47dcbcb8d297c41accb04e9f7c280d2",
                "sha256": "7c63aa7e6815adc3beb9297336711981f92649ef015565d28768b41e9c890a40"
            },
            "downloads": -1,
            "filename": "xesql_mcp_server-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a47dcbcb8d297c41accb04e9f7c280d2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 17113,
            "upload_time": "2025-08-19T07:14:12",
            "upload_time_iso_8601": "2025-08-19T07:14:12.562058Z",
            "url": "https://files.pythonhosted.org/packages/5a/70/7876cada4a1476746f79e5e2e9b6f39724513f01772b896fd97e574104ad/xesql_mcp_server-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d7a417cd971dc415e4e3fce9d201c2c1469e3ff3c0e0eff4cb15175a5875ee16",
                "md5": "2a9cbaceb39e94af52ab5426a02594b3",
                "sha256": "4f67ce8c409f530f6c8c199494d178acb7d9c0806b5235a4b61daf23cd84851f"
            },
            "downloads": -1,
            "filename": "xesql_mcp_server-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2a9cbaceb39e94af52ab5426a02594b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 16868,
            "upload_time": "2025-08-19T07:14:13",
            "upload_time_iso_8601": "2025-08-19T07:14:13.852473Z",
            "url": "https://files.pythonhosted.org/packages/d7/a4/17cd971dc415e4e3fce9d201c2c1469e3ff3c0e0eff4cb15175a5875ee16/xesql_mcp_server-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 07:14:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "xesql-mcp-server"
}
        
Elapsed time: 0.45196s