{
  "markdown": "[marketplace]: https://marketplace.visualstudio.com/items?itemName=ErikEJ.TSqlAnalyzer\n[ssmsmarketplace]: https://ssmsgallery.azurewebsites.net/extension/TSqlAnalyzerSsms.f1322c34-dfaa-4842-8933-b439626da91d\n[vsixgallery]: http://www.vsixgallery.com/extension/SqlAnalyzer.abc6ba2-edd5-4419-8646-a55d0a83f7ff/\n\n# Static Analysis Rule-sets for SQL Projects\n\n[![MCP Toplist](https://mcptoplist.com/badge/glama%2FErikEJ%2FSqlServer.Rules.svg)](https://mcptoplist.com/server/glama%2FErikEJ%2FSqlServer.Rules)\n\n![build status](https://img.shields.io/github/actions/workflow/status/ErikEJ/SqlServer.Rules/vsix.yml?master) [![latest version](https://img.shields.io/nuget/v/ErikEJ.DacFX.SqlServer.Rules)](https://www.nuget.org/packages/ErikEJ.DacFX.SqlServer.Rules) ![GitHub Sponsors](https://img.shields.io/github/sponsors/ErikEJ)\n\n## Overview\n\nA library of SQL best practices implemented as over 140 [database code analysis rules](https://erikej.github.io/dacfx/codeanalysis/sqlserver/2024/04/02/dacfx-codeanalysis.html) checked at build time.\n\nThe rules can be added as NuGet packages to SQL Database projects:\n\n- **Modern SDK-style projects**: [MSBuild.Sdk.SqlProj](https://github.com/rr-wfm/MSBuild.Sdk.SqlProj) and [Microsoft.Build.Sql](https://github.com/microsoft/DacFx)\n- **Classic .sqlproj**: Legacy SSDT projects (Visual Studio 2017+ required)\n\nFor a complete list of the current rules we have implemented see [here](docs/readme.md).\n\n## Component Stack\n\n```mermaid\nflowchart TD\n    VS[\"Visual Studio T-SQL Analyzer<br/>Live feedback in Visual Studio\"]\n    SSMS[\"SSMS T-SQL Analyzer<br/>Live feedback in SQL Server Management Studio\"]\n    VSC[\"VS Code T-SQL Analyzer<br/>Live feedback in Visual Studio Code\"]\n    CLI[\"T-SQL Analyzer CLI<br/>tsqlanalyze command line tool\"]\n    MBSQL[\"SQL Database Projects<br/>Build-time SQL Project analysis\"]\n    RULES[\"SqlServer.Rules<br/>(NuGet package)<br/>Static SQL code analysis rules\"]\n    MCP[\"MCP Server<br/>AI Agent integration for SQL code analysis rules\"]\n\n    VS --> CLI\n    SSMS --> CLI\n    VSC --> CLI\n    CLI --> RULES\n    MBSQL --> RULES\n    MCP --> CLI\n```\n\n## Usage\n\nThe latest version is available on NuGet\n\n```sh\ndotnet add package ErikEJ.DacFX.SqlServer.Rules\n```\n\n### Modern SDK-style Projects\n\nThe 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.\n\nYou can read more about using and customizing the rules in the [docs here](https://rr-wfm.github.io/MSBuild.Sdk.SqlProj/docs/static-code-analysis.html)\n\n### Classic .sqlproj Projects\n\nYou can download and manually use the rules with Visual Studio and \"classic\" SQL Database projects, as described in my [blog post here](https://erikej.github.io/dacfx/codeanalysis/sqlserver/2024/04/02/dacfx-codeanalysis.html#addrules).\n\n## Command line tool - T-SQL Analyzer CLI\n\nThis repository also contains a .NET command line tool that uses the rule set.\n\nYou can use it to analyze SQL scripts or SQL Database projects and output the results in a variety of formats, including XML and JSON.\n\nYou 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.\n\nThe T-SQL Analyzer MCP Server supports quick installation across multiple development environments. Choose your preferred client below for streamlined setup:\n\n| Client | One-click Installation | MCP Guide |\n|--------|----------------------|-------------------|\n| **VS Code** | [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_TSQLAnalyzer-0098FF?style=flat-square&logoColor=white)](https://vscode.dev/redirect/mcp/install?name=tsqlanalyzer&config=%7B%22name%22%3A%22tsqlanalyzer%22%2C%22command%22%3A%22dnx%22%2C%22args%22%3A%5B%22ErikEJ.DacFX.TSQLAnalyzer.Cli%22%2C%22--yes%22%2C%22--%22%2C%22-mcp%22%5D%7D) | [VS Code MCP Official Guide](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) |\n| **Visual Studio** | [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install_TSQLAnalyzer-C16FDE?logo=visualstudio&logoColor=white)](https://vs-open.link/mcp-install?%7B%22name%22%3A%22tsqlanalyzer%22%2C%22type%22%3A%22stdio%22%2C%22command%22%3A%22dnx%22%2C%22args%22%3A%5B%22ErikEJ.DacFX.TSQLAnalyzer.Cli%22%2C%22--yes%22%2C%22--%22%2C%22-mcp%22%5D%7D) | [Visual Studio MCP Official Guide](https://learn.microsoft.com/visualstudio/ide/mcp-servers) |\n\nRead more in the dedicated [readme file](https://github.com/ErikEJ/SqlServer.Rules/blob/master/tools/SqlAnalyzerCli/readme.md)\n\n## Visual Studio extension - T-SQL Analyzer\n\nThis repository also contains a Visual Studio extension that uses the rule set.\n\nRun live analysis of your SQL scripts in Visual Studio and get the results in the Error List window.\n\nDownload the extension from the [Visual Studio Marketplace][marketplace]\nor get the [CI build][vsixgallery]\n\nRead more in the dedicated [readme file](https://github.com/ErikEJ/SqlServer.Rules/blob/master/tools/SqlAnalyzerVsix/readme.md)\n\n## SQL Server Management Studio extension - T-SQL Analyzer\n\nThis repository also contains a SQL Server Management Studio extension that uses the rule set.\n\nRun live analysis of your SQL scripts in SQL Server Management Studio and get the results in the Error List window.\n\nDownload the latest build of this extension from the [SSMS VSIX Gallery][ssmsmarketplace]\n\nRead more in the dedicated [readme file](https://github.com/ErikEJ/SqlServer.Rules/blob/master/tools/SqlAnalyzerSsms/readme.md)\n\n## VS Code extension - T-SQL Analyzer\n\nThis repository also contains a VS Code extension that uses the rule set.\n\nGet live squiggles and diagnostics for your `.sql` files as you type in Visual Studio Code — no build step required.\n\nRead more in the dedicated [readme file](https://github.com/ErikEJ/SqlServer.Rules/blob/master/vscode-extension/README.md)\n",
  "bytes": 5917,
  "sha": "0d1f8546c4f979831f9c9be2f2761986187700db215c3f1c031ee50778de2581",
  "repo_slug": "erikej/sqlserver.rules",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_erikej_sqlserver_rules_27944447/readme"
}