Back to Home
shaharwiener icon

mcp-sql-server

by shaharwiener

Overview

A secure Model Context Protocol (MCP) server for Microsoft SQL Server, providing safe, read-only database access with comprehensive protection layers, SQL script review, schema discovery, and execution plan analysis.

Installation

Run Command
docker exec -i mcp-sql-server python server.py

Environment Variables

  • MCP_CONFIG_PATH
  • MCP_Environment
  • MCP_TRANSPORT
  • PORT
  • HOST
  • DB_SERVER_INT
  • DB_DATABASE_INT
  • DB_USERNAME_INT
  • DB_PASSWORD_INT
  • DB_SERVER_STG
  • DB_DATABASE_STG
  • DB_USERNAME_STG
  • DB_PASSWORD_STG
  • DB_SERVER_PRD
  • DB_DATABASE_PRD
  • DB_USERNAME_PRD
  • DB_PASSWORD_PRD

Security Notes

The server implements robust multi-layer security, including AST validation to enforce read-only queries (blocking INSERT, UPDATE, DELETE, DDL, and multi-statement batches), query cost checking, concurrency throttling, result set size limits, and configurable SQL Server query hints (MAXDOP, MAX_GRANT_PERCENT, NOLOCK, query timeout). It also blocks linked servers. However, the provided `docker-compose.yml` file hardcodes the `sa` password ('McpSql2025!Secure') for the SQL Server, which is a critical security vulnerability for production deployments. Although intended for development/testing, this poses a risk if not properly managed for other environments.

Similar Servers

Stats

Interest Score14
Security Score7
Cost ClassMedium
Avg Tokens2000
Stars1
Forks0
Last Update2025-12-26

Tags

SQL ServerDatabase AccessRead-OnlySecuritySQL AnalysisSchema DiscoveryQuery ExecutionDockerModel Context Protocol