MCP Sqlserver MCP Server

# MCP SQL Server [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

Local serverstdioTypeScript

What is the MCP Sqlserver MCP server?

MCP Sqlserver MCP server exists for a simple reason — assistants are far more useful when they can act on MCP Sqlserver directly instead of describing what you should do. # MCP SQL Server License TypeScript.

What you get

  • 🔒 Read-only operations — Only SELECT queries allowed, with comprehensive security validation
  • 🗄️ Schema discovery — Explore databases, tables, views, relationships, and metadata
  • 📊 Data exploration — Execute safe queries with built-in limits and timeouts
  • 🔐 Enterprise-ready — Encrypted connections with certificate trust for production environments
  • 🛡️ Security-first — Query validation, SQL injection protection, and access controls

What the assistant can call

Once MCP Sqlserver is connected, these are the calls the assistant has available:

  • Required — The Required tool exposed by this server
  • Optional — The Optional tool exposed by this server

Configuration and credentials

You will need 6 environment variables: SQLSERVER_HOST, SQLSERVER_USER, SQLSERVER_PASSWORD, SQLSERVER_DATABASE, SQLSERVER_ENCRYPT, SQLSERVER_TRUST_CERT. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Setting it up

Installation goes through your MCP client rather than a global install: point it at mcp-sqlserver 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.

Choosing this one

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. MCP Sqlserver's toolset — Required, Optional — is a fair guide to whether it matches your workflow. It is maintained by bilims; 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.

Before you rely on it

  • 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.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the mcp sqlserver mcp server does with a few real requests.

Available tools

ToolWhat it does
RequiredThe Required tool exposed by this server.
OptionalThe Optional tool exposed by this server.

How to install the MCP Sqlserver MCP server

{
  "mcpServers": {
    "sqlserver": {
      "command": "mcp-sqlserver",
      "env": {
        "SQLSERVER_HOST": "your-server.database.windows.net",
        "SQLSERVER_USER": "your-username",
        "SQLSERVER_PASSWORD": "your-password",
        "SQLSERVER_DATABASE": "your-database",
        "SQLSERVER_ENCRYPT": "true",
        "SQLSERVER_TRUST_CERT": "false"
      }
    }
  }
}

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

Configuration

VariableDescriptionRequired
SQLSERVER_HOSTEndpoint or connection string the server talks to.Optional
SQLSERVER_USERConfiguration value read at startup.Optional
SQLSERVER_PASSWORDConfiguration value read at startup.Optional
SQLSERVER_DATABASEConfiguration value read at startup.Optional
SQLSERVER_ENCRYPTConfiguration value read at startup.Optional
SQLSERVER_TRUST_CERTConfiguration value read at startup.Optional

Example prompts to try

  • Use MCP Sqlserver to Required.
  • Use MCP Sqlserver to Optional.

Frequently asked questions

Node.js 20+, TypeScript 5.0+, and Microsoft SQL Server 2016+ are required.