MS SQL Server MCP Server v2.1.1
š Model Context Protocol (MCP) server for Microsoft SQL Server - compatible with Claude Desktop, Cursor, Windsurf and VS Code.
š Quick Start
1. Install
2. Configure IDE
Claude Desktop (claude_desktop_config.json):
Cursor/Windsurf/VS Code (.vscode/mcp.json):
Replace with your actual database credentials.
š ļø Available Tools
Tool | Description |
| Connect to database using environment variables |
| Close current database connection |
| Check connection state with pool info |
| Execute any SQL query with parameters |
| List database objects (tables, views, procedures) |
| Get detailed table structure |
| Retrieve data with pagination |
| Execute stored procedures |
| List all databases |
š§ Environment Variables
Variable | Required | Default | Description |
| ā | - | SQL Server hostname |
| ā | - | Database name |
| ā | - | Username |
| ā | - | Password |
| ā | 1433 | SQL Server port |
| ā | true | Enable TLS encryption (required for Azure SQL) |
| ā | false | Trust self-signed certificates |
| ā | 30000 | Connection timeout (ms) |
| ā | 30000 | Request timeout (ms) |
Azure SQL Configuration
For Azure SQL Database, use these settings:
Local SQL Server (Self-signed cert)
For local development with self-signed certificates:
š Features
ā MCP SDK 1.25.1: Latest Model Context Protocol SDK
ā Azure SQL Compatible: TLS encryption enabled by default
ā Complete SQL Support: All database operations
ā Parameterized Queries: SQL injection protection
ā Connection Pooling: Efficient resource management
ā Performance Monitoring: Execution time tracking
š Usage Examples
Connect to Database
Execute a Query
Get Table Schema
š Troubleshooting
ā Connection failed
Verify all required environment variables are set
Check server accessibility and credentials
Ensure network connectivity to SQL Server
ā SSL/Certificate errors
For Azure SQL: Set
DB_ENCRYPT=true(default)For self-signed certs: Set
DB_TRUST_SERVER_CERTIFICATE=trueFor local dev without encryption: Set
DB_ENCRYPT=false
š Version History
v2.1.1 - Latest
ā Added
DB_ENCRYPTenvironment variable (Issue #1)ā Azure SQL Database compatibility improved
ā Encryption enabled by default (
DB_ENCRYPT=true)ā Fixed
DB_TRUST_SERVER_CERTIFICATEdefault tofalse
v2.1.0
ā Updated to MCP SDK 1.25.1
ā Migrated to
registerTool()/registerResource()APIā Added tool titles for better UI display
v2.0.3
ā Documentation improvements
š License
MIT License
š Support
Issues: GitHub Issues
Repository: BYMCS/mssql-mcp
š v2.1.1: Azure SQL compatibility with DB_ENCRYPT support