A production-ready MCP server for SQL Server with virtual filesystem, SP management, and safe write workflows.
Configuration
View docs{
"mcpServers": {
"jpcanter-sql-server-mcp": {
"command": "node",
"args": [
"/absolute/path/to/sql-server-mcp/dist/index.js"
],
"env": {
"DB_USER": "sa",
"DB_SERVER": "localhost",
"DB_ENCRYPT": "true",
"DB_DATABASE": "MyDatabase",
"DB_PASSWORD": "YourPassword",
"DRAFT_SCHEMA": "dbo_draft",
"MAX_ROWS_AFFECTED": "10000",
"REQUIRE_TRANSACTIONS": "true",
"ENABLE_SP_MODIFICATIONS": "true",
"ENABLE_WRITE_OPERATIONS": "true",
"AUTO_BACKUP_BEFORE_DEPLOY": "true",
"DB_TRUST_SERVER_CERTIFICATE": "false"
}
}
}
}You can run the MSSQL MCP Server to manage Microsoft SQL Server objects through a Model Context Protocol (MCP). It exposes a virtual filesystem for database objects, supports safe write workflows for stored procedures, and provides discovery and performance tools for observability and governance.
You use an MCP client to connect to the MSSQL MCP Server and browse database objects as files, search for stored procedures, inspect schemas, and analyze dependencies. When you need to modify a stored procedure, you draft changes in a separate testing zone, test them with parameters, and then deploy with optional auto-backups. You can start transactions for safe data modifications, view execution statistics from the plan cache, and audit every operation.
Prerequisites: Node.js installed on your machine and access to a Microsoft SQL Server instance.
Step 1: Install dependencies and build the server.
npm install
npm run buildConfigure environment variables to connect to SQL Server and control features. Copy the example and customize values like server, database, credentials, and feature toggles.
cp .env.example .envYou connect a client by running the server locally with Node. Use the exact command and path shown to start the MCP server so your client can attach and interact with the virtual filesystem and SP lifecycle tools.
node /absolute/path/to/sql-server-mcp/dist/index.jsThe following snippet shows how to configure an MCP client to run the MSSQL MCP Server locally. Replace the absolute path with your actual build output path and provide real connection values.
{
"mcpServers": {
"mssql": {
"command": "node",
"args": ["/absolute/path/to/sql-server-mcp/dist/index.js"],
"env": {
"DB_SERVER": "localhost",
"DB_DATABASE": "MyDatabase",
"DB_USER": "sa",
"DB_PASSWORD": "YourPassword",
"ENABLE_WRITE_OPERATIONS": "true",
"ENABLE_SP_MODIFICATIONS": "true"
}
}
}
}Adjust these options in your environment to tailor behavior for your environment and security requirements. Typical settings include enabling or disabling write operations, requiring explicit transactions for modifications, setting row limits, and defining the draft schema for testing SPs.
Draft ā Test ā Deploy ā Rollback workflow for stored procedures helps you manage changes safely. Draft SPs go into a separate schema for testing, where you can run tests with parameters, validate results, and then deploy to production with automatic backups if enabled.
Reliability is enhanced through SQL validation, parameterized queries to prevent injection, row limits on data-modifying statements, and automatic transaction timeouts with audit logging.
If you encounter connection failures or permission issues, verify that the configured DB_SERVER, DB_DATABASE, DB_USER, and DB_PASSWORD are correct and that the MCP server process has network access to the SQL Server instance. Check that write operations are enabled if you plan to modify data or SPs.
For a full test environment, you can run the included test harness that spins up a SQL Server container with predefined schemas and test data. Use the provided test scripts to validate connectivity and feature coverage before deploying to production.
The server exposes a virtual filesystem perspective of database objects, supports discovery and schema inspection, and provides a lifecycle for stored procedures with version history and rollback capabilities.
List and inspect database objects, search stored procedures, fetch table schemas, analyze dependencies, and view performance statistics from the plan cache.
Safely execute write operations with validation and transaction awareness.
Start, commit, and rollback transactions with timeout protection.
Draft, test, deploy, rollback, and version history for SPs.
SQL validation, parameterization, row limits, and audit tracking.