MSSQL MCP Server

by jexinsam

12 stars
Not rated
GitHub

About

Enables secure interactions with Microsoft SQL Server databases for automated data analysis, dynamic reporting, and intelligent database management.

Details

Author
jexinsam
Repository
JexinSam/mssql_mcp_server
GitHub stars
12
License
MIT License
Categories
Database, Other, Design, Developer Tools, AI, Automation, Infrastructure, Frontend
Tags
#sql

- Secure MSSQL Database Access through environment variables
- SQL Injection Protection with identifier validation
- Read-Only & Write Tools with appropriate MCP annotations
- Windows Authentication support via Trusted Connection
- Dual Transport — stdio (default) and HTTP
- Docker Support with pre-configured ODBC drivers
- Comprehensive Logging for monitoring queries and operations

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MSSQL MCP Server
    Command (node, npx, python, etc.) uv
    Arguments
    • Argument 1 --directory
    • Argument 2 path/to/mssql_mcp_server
    • Argument 3 run
    • Argument 4 mssql_mcp_server
    Environment
    • MSSQL_HOST localhost
    • MSSQL_USER your_username
    • MSSQL_DATABASE your_database
    • MSSQL_PASSWORD your_password

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

MSSQL_USER=your_username
MSSQL_PASSWORD=your_password

Trusted_Connection=yes

{
  "mcpServers": {
    "mssql": {
      "command": "mssql_mcp_server",
      "env": {
        "MSSQL_HOST": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_PASSWORD": "your_password",
        "MSSQL_DATABASE": "your_database"
      }
    }
  }
}

```bash

pip install -r requirements.txt

python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

pip install -r requirements-dev.txt
pip install -e .

list_tables

List all tables in the database.

query_sql

Execute read-only SELECT queries.

execute_sql

Execute any SQL statement (SELECT, INSERT, UPDATE, DELETE, DDL).

| Tool | Description | Annotations |
|------|-------------|-------------|
| list_tables | List all tables in the database | Read-only, Idempotent |
| query_sql | Execute read-only SELECT queries | Read-only, Idempotent |
| execute_sql | Execute any SQL statement (SELECT, INSERT, UPDATE, DELETE, DDL) | Destructive |

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mssql mcp server": {
            "env": {
                "MSSQL_HOST": "localhost",
                "MSSQL_USER": "your_username",
                "MSSQL_DATABASE": "your_database",
                "MSSQL_PASSWORD": "your_password"
            },
            "args": [
                "--directory",
                "path/to/mssql_mcp_server",
                "run",
                "mssql_mcp_server"
            ],
            "command": "uv"
        }
    }
}

Linux

{
    "env": {
        "MSSQL_HOST": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_DATABASE": "your_database",
        "MSSQL_PASSWORD": "your_password"
    },
    "args": [
        "--directory",
        "path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
    ],
    "command": "uv"
}

Macos

{
    "env": {
        "MSSQL_HOST": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_DATABASE": "your_database",
        "MSSQL_PASSWORD": "your_password"
    },
    "args": [
        "--directory",
        "path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
    ],
    "command": "uv"
}

Windows

{
    "env": {
        "MSSQL_HOST": "localhost",
        "MSSQL_USER": "your_username",
        "MSSQL_DATABASE": "your_database",
        "MSSQL_PASSWORD": "your_password"
    },
    "args": [
        "--directory",
        "path/to/mssql_mcp_server",
        "run",
        "mssql_mcp_server"
    ],
    "command": "uv"
}

MSSQL MCP Server

MSSQL MCP Server is a Model Context Protocol (MCP) server that enables secure and structured interaction with Microsoft SQL Server (MSSQL) databases. It allows AI assistants to:
- List available tables
- Read table contents
- Execute SQL queries with controlled access

Built on MCP SDK v2 (2026-07-28 spec) with support for both stdio and Streamable HTTP transports.

Features

- Secure MSSQL Database Access through environment variables
- SQL Injection Protection with identifier validation
- Read-Only & Write Tools with appropriate MCP annotations
- Windows Authentication support via Trusted Connection
- Dual Transport — stdio (default) and HTTP
- Docker Support with pre-configured ODBC drivers
- Comprehensive Logging for monitoring queries and operations

Installation

pip install mssql-mcp-server

Configuration

Set the following environment variables to configure database access:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.