Skip to main content
Glama
arsyadal

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 SQL Server

๐Ÿ“‹ 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.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (default: dbo)
databaseNoTarget database name
table_nameYesName of the table to inspect

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the burden. It usefully discloses the contents of the returned metadata but does not state that the operation is read-only, how errors are handled for missing tables, or whether a database parameter is required.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence, front-loaded with the verb and resource, enumerates the key metadata fields without redundancy. Every word contributes meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a straightforward describe operation, the description covers the essential return content. Since no output schema exists, the explicit list of metadata fields partially compensates, though it omits response shape and failure semantics.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers 100% of parameters with descriptions, so the schema does the heavy lifting. The tool description adds no additional parameter-level details, making baseline 3 appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('Get') and resource ('table metadata'), and enumerates exactly what is returned (columns, data types, nullability, max length, primary keys). This clearly distinguishes it from siblings like mssql_list_tables or mssql_execute_query.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool vs alternatives, and no mention of prerequisites such as needing an active connection or specifying a database. Usage is only implied by the tool name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mssql_execute_queryA

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

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe T-SQL query string to execute
databaseNoTarget database name

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must carry behavioral transparency. It does disclose that the tool can execute mutating statements (INSERT, UPDATE, DELETE, EXEC), signaling side-effect risk. However, it does not mention transaction/commit behavior, result-set return, or whether DDL statements are supported.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the verb and resource, then immediately lists relevant query types. No filler or redundant content.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter tool this is minimal but workable: the agent knows what query to pass and can name a database. Missing output schema and annotations leave questions about result format and side-effect/commit behavior unanswered, so it is not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% for both query and database, so the schema already explains the parameters. The description adds no extra meaning about parameter format, defaults, or the behavior of the optional database parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: 'Execute a T-SQL query' on the MS SQL database, and enumerates supported statement types (SELECT, INSERT, UPDATE, DELETE, EXEC). This clearly distinguishes it from sibling metadata tools such as mssql_list_tables and mssql_describe_table.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this is the general-purpose query execution tool, but it never explicitly says when to prefer it over siblings or when not to use it. No exclusions or alternative routing are provided; usage context must be inferred from the sibling tool names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mssql_list_databasesC

List all online databases on the MS SQL Server.

ParametersJSON Schema
NameRequiredDescriptionDefault
serverNo
databaseNo

TDQS

C2.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It adds the 'online' scoping detail, but omits important behavioral context such as whether it returns system databases, whether authentication is needed, what happens when parameters are omitted, and what the output format looks like.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler or repetition. It is concise and immediately states the core action, though it sacrifices useful parameter and usage detail for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and two undocumented parameters, the description is too sparse. An agent cannot fully determine how to invoke the tool correctly, what the parameters mean, or what the result will contain, leaving significant room for misconfiguration.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage and the description does not mention the 'server' or 'database' parameters at all. While 'server' is mildly self-explanatory, the 'database' parameter is confusing for a tool that claims to list all online databases, and an agent cannot determine whether it filters the listing or merely specifies connection context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('List') and resource ('all online databases') on the MS SQL Server, making the tool's purpose immediately clear. It is naturally distinct from siblings like mssql_list_tables and mssql_execute_query because it targets database enumeration at the server level.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no guidance about when to choose this tool over alternatives, such as when to use mssql_test_connection versus listing databases or when to use mssql_list_tables once a database is selected. The usage context is only implied by the tool's name and basic purpose, not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mssql_list_tablesB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoOptional schema filter
databaseNoTarget database name

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the read-only nature implicitly via 'List', but does not mention permissions, whether system tables/views are included, behavior when no database is specified, or any side effects. For a tool with zero annotation coverage, this is a significant gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One concise sentence with no filler. The core operation and scope are front-loaded, and every word contributes value. The description is appropriately sized for a simple list operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter list tool with no output schema, the description plus schema covers the basic call. However, the lack of annotations, absence of usage guidance, and silence on behavior quirks (e.g., required database despite schema marking it optional) leave moderate gaps. It is minimally viable but not richly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented in the schema. The description adds only a mild rephrasing of the database parameter ('specified MS SQL database') and does not clarify the optional schema filter's format or default behavior. Baseline 3 is appropriate since the schema carries the parameter meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List') and clear resource ('all tables and views in a specified MS SQL database'). It distinguishes this tool from siblings like mssql_list_databases and mssql_describe_table by naming the exact object types and database scope.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives no guidance on when to use this tool versus alternatives. It does not mention that mssql_list_databases should be used first to find available databases, nor does it explain when mssql_describe_table would be more appropriate. Usage context is left entirely to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

mssql_test_connectionB

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

ParametersJSON Schema
NameRequiredDescriptionDefault
portNoPort number (default: 1433)
userNoUsername
serverNoServer host/IP
databaseNoDatabase name
passwordNoPassword

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations present, the description carries full responsibility for behavioral disclosure. It reveals that the tool tests connectivity and returns version/metadata, but says nothing about side effects, authentication needs, failure behavior, or whether any operation is read-only.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler or repetition. Every word contributes to identifying the tool's purpose and output.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and the schema documents its optional parameters, but without annotations or an output schema, the description should say more about what 'metadata' includes and what happens on failed connections. It is adequate for basic invocation but leaves notable gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the input schema already documents all five parameters. The description adds no extra parameter-level meaning, which keeps it at the baseline 3 rather than higher.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific action ('Test connection'), a clear resource ('MS SQL Server'), and a concrete outcome ('retrieve server version and metadata'). This distinguishes it cleanly from sibling tools that list databases, tables, describe schemas, or execute queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given about when to run this tool versus listing databases, describing tables, or executing queries. The intended use as a connectivity preflight is only implied by the name and description, with no explicit exclusions or alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.7/5.0
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

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI models to interact with MS SQL Server databases through a standardized interface. Supports executing SQL queries with parameters, listing tables, and describing table schemas.
    3
    222
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables interaction with Microsoft SQL Server databases using both SQL Server and Windows Authentication. It supports flexible connection configurations, including read-only modes and encrypted communication for secure data management.
    3,338
    MIT
  • 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.
    907
    MIT
  • A
    license
    Not graded
    quality
    C
    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.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/arsyadal/mssql-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server