mssql-mcp-local-sql-auth

HosseinnNazari/mssql-mcp-local-sql-auth

3.1

If you are the rightful owner of mssql-mcp-local-sql-auth and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This server allows LLMs to interact with a local Microsoft SQL Server database using the Model Context Protocol (MCP), without requiring Azure or browser logins.

License: MIT Forked from RichardHan/mssql_mcp_server

MSSQL Database MCP Server (Local SQL Server Edition)

🚀 This version is modified to work with LOCAL SQL SERVER 2019 — not Azure SQL.
No browser login. No Azure AD. No “PC userName” fallback. Just pure SQL Server Authentication.


What is this? 🤔

This is a server that lets your LLMs (like Claude) talk directly to your local Microsoft SQL Server database! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently — without needing Azure or browser logins.

Quick Example

You: "Show me all customers from Tehran"
Claude: *queries your local SQL Server database and gives you the answer in plain English*

How Does It Work? 🛠️

This server leverages the Model Context Protocol (MCP), a versatile framework that acts as a universal translator between AI models and databases. It supports multiple AI assistants including Claude Desktop and VS Code Agent.

⚠️ Important: This fork has been modified to use SQL Server Authentication (username/password) for local SQL Server 2019+ — NOT Azure AD.

🔒 Credentials are hardcoded in src/index.ts — no need to configure environment variables.
Why hardcoded? → See


What Can It Do? 📊

  • Run SQL queries by just asking questions in plain English
  • Create, read, update, and delete data
  • Manage database schema (tables, indexes)
  • Secure connection handling (with TRUST_SERVER_CERTIFICATE=true for local dev)
  • Real-time data interaction

Quick Start 🚀

Prerequisites

  • Node.js 14 or higher
  • Claude Desktop or VS Code with Agent extension
  • Local SQL Server 2019+ instance running
  • A database (e.g., Test) and SQL login (e.g., ai / 1234)

Set up project

  1. Install Dependencies
    Run the following command in the root folder to install all necessary dependencies:

    npm install
    
  2. Build the Project
    Compile the project by running:

    npm run build
    

Configuration Setup

⚙️ Credentials Are Hardcoded — No Config Needed!

Unlike the original version, you don’t need to set environment variables.

All connection details are hardcoded in:

src/index.ts

Example (already set in code):

server: "DESKTOP-3445U4I\\SQL2019",
database: "Test",
user: "ai",
password: "1234",
options: {
  encrypt: false,
  trustServerCertificate: true
}

👉 Just update these values in src/index.ts if needed → rebuild → done.


Option 1: VS Code Agent Setup

  1. Install VS Code Agent Extension

    • Open VS Code
    • Go to Extensions (Ctrl+Shift+X)
    • Search for "Agent" and install the official Agent extension
  2. Create MCP Configuration File

    • Create a .vscode/mcp.json file in your workspace
    • Add the following configuration:
    {
      "servers": {
        "mssql-nodejs": {
           "type": "stdio",
           "command": "node",
           "args": ["L:\\AiAccess\\Project\\dev\\SQL-AI-samples\\MssqlMcp\\Node\\dist\\index.js"]
         }
       }
    }
    
  3. Restart VS Code

    • Close and reopen VS Code for the changes to take effect
  4. Verify MCP Server

    • Open Command Palette (Ctrl+Shift+P)
    • Run "MCP: List Servers" to verify your server is configured
    • You should see "mssql-nodejs" in the list of available servers

Option 2: Claude Desktop Setup

  1. Open Claude Desktop Settings

    • Navigate to File → Settings → Developer → Edit Config
    • Open the claude_desktop_config file
  2. Add MCP Server Configuration Replace the content with:

    {
      "mcpServers": {
        "MSSQL MCP": {
          "type": "stdio",
          "command": "node",
          "args": ["L:\\AiAccess\\Project\\dev\\SQL-AI-samples\\MssqlMcp\\Node\\dist\\index.js"]
        }
      }
    }
    
  3. Restart Claude Desktop

    • Close and reopen Claude Desktop for the changes to take effect

Usage Examples

Once configured, you can interact with your database using natural language:

  • "List all tables in the Test database"
  • "Show me the top 5 customers ordered by name"
  • "Describe the structure of the Orders table"
  • "Update product price to 99.99 where product_id = 100"

Security Notes

  • The server requires a WHERE clause for read operations to prevent accidental full table scans
  • Update operations require explicit WHERE clauses for security
  • Set READONLY: "true" in src/index.ts if you only need read access

❓ Why Hardcoded? Why No Azure?

This version removes Azure AD authentication entirely and uses local SQL Server Auth for simplicity and reliability.

If you want to understand why we hardcoded the config and what “ENIAC” means, read:
👉


You should now have successfully configured the MCP server for local SQL Server with your preferred AI assistant. This setup allows you to seamlessly interact with your database through natural language queries — no cloud, no browser, no fuss.


🙏 Credits

This project is a modified fork of the original mssql_mcp_server by Richard Han.

I’ve adapted it to work with local SQL Server 2019 using SQL Server Authentication — removing Azure AD dependencies, fixing MCP protocol compliance, and hardcoding credentials for reliability.

Original repo:
👉 https://github.com/RichardHan/mssql_mcp_server

Thank you, Richard, for creating the foundation this project is built on.

🎉 Enjoy your local AI-powered SQL queries!


---