π Enhanced MCP MSSQL Server
A production-ready Model Context Protocol (MCP) server for Microsoft SQL Server that provides AI agents with secure, stateless database access capabilities.
β¨ New Features & Enhancements
π Advanced Security: SQL injection protection, query validation, and configurable security policies
π Health Monitoring: Real-time performance metrics and connection health checks
βοΈ Configuration Management: Environment-specific settings for development and production
π¦ Bulk Operations: Efficient batch processing for large-scale data operations
π‘οΈ Enhanced Error Handling: Structured errors with actionable information for AI agents
π― Production Ready: Enterprise-grade monitoring and security capabilities
π οΈ Available Tools (9 Total)
Core Database Tools (Enhanced)
mssql_list_databases - List all accessible databases
mssql_list_tables - List tables in a specific database
mssql_describe_table - Get detailed table schema information
mssql_query - Execute queries with security validation and metrics
mssql_sample_data - Retrieve sample rows from tables
mssql_get_relationships - Discover foreign key relationships
New Advanced Tools
mssql_health_check - Server health monitoring with performance metrics
mssql_validate_query - Security validation without query execution
mssql_bulk_insert - Efficient bulk data insertion operations
π Quick Start
π― What This Does
This MCP server allows AI agents to:
Connect to MSSQL databases securely
Discover database schemas (databases, tables, columns)
Query data safely with read-only access
Explore relationships and metadata
Sample data for analysis without full table scans
β¨ Key Features
β Read-Only Safety: Only SELECT queries allowed
π Secure Authentication: Encrypted connections by default
π Schema Discovery: Automatic database structure exploration
π Smart Sampling: Get representative data without overload
π Relationship Mapping: Understand foreign key connections
π‘οΈ SQL Injection Protection: Parameterized queries and validation
π οΈ Installation
Prerequisites:
Node.js 18+
Access to MSSQL Server (2008 R2+)
Database user with read permissions
Setup:
Clone or download this repository
Run
npm installto install dependenciesRun
npm run buildto compile TypeScriptConfigure your database connection (see Configuration section)
π Configuration
No Configuration Required!
This MCP server is now stateless - you provide connection details when calling each tool. The AI agent will ask for your database credentials when needed.
For Claude Desktop, add to your configuration:
π§ Available Tools
Tool | Description | Key Parameters |
| Connect to MSSQL server | server, user, password |
| List available databases | - |
| List tables in database | database |
| Get table structure | database, table |
| Execute SELECT query | database, query, limit |
| Get sample rows | database, table, limit |
| Get foreign keys | database, table |
π‘ Usage Examples
List databases:
Explore structure:
Query data:
Understand relationships:
π Security
Read-Only: Only SELECT statements allowed
Input Validation: All parameters validated with Zod schemas
Connection Security: TLS encryption enabled by default
Query Limits: Automatic row limits prevent data dumps
Error Handling: Safe error messages without exposing internals
π Documentation
π€ Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests if applicable
Submit a pull request
π License
MIT License - see LICENSE file for details
π Support
If you encounter issues:
Check the Usage Guide for common solutions
Verify your MSSQL server configuration
Ensure proper database permissions
Open an issue with error details
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
Enables AI agents to securely connect to and query Microsoft SQL Server databases with read-only access, schema discovery, and relationship mapping. Features advanced security protections, health monitoring, and bulk operations for production environments.