io.github.ErikEJ/SqlServer.Rules

Official registry Data and databases

Analyze T-SQL scripts for design, naming, and performance issues and prevent bad practices.

Install

Add this to your client's MCP configuration (Claude Desktop: claude_desktop_config.json; Cursor: .cursor/mcp.json; VS Code and others use the same "mcpServers" shape).

NUGET package ErikEJ.DacFX.TSQLAnalyzer.Cli
Claude Code
claude mcp add sqlserver-rules -- dnx ErikEJ.DacFX.TSQLAnalyzer.Cli@1.0.64 --yes -mcp
JSON configuration (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "sqlserver-rules": {
            "command": "dnx",
            "args": [
                "ErikEJ.DacFX.TSQLAnalyzer.Cli@1.0.64",
                "--yes",
                "-mcp"
            ]
        }
    }
}

Documentation

From the project's README on GitHub, refreshed weekly. Links open on GitHub.

Contents
  1. Static Analysis Rule-sets for SQL Projects
  2. Overview
  3. Component Stack
  4. Usage
  5. Command line tool - T-SQL Analyzer CLI
  6. Visual Studio extension - T-SQL Analyzer
  7. SQL Server Management Studio extension - T-SQL Analyzer
  8. VS Code extension - T-SQL Analyzer

[marketplace]: https://marketplace.visualstudio.com/items?itemName=ErikEJ.TSqlAnalyzer [ssmsmarketplace]: https://ssmsgallery.azurewebsites.net/extension/TSqlAnalyzerSsms.f1322c34-dfaa-4842-8933-b439626da91d [vsixgallery]: http://www.vsixgallery.com/extension/SqlAnalyzer.abc6ba2-edd5-4419-8646-a55d0a83f7ff/

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:

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:

ClientOne-click InstallationMCP Guide
VS CodeVS Code MCP Official Guide
Visual StudioVisual 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][marketplace] or get the [CI build][vsixgallery]

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][ssmsmarketplace]

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

Frequently asked questions

What is io.github.ErikEJ/SqlServer.Rules?

Analyze T-SQL scripts for design, naming, and performance issues and prevent bad practices.

How do I install io.github.ErikEJ/SqlServer.Rules?

It runs on your machine. In Claude Code: claude mcp add sqlserver-rules -- dnx ErikEJ.DacFX.TSQLAnalyzer.Cli@1.0.64 --yes -mcp. For other clients, paste the JSON configuration from this page into their MCP settings.

Does io.github.ErikEJ/SqlServer.Rules need an API key?

Its registry entry lists no required key or secret. Some features may still need an account with the service it connects to.

Is io.github.ErikEJ/SqlServer.Rules open source?

Yes. Its code is on GitHub under the MIT license.

Who maintains io.github.ErikEJ/SqlServer.Rules?

It is published by ErikEJ. AI.tn lists it but does not maintain or endorse it.

From the official MCP Registry. Listing is not an endorsement: review a server's code and permissions before giving it access to your data.