
mcp-sqlserver
A Model Context Protocol (MCP) server that enables AI agents to interact with Microsoft SQL Server databases through secure, intelligent database operations. This server provides comprehensive CRUD capabilities, schema introspection, stored procedure execution, transaction management, and bulk opera
README
MCP SQL Server
A Model Context Protocol (MCP) server that enables AI agents to interact with Microsoft SQL Server databases through secure, intelligent database operations. This server provides comprehensive CRUD capabilities, schema introspection, stored procedure execution, transaction management, and bulk operations for production SQL Server environments.
🌟 Features
Core Database Operations
- CRUD Operations: Complete SELECT, INSERT, UPDATE, DELETE functionality
- Custom Queries: Safe execution of custom SELECT statements with security restrictions
- Schema Introspection: Database, table, column, index, and foreign key exploration
- Connection Management: Robust connection pooling with automatic reconnection
Advanced Operations (v1.1.0)
- Stored Procedures: Execute stored procedures with parameters, multiple result sets, and output parameters
- Transaction Management: BEGIN/COMMIT/ROLLBACK operations with isolation levels and savepoints
- Bulk Operations: High-performance bulk insert, batch update/delete, and data import (CSV/JSON)
Security & Safety
- Parameterized Queries: Full SQL injection prevention
- Query Restrictions: DDL operations blocked in custom queries
- Input Validation: Comprehensive Zod-based validation
- Connection Validation: Health checks and timeout controls
🚀 Quick Start
Prerequisites
- Node.js 20+
- TypeScript 5.0+
- Microsoft SQL Server (2016+)
- Claude Desktop or MCP-compatible client
Installation
Option 1: NPX (Recommended)
# No installation required - run directly
npx @bilims/mcp-sqlserver
Option 2: Global Installation
npm install -g @bilims/mcp-sqlserver
mcp-sqlserver
Option 3: From Source
git clone https://github.com/bilims/mcp-sqlserver.git
cd mcp-sqlserver
npm install
npm run build
npm start
Configuration
Create a .env
file with your SQL Server configuration:
# SQL Server Configuration
SQLSERVER_HOST=your-server-host
SQLSERVER_PORT=1433
SQLSERVER_DATABASE=your-database
SQLSERVER_USERNAME=your-username
SQLSERVER_PASSWORD=your-password
SQLSERVER_ENCRYPT=true
SQLSERVER_TRUST_SERVER_CERTIFICATE=true
# Connection Pool Settings
SQLSERVER_POOL_MIN=0
SQLSERVER_POOL_MAX=10
SQLSERVER_CONNECTION_TIMEOUT=15000
SQLSERVER_REQUEST_TIMEOUT=15000
Claude Desktop Integration
Add to your Claude Desktop MCP settings (claude_desktop_config.json
):
Option 1: Using NPX (Recommended)
{
"mcpServers": {
"mcp-sqlserver": {
"command": "npx",
"args": ["-y", "@bilims/mcp-sqlserver"],
"env": {
"SQLSERVER_HOST": "your-server-host",
"SQLSERVER_DATABASE": "your-database",
"SQLSERVER_USERNAME": "your-username",
"SQLSERVER_PASSWORD": "your-password"
}
}
}
}
Option 2: Global Installation
{
"mcpServers": {
"mcp-sqlserver": {
"command": "mcp-sqlserver"
}
}
}
Option 3: From Source
{
"mcpServers": {
"mcp-sqlserver": {
"command": "node",
"args": ["/path/to/mcp-sqlserver/dist/index.js"],
"cwd": "/path/to/mcp-sqlserver"
}
}
}
Note: For options 2 and 3, create a .env
file in the appropriate directory with your SQL Server configuration.
🛠 Available Tools
Core Database Operations (10 tools)
sql_test_connection
- Database connectivity testingsql_select
- Advanced SELECT queries with filtering and joinssql_insert
- Safe record insertionsql_update
- Conditional record updatessql_delete
- Safe record deletionsql_query
- Custom SELECT statement executionsql_get_tables
- Database table listingsql_get_columns
- Table column informationsql_get_table_structure
- Complete table structure analysissql_get_schemas
- Database schema exploration
Stored Procedures (3 tools)
sql_execute_stored_procedure
- Execute stored procedures with parameterssql_get_stored_procedures
- List all stored proceduressql_get_stored_procedure_info
- Get detailed stored procedure information
Transaction Management (5 tools)
sql_begin_transaction
- Start database transactions with isolation levelssql_commit_transaction
- Commit active transactionssql_rollback_transaction
- Rollback transactions or to savepointssql_create_savepoint
- Create transaction savepointssql_get_transaction_status
- Check current transaction status
Bulk Operations (4 tools)
sql_bulk_insert
- High-performance bulk insert operationssql_batch_update
- Batch update multiple recordssql_batch_delete
- Batch delete multiple recordssql_import_data
- Import data from CSV/JSON formats
Total: 22 tools available
📚 Usage Examples
Basic Query
// Using sql_select tool
{
"table": "Users",
"columns": ["id", "name", "email"],
"where": [
{"column": "active", "operator": "=", "value": true}
],
"orderBy": [{"column": "created_at", "direction": "DESC"}],
"limit": 10
}
Stored Procedure Execution
// Using sql_execute_stored_procedure tool
{
"procedureName": "GetUsersByRole",
"schema": "dbo",
"parameters": [
{"name": "role", "value": "admin", "type": "varchar", "size": 50}
]
}
Bulk Insert
// Using sql_bulk_insert tool
{
"table": "Products",
"data": [
{"name": "Product 1", "price": 29.99, "active": true},
{"name": "Product 2", "price": 39.99, "active": true}
],
"batchSize": 100
}
Transaction Management
// Begin transaction
{"isolationLevel": "READ_COMMITTED"}
// Create savepoint
{"savepointName": "before_updates"}
// Rollback to savepoint if needed
{"savepoint": "before_updates"}
🗺️ Roadmap
- v1.1.0 (Current): Enhanced database operations with stored procedures, transactions, and bulk operations
- v1.2.0 (Q3 2025): Data Analysis & Insights - 15 new analytics and export tools
- v1.3.0 (Q4 2025): Advanced Query Builder - Natural language processing and query templates
- v1.4.0 (Q1 2026): Enterprise Features - Multi-database support and security auditing
- v2.0.0 (Mid-2026): AI-Enhanced Features - Full AI assistant capabilities
See ROADMAP.md for detailed feature plans.
🔧 Development
Scripts
npm run build
- Build TypeScript to JavaScriptnpm run dev
- Run in development modenpm start
- Start the compiled servernpm test
- Run testsnpm run lint
- Lint TypeScript filesnpm run typecheck
- Type check without emitting
Project Structure
├── src/
│ ├── config/ # Configuration management
│ ├── database/ # Database connection and query building
│ ├── tools/ # MCP tool implementations
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Utility functions
│ ├── server.ts # Main MCP server
│ └── index.ts # Entry point
├── dist/ # Compiled JavaScript (generated)
├── ROADMAP.md # Detailed development roadmap
├── package.json
└── tsconfig.json
🛡️ Security
- All queries use parameterized inputs to prevent SQL injection
- DDL operations are blocked in custom queries
- Connection validation and timeout controls
- Comprehensive input validation using Zod schemas
- Production-ready error handling and logging
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
See ROADMAP.md for priority areas and upcoming features.
📄 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🏢 About
Developed and maintained by Bilims.
For support, feature requests, or bug reports, please open an issue.
⚡ Ready to supercharge your SQL Server operations with AI? Get started today!<!-- Force push fix -->
推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。