Enhanced MCP MSSQL Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Enhanced MCP MSSQL Server List all tables in the Northwind database on myserver.com with my credentials"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🚀 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
Related MCP server: MSSQL Database MCP Server
🛠️ 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
# Install dependencies
npm install
# Build the project
npm run build
# Configure your database (copy .env.example to .env)
cp .env.example .env
# Start the server
npm start
# Run tests (requires running MSSQL server)
npm test🎯 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:
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["path/to/mcp-mssql-connector/dist/index.js"]
}
}
}🔧 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:
List all databases on server 'myserver.com' using username 'myuser' and password 'mypass'Explore structure:
List all tables in the 'Northwind' database on myserver.com with my credentialsQuery data:
Query "SELECT TOP 10 * FROM Customers WHERE Country = 'USA'" on Northwind database at myserver.comUnderstand relationships:
Show foreign key relationships for the Orders table in Northwind database on myserver.com🔒 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
Available Tools
9 toolsmssql_bulk_insertC
Insert multiple rows efficiently using bulk operations
Inputs: server (required), user (required), password (required), database (required), +5 more.
mssql_describe_tableC
Get detailed information about a table structure
Inputs: server (required), user (required), password (required), database (required), +4 more.
mssql_get_relationshipsC
Get foreign key relationships for tables
Inputs: server (required), user (required), password (required), database (required), +4 more.
mssql_health_checkB
Check database server health and connectivity with performance metrics
Inputs: server (required), user (required), password (required), port, +3 more.
mssql_list_databasesC
List all databases the user has access to
Inputs: server (required), user (required), password (required), port, +2 more.
mssql_list_tablesC
List all tables in a database
Inputs: server (required), user (required), password (required), database (required), +3 more.
mssql_queryC
Execute a read-only SELECT query
Inputs: server (required), user (required), password (required), database (required), +5 more.
mssql_sample_dataC
Get sample data from a table
Inputs: server (required), user (required), password (required), database (required), +5 more.
mssql_validate_queryA
Validate a SQL query for security and syntax without executing it
Inputs: query (required), includeOptimizations.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool has a clearly distinct purpose targeting specific database operations. There is no overlap: bulk_insert, describe_table, get_relationships, health_check, list_databases, list_tables, query, sample_data, and validate_query all serve unique functions in the MSSQL domain.
All tools follow a consistent 'mssql_verb_noun' pattern with snake_case throughout. The naming is predictable and readable, making it easy for agents to understand the tool's function from its name alone.
With 9 tools, this server is well-scoped for database management tasks. Each tool earns its place by covering essential operations like listing, querying, describing, and validating, without being overly sparse or bloated.
The toolset provides strong coverage for read operations, validation, and metadata queries in MSSQL. A minor gap exists in write operations beyond bulk_insert (e.g., update, delete, or stored procedure execution), but agents can work around this for most common database interactions.
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Microsoft SQL Server databases through query execution, schema discovery, CRUD operations, stored procedures, and data export with built-in safety controls.1877 PyPIApache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to securely interact with Microsoft SQL Server databases to query data, inspect schemas, and retrieve metadata with read-only operations by default and optional write capabilities.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to inspect schemas, analyze performance, check security, and troubleshoot SQL Server 2019+ databases through a safe, controlled interface.-
- AlicenseBqualityCmaintenanceEnables AI assistants to connect to Microsoft SQL Server for schema discovery, querying, stored procedures, DDL, performance diagnostics, and developer utilities with configurable security modes.35MIT