RaseSQL MCP Server
A high-performance Model Context Protocol (MCP) server for RaseSQL databases
Features • Installation • Quick Start • API Reference • Configuration
📖 Table of Contents
🔍 Overview
RaseSQL MCP Server is a robust, production-ready Model Context Protocol server that provides secure and efficient interaction with RaseSQL databases. Built with modern Python async/await patterns and optimized for high-performance database operations.
What is MCP?
Model Context Protocol (MCP) is an open standard that enables AI models to securely connect to external data sources and tools. This server implements MCP to provide AI models with direct, controlled access to RaseSQL databases.
✨ Features
🚀 Core Capabilities
- MCP Protocol Support: Full compliance with MCP specification using FastMCP framework
- RaseSQL Optimized: Native support for RaseSQL with
asyncpgdriver - Asynchronous Architecture: High-performance async/await implementation
- Connection Pooling: Intelligent connection management with configurable pool settings
🔧 Database Operations
- Universal SQL Execution: Support for SELECT, INSERT, UPDATE, DELETE, DDL operations
- Table Structure Queries: Detailed schema information retrieval
- Test Data Generation: Built-in tools for generating sample data
- Parameterized Queries: Safe parameter binding to prevent SQL injection
🛡️ Security & Safety
- Query Type Restrictions: Configurable query execution controls
- Parameter Validation: Comprehensive input validation
- Password Protection: Secure credential handling
- Connection Isolation: Instance-based access control
📊 Monitoring & Logging
- Structured Logging: Detailed operation logs with configurable levels
- Connection Pool Monitoring: Real-time pool status tracking
- Error Handling: Comprehensive error reporting and recovery
📋 Prerequisites
- Python: 3.12 or higher
- RaseSQL: 12.0 or higher (tested with 17.6)
- Network Access: Connectivity to RaseSQL server
- Memory: Minimum 512MB RAM recommended
🛠️ Installation
1. Install from PyPI (Recommended)
pip install rasesql-mcp-server
2. Configure Database Connection
Create a dbconfig.json file with your RaseSQL database credentials:
{
"dbPoolSize": 5,
"dbMaxOverflow": 10,
"dbPoolTimeout": 30,
"dbType-Comment": "The database currently in use,such as RASESQL、PostgreSQL DataBases",
"dbList": [
{ "dbInstanceId": "rasesql_1",
"dbHost": "localhost",
"dbPort": 5432,
"dbDatabase": "rasesql_db",
"dbUsername": "root",
"dbPassword": "123456",
"dbType": "RASESQL",
"dbVersion": "2.0",
"dbActive": false
},
{ "dbInstanceId": "postgresql_2",
"dbHost": "localhost",
"dbPort": 5432,
"dbDatabase": "pg_db",
"dbUsername": "root",
"dbPassword": "123456",
"dbType": "PostgreSQL",
"dbVersion": "17.6",
"dbActive": true
}
],
"logPath": "/path/to/logs",
"logLevel": "info"
}
# 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
# dbActive
Only database instances with dbActive set to true in the dbList configuration list are available.
# logPath
Mcp server log is stored in /Volumes/store/mysql_mcp_server/logs/mcp_server.log.
# logLevel
TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL
3. Configure mcp json
{
"mcpServers": {
"rasesql-mcp-client": {
"command": "rasesql-mcp-server",
"env": {
"config_file": "/path/dbconfig.json"
},
"disabled": false
}
}
}
# config_file
dbconfig.json file path in your device
## 📚 API Reference
### MCP Tools
#### `sql_exec(sql: str)`
Execute any SQL statement with automatic result formatting.
**Parameters:**
- `sql` (str): SQL statement to execute
**Returns:**
```json
{
"success": true,
"result": [...], // Query results or affected row count
"message": "SQL executed successfully"
}
Examples:
-- Query data
SELECT * FROM users WHERE age > 18 LIMIT 10;
-- Insert data
INSERT INTO users (name, email) VALUES ('John Doe', 'john@example.com');
-- Update data
UPDATE users SET last_login = NOW() WHERE id = 1;
-- DDL operations
CREATE TABLE products (id SERIAL PRIMARY KEY, name VARCHAR(255));
Metadata
Release files for rasesql-mcp-server 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rasesql_mcp_server-1.1.1.tar.gz | 17.8 kB | Without provenance | Details for rasesql_mcp_server-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rasesql_mcp_server-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for rasesql_mcp_server-1.1.1-py3-none-any.whl |
Total release size: 36.5 kB
Release files / rasesql_mcp_server-1.1.1.tar.gz
| Download URL | rasesql_mcp_server-1.1.1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05029eef4df4c92c036afd91bd3f4ff6e67b95420ccd634c13019427573e71e6
|
|
BLAKE2b-256 checksum How to use checksums |
6a0e5adcb77bdc0428b97d31807624ca46e653f4483a1eee727690fb4c7a7fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / rasesql_mcp_server-1.1.1-py3-none-any.whl
| Download URL | rasesql_mcp_server-1.1.1-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa370303d941496f975e57883f90aa48c9599c2c7a04fbbc6a553ac1fb9594b6
|
|
BLAKE2b-256 checksum How to use checksums |
d9b8df09c13c9c421c11906dd4bb52137c245f28f510c6fa012a0f85bcc2bfe0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for rasesql-mcp-server 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.