Skip to main content
Glama
MS SQL Server MCP Server

MS SQL Server MCP Server

by arsyadal

MS SQL Server MCP Server

Model Context Protocol (MCP) Server for MS SQL Server designed to connect seamlessly to database instances located locally or remotely (e.g. inside Remote Desktop Connection, VPN, or remote cloud servers).


🚀 Features

  • 🔌 Universal Connectivity: Connect to local instances (localhost, 127.0.0.1, .\SQLEXPRESS) or remote servers via IP, Domain, or Custom Port.

  • 🛡️ Remote & SSL Support: Full support for trustServerCertificate: true to seamlessly connect across VPNs and remote hosts with self-signed SSL certificates.

  • 🧰 Comprehensive MCP Tools:

    • mssql_test_connection: Test connection and get server metadata (SQL Server version, host, database name).

    • mssql_list_databases: List all available databases on the instance.

    • mssql_list_tables: List tables & views in a database or schema.

    • mssql_describe_table: Detailed table schema inspection (columns, data types, nullability, primary keys).

    • mssql_execute_query: Run custom T-SQL queries (SELECT, INSERT, UPDATE, DELETE, EXEC).


Related MCP server: mcp-server-mssql

📋 Remote Desktop / Remote Server Prerequisites

If your MS SQL Server is located inside a Remote Desktop Connection / Remote Host, make sure:

  1. TCP/IP Protocol Enabled: Open SQL Server Configuration Manager on the remote machine -> SQL Server Network Configuration -> Protocols for MSSQLSERVER -> Enable TCP/IP.

  2. Inbound Firewall Rule: Allow TCP Port 1433 in Windows Firewall on the remote machine.

  3. SQL Server Authentication (Mixed Mode): Ensure SQL Server Authentication is enabled and an active user account (e.g. sa or a dedicated DB user) is configured.


🛠️ Installation & Building

# 1. Install dependencies
npm install

# 2. Build TypeScript project
npm run build

⚙️ Configuration (.env)

Edit .env or set environment variables:

MSSQL_SERVER=192.168.1.100  # Localhost or Remote IP/Hostname
MSSQL_PORT=1433
MSSQL_DATABASE=master
MSSQL_USER=sa
MSSQL_PASSWORD=YourPassword123
MSSQL_ENCRYPT=true
MSSQL_TRUST_SERVER_CERTIFICATE=true

🔌 Integrating with AI Clients (Claude Desktop, Cursor, Antigravity, VS Code)

Add this configuration to your client's MCP configuration file (e.g. claude_desktop_config.json or mcp_config.json):

{
  "mcpServers": {
    "mssql": {
      "command": "node",
      "args": [
        "c:/Users/muhammad.alg_ext/Documents/mssql-mcp/dist/index.js"
      ],
      "env": {
        "MSSQL_SERVER": "192.168.1.100",
        "MSSQL_PORT": "1433",
        "MSSQL_DATABASE": "your_database_name",
        "MSSQL_USER": "sa",
        "MSSQL_PASSWORD": "YourPassword123",
        "MSSQL_TRUST_SERVER_CERTIFICATE": "true"
      }
    }
  }
}

🛠️ MCP Tools Overview

Tool Name

Parameters

Description

mssql_test_connection

server, port, database, user, password, trustServerCertificate

Tests connection & returns SQL Server version & info

mssql_list_databases

server, database

Lists all online databases

mssql_list_tables

database, schema

Lists tables and views in a database

mssql_describe_table

table_name (required), schema, database

Returns full table column schemas & PKs

mssql_execute_query

query (required), database

Executes T-SQL queries & returns result sets


📄 License

MIT

mssql-mcp

Available Tools

5 tools
mssql_describe_tableA

Get table metadata including columns, data types, nullability, max length, and primary keys.

Inputs: table_name (required), schema, database.

mssql_execute_queryA

Execute a T-SQL query (SELECT, INSERT, UPDATE, DELETE, EXEC) on the MS SQL database.

Inputs: query (required), database.

mssql_list_databasesC

List all online databases on the MS SQL Server.

Inputs: server, database.

mssql_list_tablesB

List all tables and views in a specified MS SQL database.

Inputs: schema, database.

mssql_test_connectionB

Test connection to MS SQL Server and retrieve server version and metadata.

Inputs: port, user, server, database, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 5 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: testing connectivity, listing databases, listing tables/views, describing schema, and executing arbitrary queries. There is no meaningful overlap between the metadata exploration tools and the general query execution tool.

    Naming Consistency5/5

    All tools follow the same mssql_<verb>_<noun> pattern using snake_case. The names are predictable and make the action and target of each tool immediately clear.

    Tool Count5/5

    Five tools is a well-scoped size for a database-focused MCP server. Each tool covers a distinct aspect of SQL Server interaction without unnecessary duplication or bloat.

    Completeness5/5

    The toolset covers the core database workflow: connection verification, database discovery, table discovery, schema inspection, and arbitrary query execution. The execute_query tool effectively fills gaps for any DML, DDL, or EXEC operations not explicitly wrapped.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Microsoft SQL Server databases through T-SQL query execution, table exploration, and schema inspection. Supports configurable write protection and row limiting for safe database operations.
      1,551 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides tools to connect, query, and manage Microsoft SQL Server databases through the MCP protocol, including support for stored procedures, transactions, and schema inspection.
      54 PyPI
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables AI assistants to connect to Microsoft SQL Server for schema discovery, querying, stored procedures, DDL, performance diagnostics, and developer utilities with configurable security modes.
      35
      40 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables interaction with Microsoft SQL Server by executing queries, statements, and stored procedures, as well as retrieving schema metadata through the Model Context Protocol.
      10 npm
      MIT