Provides standardized tools for inspecting, querying, and interacting with MySQL databases, including executing queries, describing table structures, and retrieving database version information.
Enables connection to SAP IQ (Sybase) databases with intelligent handling of schema prefixes and server names, supporting query execution and database inspection.
SQL MCP Server
The SQL MCP Server is a unified agentic interface that allows AI models (like Claude) to inspect, query, and interact with multiple types of databases through a single, standardized set of tools.
Instead of installing and configuring separate servers for MySQL, SQL Server, Oracle, etc., this single package handles them all by dynamically loading the correct "adapter" based on your configuration.
🚀 Features
Standardized Toolset: The AI always sees the same tools (
execute_query,describe_table,get_db_version), no matter if it's talking to Oracle or MySQL. This reduces hallucinations and improves query accuracy.Resources: Automatically exposes database tables as MCP Resources for easy inspection.
Smart Adapters:
✅ MySQL: Uses
mysql-connector-pythonwith connection pooling.✅ MSSQL: Uses
pymssqland auto-detects schema names (e.g.,dbo.Users).✅ Sybase / SAP IQ: Uses
pyodbcand intelligently handlesdba.prefixes and server names.✅ Oracle: Uses
oracledb(Thin mode) for easy connectivity without complex driver installs.
Unicode Ready: All connections default to UTF-8 to handle special characters seamlessly.
🛠️ Installation
Clone the repository:
git clone https://github.com/BryR0/sql-mcp.git cd sql-mcpCreate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activateInstall dependencies:
pip install -e .
⚙️ Configuration
You define which database to use via the DB_TYPE environment variable.
Supported Environment Variables
Variable | Description | Required | Default |
| Type of DB: | Yes |
|
| Hostname or IP address | Yes |
|
| Database username | Yes |
|
| Database password | Yes | (empty) |
| Database name | Yes |
|
| Port number | No | Auto (3306, 1433, etc.) |
| Connection string (Oracle/Sybase advanced) | No | (empty) |
| Explicit Server Name (Sybase only) | No | (empty) |
Claude Desktop Config Example
Add this to your claude_desktop_config.json. Note that DB_PORT is optional and will default to the standard port for the chosen DB type if omitted.
🏗️ Architecture
The project uses an Adapter Pattern:
Server receives a request (e.g.,
execute_query).Factory checks
DB_TYPEand instantiates the correct class (e.g.,MSSQLAdapter).Adapter translates the generic request into specific driver calls (
pymssql,pyodbc, etc.).Response is formatted back to a standard JSON structure for the AI.
This means you can switch databases just by changing the config, without changing the AI's prompts or logic.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.