SQL MCP Server
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.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SQL MCP Servershow me the top 10 customers by total orders"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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.
Related MCP server: Universal SQL MCP Server
🛠️ 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.
{
"mcpServers": {
"sql_mcp_mysql": {
"command": "C:\\path\\to\\venv\\python.exe",
"args": ["-m", "sql_mcp"],
"env": {
"DB_TYPE": "mysql",
"DB_HOST": "localhost",
"DB_USER": "root",
"DB_PASSWORD": "password",
"DB_DATABASE": "my_db"
}
},
"sql_mcp_mssql": {
"command": "C:\\path\\to\\venv\\python.exe",
"args": ["-m", "sql_mcp"],
"env": {
"DB_TYPE": "mssql",
"DB_HOST": "192.168.1.50",
"DB_USER": "sa",
"DB_PASSWORD": "password",
"DB_DATABASE": "DataWarehouse"
}
}
}
}🏗️ 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.
This server cannot be deployed
Maintenance
Related MCP Connectors
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
PostgreSQL, MySQL, OpenAPI/Swagger, and shared Agent Memory with scoped access.
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI models to perform MySQL database operations through a standardized interface, supporting secure connections, query execution, and comprehensive schema management.7158 npm33MIT
- AlicenseNot gradedqualityDmaintenanceEnables secure interaction with multiple SQL database engines (MySQL, PostgreSQL, SQLite, SQL Server) through a standardized interface. Supports schema inspection, safe query execution, and controlled write operations with built-in security restrictions.5MIT
- AlicenseAqualityCmaintenanceEnables LLMs to interact with MySQL databases through standardized protocol, supporting database management, table operations, data queries, and modifications with configurable permission controls.1548 npm1MIT
- AlicenseNot gradedqualityDmaintenanceProvides universal database operations for AI assistants through MCP, supporting 40+ databases including PostgreSQL, MySQL, MongoDB, Redis, and SQLite with built-in introspection tools for schema exploration.7 npmMIT