MS SQL Server MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MS SQL Server MCP ServerList all tables in the Sales database."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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: trueto 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:
TCP/IP Protocol Enabled: Open SQL Server Configuration Manager on the remote machine -> SQL Server Network Configuration -> Protocols for MSSQLSERVER -> Enable TCP/IP.
Inbound Firewall Rule: Allow TCP Port
1433in Windows Firewall on the remote machine.SQL Server Authentication (Mixed Mode): Ensure SQL Server Authentication is enabled and an active user account (e.g.
saor 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 |
|
| Tests connection & returns SQL Server version & info |
|
| Lists all online databases |
|
| Lists tables and views in a database |
|
| Returns full table column schemas & PKs |
|
| Executes T-SQL queries & returns result sets |
๐ License
MIT
mssql-mcp
Available Tools
5 toolsmssql_describe_tableA
Get table metadata including columns, data types, nullability, max length, and primary keys.
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Schema name (default: dbo) | |
| database | No | Target database name | |
| table_name | Yes | Name of the table to inspect |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The T-SQL query string to execute | |
| database | No | Target database name |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| server | No | ||
| database | No |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| schema | No | Optional schema filter | |
| database | No | Target database name |
TDQS
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.
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.
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.
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.
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.
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.
| Name | Required | Description | Default |
|---|---|---|---|
| port | No | Port number (default: 1433) | |
| user | No | Username | |
| server | No | Server host/IP | |
| database | No | Database name | |
| password | No | Password |
TDQS
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.
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.
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.
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.
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.
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
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.
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.
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.
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
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
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view detโฆ
Explore your Messages SQLite database to browse tables and inspect schemas with ease. Run flexibleโฆ
Run SOQL queries to explore and retrieve Salesforce data. Inspect records, fields, and relationshiโฆ
Create, manage, and query your Google Cloud SQL resources.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables 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.3222MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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,338MIT
- AlicenseNot gradedqualityDmaintenanceEnables 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.907MIT
- AlicenseNot gradedqualityCmaintenanceProvides 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
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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