mssql-mcp

command module
v0.0.0-...-9439e40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 12 Imported by: 0

README

mssql-mcp

An MCP (Model Context Protocol) server that connects to Microsoft SQL Server databases. Auto-discovers connection strings from .NET appsettings.json files so AI assistants can query and explore MSSQL databases without manual configuration.

Features

  • Auto-discovers MSSQL connection strings from appsettings.json and appsettings.*.json files
  • Finds connections in both ConnectionStrings sections and top-level keys (e.g. umbracoDbDSN)
  • Four tools: discover connections, execute queries, list tables, describe table schemas
  • Supports ADO.NET-style connection strings (Server=host,port;Database=db;User Id=...)
  • Works as both an MCP server (stdio transport) and a standalone CLI tool

Installation

go install github.com/hegner123/mssql-mcp@latest

Or build from source:

git clone https://github.com/hegner123/mssql-mcp.git
cd mssql-mcp
just install

Usage

MCP Server

Add to your Claude Code configuration:

claude mcp add --transport stdio --scope user mssql-mcp -- mssql-mcp

Or add to .mcp.json:

{
  "mcpServers": {
    "mssql-mcp": {
      "command": "mssql-mcp"
    }
  }
}
Tools

mssql_discover - Find connection strings in appsettings files:

mssql-mcp --cli --tool discover --dir /path/to/dotnet/project

mssql_query - Execute a SQL query:

mssql-mcp --cli --tool query --query "SELECT TOP 10 * FROM Users"

mssql_tables - List all tables:

mssql-mcp --cli --tool tables --connection-string "Server=localhost,1433;Database=mydb;User Id=SA;Password=pass;TrustServerCertificate=True"

mssql_schema - Describe a table's columns, types, and keys:

mssql-mcp --cli --tool schema --table "dbo.Users"

All tools accept --connection-string to provide an explicit connection, or --dir and --key to auto-discover from appsettings files. If no connection string is provided, the tool searches the current directory for appsettings files automatically.

Connection String Format

Standard ADO.NET format:

Server=localhost,1433;Database=ugm;User Id=SA;Password=Root#Root12;TrustServerCertificate=True

The tool also accepts sqlserver:// URL format directly.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL