$git clone https://github.com/RichardHan/mssql_mcp_serverA Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.
| 1 | # Microsoft SQL Server MCP Server |
| 2 | |
| 3 | [](https://pypi.org/project/microsoft_sql_server_mcp/) |
| 4 | [](https://opensource.org/licenses/MIT) |
| 5 | |
| 6 | <a href="https://glama.ai/mcp/servers/29cpe19k30"> |
| 7 | <img width="380" height="200" src="https://glama.ai/mcp/servers/29cpe19k30/badge" alt="Microsoft SQL Server MCP server" /> |
| 8 | </a> |
| 9 | |
| 10 | A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop. |
| 11 | |
| 12 | ## Features |
| 13 | |
| 14 | - 🔍 List database tables |
| 15 | - 📊 Execute SQL queries (SELECT, INSERT, UPDATE, DELETE) |
| 16 | - 🔐 Multiple authentication methods (SQL, Windows, Azure AD) |
| 17 | - 🏢 LocalDB and Azure SQL support |
| 18 | - 🔌 Custom port configuration |
| 19 | |
| 20 | ## Quick Start |
| 21 | |
| 22 | ### Install with Claude Desktop |
| 23 | |
| 24 | Add to your `claude_desktop_config.json`: |
| 25 | |
| 26 | ```json |
| 27 | { |
| 28 | "mcpServers": { |
| 29 | "mssql": { |
| 30 | "command": "uvx", |
| 31 | "args": ["microsoft_sql_server_mcp"], |
| 32 | "env": { |
| 33 | "MSSQL_SERVER": "localhost", |
| 34 | "MSSQL_DATABASE": "your_database", |
| 35 | "MSSQL_USER": "your_username", |
| 36 | "MSSQL_PASSWORD": "your_password" |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | } |
| 41 | ``` |
| 42 | |
| 43 | ## Configuration |
| 44 | |
| 45 | ### Basic SQL Authentication |
| 46 | ```bash |
| 47 | MSSQL_SERVER=localhost # Required |
| 48 | MSSQL_DATABASE=your_database # Required |
| 49 | MSSQL_USER=your_username # Required for SQL auth |
| 50 | MSSQL_PASSWORD=your_password # Required for SQL auth |
| 51 | ``` |
| 52 | |
| 53 | ### Windows Authentication |
| 54 | ```bash |
| 55 | MSSQL_SERVER=localhost |
| 56 | MSSQL_DATABASE=your_database |
| 57 | MSSQL_WINDOWS_AUTH=true # Use Windows credentials |
| 58 | ``` |
| 59 | |
| 60 | ### Azure SQL Database |
| 61 | ```bash |
| 62 | MSSQL_SERVER=your-server.database.windows.net |
| 63 | MSSQL_DATABASE=your_database |
| 64 | MSSQL_USER=your_username |
| 65 | MSSQL_PASSWORD=your_password |
| 66 | # Encryption is automatic for Azure |
| 67 | ``` |
| 68 | |
| 69 | ### Optional Settings |
| 70 | ```bash |
| 71 | MSSQL_PORT=1433 # Custom port (default: 1433) |
| 72 | MSSQL_ENCRYPT=true # Force encryption |
| 73 | ``` |
| 74 | |
| 75 | ## Alternative Installation Methods |
| 76 | |
| 77 | ### Using pip |
| 78 | ```bash |
| 79 | pip install microsoft_sql_server_mcp |
| 80 | ``` |
| 81 | |
| 82 | Then in `claude_desktop_config.json`: |
| 83 | ```json |
| 84 | { |
| 85 | "mcpServers": { |
| 86 | "mssql": { |
| 87 | "command": "python", |
| 88 | "args": ["-m", "mssql_mcp_server"], |
| 89 | "env": { ... } |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | ``` |
| 94 | |
| 95 | ### Development |
| 96 | ```bash |
| 97 | git clone https://github.com/RichardHan/mssql_mcp_server.git |
| 98 | cd mssql_mcp_server |
| 99 | pip install -e . |
| 100 | ``` |
| 101 | |
| 102 | ## Security |
| 103 | |
| 104 | - Create a dedicated SQL user with minimal permissions |
| 105 | - Never use admin/sa accounts |
| 106 | - Use Windows Authentication when possible |
| 107 | - Enable encryption for sensitive data |
| 108 | |
| 109 | ## License |
| 110 | |
| 111 | MIT |