https://github.com/richardhan/mssql_mcp_server
A Model Context Protocol (MCP) server for Microsoft SQL Server that enables secure database interactions through a controlled interface. Allows AI assistants to safely list tables, read data, and execute SQL queries while maintaining security and structure.
https://github.com/richardhan/mssql_mcp_server
Last synced: 4 months ago
JSON representation
A Model Context Protocol (MCP) server for Microsoft SQL Server that enables secure database interactions through a controlled interface. Allows AI assistants to safely list tables, read data, and execute SQL queries while maintaining security and structure.
- Host: GitHub
- URL: https://github.com/richardhan/mssql_mcp_server
- Owner: RichardHan
- License: mit
- Created: 2025-01-05T14:37:51.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-05-19T15:02:06.000Z (6 months ago)
- Last Synced: 2025-06-17T13:16:59.548Z (5 months ago)
- Language: Python
- Size: 28.3 KB
- Stars: 143
- Watchers: 4
- Forks: 39
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- toolsdk-mcp-registry - ❌ microsoft-sql-server-(mssql)
README
# Microsoft SQL Server MCP Server
[](https://pypi.org/project/microsoft_sql_server_mcp/)
[](https://opensource.org/licenses/MIT)
A Model Context Protocol (MCP) server for secure SQL Server database access through Claude Desktop.
## Features
- 🔍 List database tables
- 📊 Execute SQL queries (SELECT, INSERT, UPDATE, DELETE)
- 🔐 Multiple authentication methods (SQL, Windows, Azure AD)
- 🏢 LocalDB and Azure SQL support
- 🔌 Custom port configuration
## Quick Start
### Install with Claude Desktop
Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"mssql": {
"command": "uvx",
"args": ["microsoft_sql_server_mcp"],
"env": {
"MSSQL_SERVER": "localhost",
"MSSQL_DATABASE": "your_database",
"MSSQL_USER": "your_username",
"MSSQL_PASSWORD": "your_password"
}
}
}
}
```
## Configuration
### Basic SQL Authentication
```bash
MSSQL_SERVER=localhost # Required
MSSQL_DATABASE=your_database # Required
MSSQL_USER=your_username # Required for SQL auth
MSSQL_PASSWORD=your_password # Required for SQL auth
```
### Windows Authentication
```bash
MSSQL_SERVER=localhost
MSSQL_DATABASE=your_database
MSSQL_WINDOWS_AUTH=true # Use Windows credentials
```
### Azure SQL Database
```bash
MSSQL_SERVER=your-server.database.windows.net
MSSQL_DATABASE=your_database
MSSQL_USER=your_username
MSSQL_PASSWORD=your_password
# Encryption is automatic for Azure
```
### Optional Settings
```bash
MSSQL_PORT=1433 # Custom port (default: 1433)
MSSQL_ENCRYPT=true # Force encryption
```
## Alternative Installation Methods
### Using pip
```bash
pip install microsoft_sql_server_mcp
```
Then in `claude_desktop_config.json`:
```json
{
"mcpServers": {
"mssql": {
"command": "python",
"args": ["-m", "mssql_mcp_server"],
"env": { ... }
}
}
}
```
### Development
```bash
git clone https://github.com/RichardHan/mssql_mcp_server.git
cd mssql_mcp_server
pip install -e .
```
## Security
- Create a dedicated SQL user with minimal permissions
- Never use admin/sa accounts
- Use Windows Authentication when possible
- Enable encryption for sensitive data
## License
MIT