loading…
Search for a command to run...
loading…
MCP server for Microsoft SQL Server database access and comprehensive schema exploration using tedious. Includes enhanced stored procedure tools for complete SQ
MCP server for Microsoft SQL Server database access and comprehensive schema exploration using tedious. Includes enhanced stored procedure tools for complete SQL source code access.
npm install && npm run buildWith multiple connections configured, you can switch between databases naturally: This comprehensive server provides extensive tools for analyzing Classic ASP applications, exploring database schemas, and planning modernization to .NET/Angular architectures.
Built using the tedious library for pure JavaScript SQL Server connectivity with support for Windows Authentication (NTLM).
🆕 Latest Update: Enhanced stored procedure tools now provide complete SQL source code access for comprehensive business logic analysis and modernization planning.
NTLM Pass-Through Authentication Requirement: When connecting to SQL Server using Windows Authentication (Integrated Security=SSPI), the MSSQL MCP server must provide explicit domain credentials because:
Environment variables are the secure, standard way to provide these credentials without hard-coding them in configuration files.
All tools accept an optional connectionName parameter to switch between different databases conversationally.
npm install
npm run build
Note: The .env file is for local testing/development only. For production use, configure your MCP client directly with environment variables.
Copy the example environment file:
cp .env.example .env
Update .env with your credentials:
# Windows Authentication credentials for NTLM
MSSQL_USERNAME=your-domain-username
MSSQL_PASSWORD=your-secure-password
MSSQL_DOMAIN=your-domain
# Default connection string for your database
MSSQL_CONNECTION_STRING=Data Source=your-server; Initial Catalog=your-database; Integrated Security=SSPI; TrustServerCertificate=True;
Security Note: The .env file is automatically ignored by Git to prevent committing credentials.
The cleanest, most professional approach using individual environment variables (no JSON strings required):
{
"servers": {
"mssql-mcp": {
"type": "stdio",
"command": "npx",
"args": ["mssql-mcp-server"],
"env": {
// Windows credentials (individual variables - cleanest)
"WINDOWS_USERNAME": "your-domain-username",
"WINDOWS_PASSWORD": "your-secure-password",
"WINDOWS_DOMAIN": "YOUR-DOMAIN",
// Optional default connection
"MSSQL_CONNECTION_STRING": "Data Source=main-server; Initial Catalog=MainDB; Integrated Security=SSPI; TrustServerCertificate=True;",
// Multiple database connections (individual variables)
"CONNECTION_CRM": "Data Source=crm-server; Initial Catalog=CRM_Database; Integrated Security=SSPI; TrustServerCertificate=True;",
"CONNECTION_ERP": "Data Source=erp-server; Initial Catalog=ERP_System; Integrated Security=SSPI; TrustServerCertificate=True;",
"CONNECTION_ANALYTICS": "Data Source=analytics-server; Initial Catalog=DataWarehouse; Integrated Security=SSPI; TrustServerCertificate=True;",
"CONNECTION_HR": "Data Source=hr-server; Initial Catalog=HumanResources; Integrated Security=SSPI; TrustServerCertificate=True;"
}
}
}
}
When using CONNECTION_* variables, connection names are automatically generated:
| Environment Variable | Connection Name (for tools) |
|---|---|
CONNECTION_CRM |
crm |
CONNECTION_ERP |
erp |
CONNECTION_ANALYTICS |
analytics |
CONNECTION_HR_SYSTEM |
hr_system |
Usage in conversational queries:
crm connectionanalytics connectionhr_system connectionThe server supports multiple configuration approaches for backward compatibility:
windows_credentials, connectionsMSSQL_WINDOWS_CREDENTIALS, MSSQL_CONNECTIONSMSSQL_USERNAME, MSSQL_PASSWORD, MSSQL_DOMAINFor complete configuration details, file locations, and troubleshooting, see the Configuration Guide.
%APPDATA%\Claude\claude_desktop_config.json (Windows)~/Library/Application Support/Claude/claude_desktop_config.json~/.config/claude/claude_desktop_config.jsonNote: Claude Desktop only supports global configuration (no project-level config)
%APPDATA%\Code\User\settings.json~/Library/Application Support/Code/User/settings.json~/.config/Code/User/settings.jsonCtrl+Shift+P → "Preferences: Open User Settings (JSON)".vscode/settings.json in workspace root.vscode/mcp.json in project root%APPDATA%\Cursor\User\settings.json (Windows)~/Library/Application Support/Cursor/User/settings.json~/.config/Cursor/User/settings.json.vscode/settings.json or .vscode/mcp.json in project root.vs/mcp.json or similar (extension-dependent)Override Order (highest to lowest priority):
.vscode/mcp.json.vscode/settings.jsonUser/settings.json or Claude configExample: If you have WINDOWS_USERNAME set both globally and in a project config, the project value will be used for that specific project.
.vscode/mcp.json for project-specific databases.vscode/mcp.json in repository for team consistency.vscode/mcp.json with environment variable references🔐 Windows Authentication (Recommended):
Data Source=ServerName; Initial Catalog=DatabaseName; Integrated Security=SSPI; TrustServerCertificate=True;
🔑 SQL Server Authentication:
Server=localhost,1433;Database=AdventureWorks;User Id=sa;Password=YourPassword123!;Encrypt=true;TrustServerCertificate=true;
☁️ Azure SQL Database:
Server=your-server.database.windows.net;Database=your-database;User Id=your-username;Password=your-password;Encrypt=true;
🏷️ Named Instance:
Server=localhost\\SQLEXPRESS;Database=TestDB;Integrated Security=true;TrustServerCertificate=true;
🎯 Individual Variables (Recommended - Cleanest):
WINDOWS_USERNAME: Windows domain usernameWINDOWS_PASSWORD: Windows domain passwordWINDOWS_DOMAIN: Windows domain nameCONNECTION_*: Individual connection strings (e.g., CONNECTION_CRM, CONNECTION_ANALYTICS)MSSQL_CONNECTION_STRING: Optional default connection stringConnection Mapping: CONNECTION_CRM → crm, CONNECTION_HR_SYSTEM → hr_system
💡 Technical Note: Windows Authentication Requirements
The Windows credentials (WINDOWS_USERNAME, WINDOWS_PASSWORD, WINDOWS_DOMAIN) are required for Windows Authentication because:
This isn't a configuration preference - it's a technical requirement of Windows Authentication in service contexts.
🔄 Alternative Approaches (Backward Compatible):
windows_credentials, connectionsMSSQL_WINDOWS_CREDENTIALS, MSSQL_CONNECTIONSMSSQL_USERNAME, MSSQL_PASSWORD, MSSQL_DOMAIN💡 Why Individual Variables?
With multiple connections configured, you can switch between databases naturally in conversation:
User: "What database connections do I have available?"
Assistant: I'll list all your configured database connections...
[Shows: crm, erp, analytics, hr, etc.]
User: "Show me the customer tables in the CRM system"
Assistant: I'll explore the CRM database for customer-related tables...
[Uses connectionName: "crm"]
User: "Now check the analytics warehouse for sales data"
Assistant: Switching to the analytics database to look for sales data...
[Uses connectionName: "analytics"]
User: "Compare employee counts between HR system and ERP"
Assistant: I'll check both databases for employee information...
[Uses connectionName: "hr", then connectionName: "erp"]
User: "What tables are in my database?"
Assistant: [Lists all tables with descriptions]
User: "Describe the customers table"
Assistant: [Shows column details, data types, constraints]
User: "Show me a sample of customer data"
Assistant: [Returns first 10 rows safely]
User: "List my available connections"
Assistant: [Shows all configured database connections]
User: "Switch to the analytics database and show me the sales tables"
Assistant: [Connects to analytics DB and lists sales-related tables]
User: "Query both CRM and ERP systems for customer overlap"
Assistant: [Queries both systems and compares results]
This MCP server provides specialized tools for analyzing Classic ASP applications and planning modernization:
// 1. Analyze stored procedures containing business logic
await mcp.call("list_stored_procedures", {
schema: "MyApp",
includeSystemObjects: false,
});
// 2. Extract business rules from database constraints
await mcp.call("analyze_check_constraints", {
schema: "MyApp",
});
// 3. Identify lookup tables and reference data
await mcp.call("find_lookup_tables", {
schema: "MyApp",
});
// 4. Analyze performance bottlenecks
await mcp.call("find_missing_indexes", {
schema: "MyApp",
});
// Extract detailed stored procedure logic
await mcp.call("describe_stored_procedure", {
procedureName: "CalculateOrderTotal",
schema: "MyApp",
includeDefinition: true,
});
// Get complete SQL source code for analysis
await mcp.call("get_stored_procedure_definition", {
procedureName: "ProcessOrder",
schema: "MyApp",
formatOutput: true,
});
// Bulk extract all stored procedures for modernization
await mcp.call("get_all_stored_procedure_definitions", {
schema: "MyApp",
maxResults: 50,
});
// Search for procedures using specific tables or business logic
await mcp.call("search_stored_procedures_by_content", {
searchText: "Customer",
schema: "MyApp",
includeDefinitions: true,
});
// Find computed columns with business rules
await mcp.call("find_computed_columns", {
schema: "MyApp",
});
// Analyze data validation rules
await mcp.call("analyze_check_constraints", {
schema: "MyApp",
});
// Identify audit trails and tracking patterns
await mcp.call("detect_audit_columns", {
schema: "MyApp",
});
// Analyze data patterns for normalization
await mcp.call("analyze_data_distribution", {
tableName: "Orders",
schema: "MyApp",
});
// Plan index strategy for new application
await mcp.call("analyze_index_usage", {
schema: "MyApp",
});
User: "I need to understand the business logic in my legacy application database"
Assistant: I'll analyze your database for business logic patterns...
[Uses list_stored_procedures, analyze_check_constraints, find_computed_columns]
User: "What stored procedures handle order processing?"
Assistant: Let me search for order-related procedures...
[Uses search_stored_procedures_by_content with "order", then get_stored_procedure_definition for detailed analysis]
User: "Show me the complete SQL code for the CalculateOrderTotal procedure"
Assistant: I'll retrieve the full stored procedure definition...
[Uses get_stored_procedure_definition with formatOutput: true]
User: "Get all stored procedure code for the sales schema for modernization"
Assistant: I'll extract all stored procedure definitions from the sales schema...
[Uses get_all_stored_procedure_definitions with schema: "sales"]
User: "Find performance issues in my database"
Assistant: I'll analyze indexes and table performance...
[Uses find_missing_indexes, analyze_table_stats, analyze_index_usage]
User: "Which tables are growing too fast?"
Assistant: Let me check table sizes and growth patterns...
[Uses analyze_table_stats, analyze_database_size]
User: "Compare customer data between our CRM and ERP systems"
Assistant: I'll analyze customer tables in both systems...
[Switches between connectionName: "crm" and connectionName: "erp"]
User: "Find data quality issues across all our databases"
Assistant: Let me check data patterns across your systems...
[Uses analyze_null_patterns, analyze_data_distribution across multiple connections]
# Development mode
npm run dev
# Build for production
npm run build
# Run tests
npm test
MIT License - see LICENSE file for details.
Contributions welcome! Please read CONTRIBUTING.md for guidelines.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mssql-mcp-server": {
"command": "npx",
"args": [
"-y",
"mssql-mcp-server"
]
}
}
}pro-tip
Поставил Mssql Mcp Server? Скажи Claude: «запомни почему я установил Mssql Mcp Server и что хочу попробовать» — попадёт в твой Vault.
как это работает →