io.github.ErikEJ/SqlServer.Rules MCP Server
io.github.ErikEJ/SqlServer.Rules
Analyze T-SQL scripts for design, naming, and performance issues with 140+ static code analysis rules.
What is the io.github.ErikEJ/SqlServer.Rules MCP server?
The SqlServer.Rules MCP server is a static analysis tool that checks T-SQL scripts and SQL Database projects against over 140 best practice rules for design, naming conventions, and performance. It integrates with AI agents via MCP to provide SQL code quality feedback and prevent bad practices during development.
SqlServer.Rules enforces SQL best practices through a comprehensive rule set covering design patterns, naming conventions, and performance issues. You can use it to analyze T-SQL scripts and SQL projects at build time, in your IDE, or via the command-line tool. The MCP server integration allows GitHub Copilot and other AI agents to provide real-time SQL code quality feedback.
How to install io.github.ErikEJ/SqlServer.Rules
Copy-paste configuration for popular MCP clients.
{
"mcpServers": {
"SqlServer-Rules": {
"command": "dnx",
"args": [
"ErikEJ.DacFX.TSQLAnalyzer.Cli",
"-mcp"
]
}
}
}{
"mcpServers": {
"SqlServer-Rules": {
"command": "dnx",
"args": [
"ErikEJ.DacFX.TSQLAnalyzer.Cli",
"-mcp"
]
}
}
}{
"mcpServers": {
"SqlServer-Rules": {
"command": "dnx",
"args": [
"ErikEJ.DacFX.TSQLAnalyzer.Cli",
"-mcp"
]
}
}
}{
"servers": {
"SqlServer-Rules": {
"type": "stdio",
"command": "dnx",
"args": [
"ErikEJ.DacFX.TSQLAnalyzer.Cli",
"-mcp"
]
}
}
}claude mcp add SqlServer-Rules -- dnx ErikEJ.DacFX.TSQLAnalyzer.Cli -mcpTools & capabilities
Tools this server exposes to the agent.
T-SQL Analysis— Analyze T-SQL scripts and SQL Database projects against 140+ static code analysis rulesRule Checking— Check for design, naming, and performance issues in SQL codeMultiple Output Formats— Output analysis results in XML, JSON, and other formatsBuild-time Integration— Run rules during SQL Database project builds in Visual Studio
Use cases
- Enforce SQL naming conventions and design patterns across your team's codebase
- Identify performance anti-patterns and design issues in T-SQL scripts before deployment
- Integrate SQL code quality checks into CI/CD pipelines using the CLI tool
- Get real-time SQL code feedback in VS Code or Visual Studio via Copilot Chat
- Analyze legacy SQL Database projects for compliance with best practices
io.github.ErikEJ/SqlServer.Rules MCP server FAQ
It's a static analysis tool that checks T-SQL code against 140+ best practice rules for design, naming, and performance. The MCP server version allows AI agents like GitHub Copilot to analyze your SQL code and provide feedback.
Yes, the SqlServer.Rules library and CLI tool are open source and free to use.
Use the one-click installation buttons provided in the README for VS Code or Visual Studio. Alternatively, install the NuGet package ErikEJ.DacFX.TSQLAnalyzer.Cli and configure it as an MCP server.
No authentication is required. The tool runs locally on your machine.
Yes, the rules work with both modern SDK-style projects (MSBuild.Sdk.SqlProj and Microsoft.Build.Sql) and classic .sqlproj projects in Visual Studio.
It detects design issues, naming convention violations, performance anti-patterns, and other SQL best practice violations across 140+ rules.
README (reference)
Source of truth, from the repository.
Static Analysis Rule-sets for SQL Projects
Overview
A library of SQL best practices implemented as over 140 database code analysis rules checked at build time.
The rules can be added as NuGet packages to SQL Database projects:
- Modern SDK-style projects: MSBuild.Sdk.SqlProj and Microsoft.Build.Sql
- Classic .sqlproj: Legacy SSDT projects (Visual Studio 2017+ required)
For a complete list of the current rules we have implemented see here.
Component Stack
flowchart TD
VS["Visual Studio T-SQL Analyzer<br/>Live feedback in Visual Studio"]
SSMS["SSMS T-SQL Analyzer<br/>Live feedback in SQL Server Management Studio"]
VSC["VS Code T-SQL Analyzer<br/>Live feedback in Visual Studio Code"]
CLI["T-SQL Analyzer CLI<br/>tsqlanalyze command line tool"]
MBSQL["SQL Database Projects<br/>Build-time SQL Project analysis"]
RULES["SqlServer.Rules<br/>(NuGet package)<br/>Static SQL code analysis rules"]
MCP["MCP Server<br/>AI Agent integration for SQL code analysis rules"]
VS --> CLI
SSMS --> CLI
VSC --> CLI
CLI --> RULES
MBSQL --> RULES
MCP --> CLI
Usage
The latest version is available on NuGet
dotnet add package ErikEJ.DacFX.SqlServer.Rules
Modern SDK-style Projects
The rules are available as a NuGet package that can be added to your SQL Database project. The rules will run during build, and report any issues in the Error List window.
You can read more about using and customizing the rules in the docs here
Classic .sqlproj Projects
You can download and manually use the rules with Visual Studio and "classic" SQL Database projects, as described in my blog post here.
Command line tool - T-SQL Analyzer CLI
This repository also contains a .NET command line tool that uses the rule set.
You can use it to analyze SQL scripts or SQL Database projects and output the results in a variety of formats, including XML and JSON.
You can also use the tool as an MCP Server with GitHub Copilot in VS Code and Visual Studio, allowing you to get feedback on your SQL code using GitHub Copilot Chat.
The T-SQL Analyzer MCP Server supports quick installation across multiple development environments. Choose your preferred client below for streamlined setup:
| Client | One-click Installation | MCP Guide |
|---|---|---|
| VS Code | VS Code MCP Official Guide | |
| Visual Studio | Visual Studio MCP Official Guide |
Read more in the dedicated readme file
Visual Studio extension - T-SQL Analyzer
This repository also contains a Visual Studio extension that uses the rule set.
Run live analysis of your SQL scripts in Visual Studio and get the results in the Error List window.
Download the extension from the Visual Studio Marketplace or get the CI build
Read more in the dedicated readme file
SQL Server Management Studio extension - T-SQL Analyzer
This repository also contains a SQL Server Management Studio extension that uses the rule set.
Run live analysis of your SQL scripts in SQL Server Management Studio and get the results in the Error List window.
Download the latest build of this extension from the SSMS VSIX Gallery
Read more in the dedicated readme file
VS Code extension - T-SQL Analyzer
This repository also contains a VS Code extension that uses the rule set.
Get live squiggles and diagnostics for your .sql files as you type in Visual Studio Code — no build step required.
Read more in the dedicated readme file
Related MCP servers
Control a real Chrome browser to complete any task: fill forms, extract data, book flights.
World Monitor
Real-time global intelligence: markets, conflicts, country risk, energy, and infrastructure monitoring via 39 MCP tools.
Netdata
Real-time infrastructure monitoring with per-second metrics, ML-powered anomaly detection, and zero-configuration setup.
Trending hip-hop artist momentum scores across four cultural dimensions.
AI orchestration platform with 100+ agents, swarm coordination, and self-learning memory for enterprise development.
Scrapling MCP Server
Web scraping with stealth HTTP, real browsers, and Cloudflare bypass capabilities.