home / mcp / mcp sql server pro mcp server
Provides direct SQL access to Microsoft SQL Server databases with CRUD and DDL operations through a single MCP tool.
Configuration
View docs{
"mcpServers": {
"adarsh-bhayani-mcp-sqlserver-pro": {
"command": "python",
"args": [
"src/server.py"
],
"env": {
"MSSQL_PORT": "1433",
"MSSQL_USER": "your-username",
"AUTH_METHOD": "sql",
"MSSQL_SERVER": "your-server-hostname-or-ip",
"MSSQL_DATABASE": "your-database-name",
"MSSQL_PASSWORD": "your-password",
"TrustServerCertificate": "yes"
}
}
}
}You can manage Microsoft SQL Server data directly from an MCP client using MCP SQL Server Pro. It exposes a single, powerful database tool that lets you run raw SQL with full CRUD and DDL capabilities, enabling you to query, modify, create, and maintain database objects securely and efficiently from your preferred AI assistant or MCP client.
Use the MCP SQL Server Pro server with an MCP client to run direct SQL against your SQL Server database. You can perform data retrieval with SELECT, insert and update records, delete rows, and define or alter database objects such as tables, views, procedures, and functions. Combine SQL statements to implement complex analytics, maintenance, and schema changes, then receive structured results or execution feedback from the MCP client.
Prerequisites include Python 3.8 or higher, the pip package installer, and the Microsoft ODBC Driver 18 for SQL Server. You also need access to a Microsoft SQL Server instance (local or remote) and network connectivity to it.
Step-by-step installation if you are setting up locally: 1. Create a project directory 2. Create and activate a Python virtual environment 3. Install required Python packages 4. Verify the ODBC driver installation 5. Prepare configuration for the SQL Server connection 6. Start the MCP server from your environment with proper environment variables
Concrete commands you can run:
```
# Create project directory
mkdir mcp-sqlserver-pro
cd mcp-sqlserver-pro
# Create virtual environment
python3 -m venv venv
# Activate virtual environment
# Linux/macOS:
source venv/bin/activate
# Windows:
venv\Scripts\activate
# Install dependencies
pip install pyodbc>=4.0.39
pip install pydantic>=2.0.0
pip install python-dotenv>=1.0.1
pip install mcp>=1.2.0
pip install anyio>=4.5.0
```
```
# Verify ODBC driver availability
python -c "import pyodbc; print(pyodbc.drivers())"
```
Then configure your connection and start the server using the path to the server script as shown in the integration examples.Configure a connection to SQL Server by creating an environment file with values for your server, database, and authentication. The settings below show the required fields and two common auth methods.
Required environment values:
```
MSSQL_SERVER=your-server-hostname-or-ip
MSSQL_DATABASE=your-database-name
AUTH_METHOD=sql # or windows
MSSQL_PORT=1433
MSSQL_DRIVER={ODBC Driver 18 for SQL Server}
TrustServerCertificate=yes
```
Additionally, if you use SQL Server authentication, provide username and password:
```
MSSQL_USER=your-username
MSSQL_PASSWORD=your-passwordFollow security guidelines to protect database access. Use strong passwords, prefer Windows Authentication when possible, assign minimal permissions to the MCP service account, and enable SSL/TLS for remote connections. Restrict access by IP where feasible and store credentials securely in an encrypted environment or secret manager.
If you encounter connection or startup issues, verify the following: the server address and port are correct, the SQL Server instance is online, and firewall rules allow access. Ensure the ODBC driver is installed and visible to Python, and confirm the virtual environment is active when launching the server. Review common errors and ensure you are using the correct authentication method for your SQL Server configuration.
You interact with MCP SQL Server Pro through an MCP client by initiating a server process that listens for requests and executes SQL against your SQL Server database. Use parameterized queries and proper input validation to minimize risks and ensure reliable error reporting.
Single database tool with four core operations to CREATE, READ, UPDATE, and DELETE data, as well as supporting DDL statements to manage tables, views, procedures, and more.