Enhanced MCP MSSQL Server
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.
README
🚀 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
# 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 dependencies - Run
npm run buildto compile TypeScript - Configure 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 |
|---|---|---|
mssql_connect |
Connect to MSSQL server | server, user, password |
mssql_list_databases |
List available databases | - |
mssql_list_tables |
List tables in database | database |
mssql_describe_table |
Get table structure | database, table |
mssql_query |
Execute SELECT query | database, query, limit |
mssql_sample_data |
Get sample rows | database, table, limit |
mssql_get_relationships |
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 credentials
Query data:
Query "SELECT TOP 10 * FROM Customers WHERE Country = 'USA'" on Northwind database at myserver.com
Understand 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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。