MSSQL MCP Server

# MSSQL MCP Server [![smithery badge](https://smithery.ai/badge/@c0h1b4/mssql-mcp-server)](https://smithery.ai/server/@c0h1b4/mssql-mcp-server) A

Local serverstdioTypeScript

What is the MSSQL MCP server?

If you already use MSSQL, the mssql mcp server is the piece that lets your assistant work with it directly. # MSSQL MCP Server smithery badge A Model Context Protocol (MCP) server for connecting to Microsoft SQL Server databases. This.

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • query — The query tool exposed by this server
  • Parameters — The Parameters tool exposed by this server
  • Example — The Example tool exposed by this server

Installation

Installation goes through your MCP client rather than a global install: point it at @smithery/cli on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Credentials and setup notes

Configuration is passed through the environment: MSSQL_CONNECTION_STRING, MSSQL_HOST, MSSQL_PORT, MSSQL_DATABASE, MSSQL_USER, MSSQL_PASSWORD, MSSQL_ENCRYPT, MSSQL_TRUST_SERVER_CERTIFICATE. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Where it fits

Among the database access options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. MSSQL's toolset — query, Parameters, Example — is a fair guide to whether it matches your workflow. It is maintained by c0h1b4; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
queryThe query tool exposed by this server.
ParametersThe Parameters tool exposed by this server.
ExampleThe Example tool exposed by this server.

How to install the MSSQL MCP server

{
  "mcpServers": {
    "mssql": {
      "command": "mssql-mcp-server",
      "env": {
        "MSSQL_CONNECTION_STRING": "Server=localhost;Database=master;User Id=sa;Password=yourpassword;",
        // Or individual connection parameters:
        "MSSQL_HOST": "localhost",
        "MSSQL_PORT": "1433",
        "MSSQL_DATABASE": "master",
        "MSSQL_USER": "sa",
        "MSSQL_PASSWORD": "yourpassword",
        "MSSQL_ENCRYPT": "false",
        "MSSQL_TRUST_SERVER_CERTIFICATE": "true"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
MSSQL_CONNECTION_STRINGConfiguration value read at startup.Optional
MSSQL_HOSTEndpoint or connection string the server talks to.Optional
MSSQL_PORTConfiguration value read at startup.Optional
MSSQL_DATABASEConfiguration value read at startup.Optional
MSSQL_USERConfiguration value read at startup.Optional
MSSQL_PASSWORDConfiguration value read at startup.Optional
MSSQL_ENCRYPTConfiguration value read at startup.Optional
MSSQL_TRUST_SERVER_CERTIFICATEConfiguration value read at startup.Optional

Example prompts to try

  • Use MSSQL to query.
  • Use MSSQL to Parameters.
  • Use MSSQL to Example.

Frequently asked questions

It is an MCP server that enables AI assistants to connect to and query Microsoft SQL Server databases using the Model Context Protocol.