sqlserver-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
sqlserver-mcp
MCP (Model Context Protocol) server for Microsoft SQL Server using pyodbc.
Features
12 tools for database exploration and querying
Windows and SQL Server authentication
Connection pooling with health checks
Query timeout and row limits
Structured error handling
Related MCP server: Microsoft SQL Server MCP
Installation
From GitHub
uv pip install git+https://github.com/chrismannina/sqlserver-mcp.git --systemFrom source (for development)
git clone git@github.com:chrismannina/sqlserver-mcp.git
cd sqlserver-mcp
uv pip install -e ".[dev]" --systemConfiguration
Environment Variables
Variable | Required | Default | Description |
| Yes | - | SQL Server hostname or IP address |
| Yes | - | Database name |
| No |
| Set to |
| Conditional | - | Username (required if not using Windows auth) |
| Conditional | - | Password (required if not using Windows auth) |
| No | auto | ODBC driver name (auto-detected if not set) |
| No |
| Query timeout in seconds |
| No |
| Default max rows returned by queries |
| No |
| Enable debug logging to stderr |
Connection Security
All connections use:
Encrypt=yes- Encrypted connectionsTrustServerCertificate=yes- Trust the server certificate
Usage
With Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"mssql": {
"command": "sqlserver-mcp",
"env": {
"MSSQL_SERVER": "your-server",
"MSSQL_DATABASE": "your-database",
"MSSQL_USER": "your-user",
"MSSQL_PASSWORD": "your-password"
}
}
}
}With Claude Code
Add to ~/.claude/settings.json or project .claude/settings.json:
{
"mcpServers": {
"mssql": {
"command": "sqlserver-mcp",
"env": {
"MSSQL_SERVER": "your-server",
"MSSQL_DATABASE": "your-database",
"MSSQL_USER": "your-user",
"MSSQL_PASSWORD": "your-password"
}
}
}
}With OpenCode
Add an mcp section to opencode.json or ~/.config/opencode/config.json:
{
"mcp": {
"mydb": {
"type": "local",
"command": ["sqlserver-mcp"],
"enabled": true,
"environment": {
"MSSQL_SERVER": "your-server",
"MSSQL_DATABASE": "your-database",
"MSSQL_USER": "{env:MSSQL_USER}",
"MSSQL_PASSWORD": "{env:MSSQL_PASSWORD}"
}
}
}
}Running Directly
MSSQL_SERVER=your-server MSSQL_DATABASE=your-db MSSQL_USER=user MSSQL_PASSWORD=pass sqlserver-mcpTools
Discovery
list_schemas - List all schemas
list_tables - List tables (optionally by schema, with row counts)
list_views - List views (optionally by schema)
list_procedures - List stored procedures
Description
describe_table - Table structure (columns, PKs, FKs, indexes)
describe_procedure - Procedure details (parameters, definition)
Search
search_tables - Find tables/views by pattern (
%wildcards)search_columns - Find columns across tables by pattern
Data
get_table_sample - Sample rows (max 100)
get_table_stats - Row count, space usage, dates
query - Execute SQL with parameterized queries and row limits
execute_procedure - Run stored procedures with parameters
Development
uv run --extra dev pytest -vRequirements
Python 3.10+
ODBC Driver for SQL Server (17 or 18 recommended)
Installing ODBC Driver
Linux (Ubuntu/Debian):
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18macOS:
brew install microsoft/mssql-release/msodbcsql18Windows: Download from Microsoft
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Read tables and records, run FetchXML; create and update records in Microsoft Dynamics 365.
1SQL validation, formatting, parsing, metadata extraction, linting, and security analysis.
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshi…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Microsoft SQL Server databases using both SQL Server and Windows Authentication. It supports flexible connection configurations, including read-only modes and encrypted communication for secure data management.MIT
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Microsoft SQL Server databases through T-SQL query execution, table exploration, and schema inspection. Supports configurable write protection and row limiting for safe database operations.686 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables read-only exploration and querying of Microsoft SQL Server databases through a standardized interface.2ISC
- AlicenseNot gradedqualityBmaintenanceEnables interaction with Microsoft SQL Server by executing queries, statements, and stored procedures, as well as retrieving schema metadata through the Model Context Protocol.11 npmMIT