Skip to main content
Glama
SQL Server MCP

SQL Server MCP

by cwilby

mcp-node-mssql

Usage

Cursor

See the official Cursor docs for more information.

  1. Open (or create) the mcp.json file (it should be in ~/.cursor/mcp.json or <project-root>/.cursor/mcp.json, but see Cursor docs for more details).

  2. Add the following details and save the file:

{
  "mcpServers": {
    "mssql": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-node-mssql"
      ],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "1433",
        "DB_USERNAME": "<username>",
        "DB_PASSWORD": "<password>",
        "DB_DATABASE": "<database>",
        "CONNECTION_TIMEOUT": 600000,
        "REQUEST_TIMEOUT": 300000
        "DB_ENCRYPT": "false",
        "DB_ENABLE_ARITH_ABORT": "false",
        "DB_TRUST_SERVER_CERTIFICATE": "false",
        "TRUSTED_CONNECTION": "false"
      }
    }
  }
}

Windsurf

See the official Windsurf docs for more information.

  1. Open the Windsurf MCP Configuration Panel

  2. Click Add custom server.

  3. Add the following details and save the file:

{
  "mcpServers": {
    "mssql": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-node-mssql"
      ],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "1433",
        "DB_USERNAME": "<username>",
        "DB_PASSWORD": "<password>",
        "DB_DATABASE": "<database>",
        "CONNECTION_TIMEOUT": 600000,
        "REQUEST_TIMEOUT": 300000
        "DB_ENCRYPT": "false",
        "DB_ENABLE_ARITH_ABORT": "false",
        "DB_TRUST_SERVER_CERTIFICATE": "false",
        "TRUSTED_CONNECTION": "false"
      }
    }
  }
}

Claude Code

See the official Claude Code docs for more information.

You can add a new MCP server from the Claude Code CLI. But modifying the json file directly is simpler!

  1. Open the Claude Code configuration file (it should be in ~/.claude.json).

  2. Find the projects > mcpServers section and add the following details and save the file:

{
  "projects": {
    "mcpServers": {
      "mssql": {
        "command": "npx",
        "args": [
          "-y",
          "mcp-node-mssql"
        ],
        "env": {
          "DB_HOST": "localhost",
          "DB_PORT": "1433",
          "DB_USERNAME": "<username>",
          "DB_PASSWORD": "<password>",
          "DB_DATABASE": "<database>",
          "CONNECTION_TIMEOUT": 600000,
          "REQUEST_TIMEOUT": 300000
          "DB_ENCRYPT": "false",
          "DB_ENABLE_ARITH_ABORT": "false",
          "DB_TRUST_SERVER_CERTIFICATE": "false",
          "TRUSTED_CONNECTION": "false"
        }
      }
    }
  }
}

Related MCP server: Microsoft SQL Server MCP Server

Issues and Troubleshooting

Before doing anything else, please make sure you are running the latest version!

If you run into problems using this MCP server, please open an issue on GitHub!

Development

Installation

npm install

Build

npm run build

Running the Development Server Locally

To test your local development version of the MCP server rather than using the published package, follow these steps:

  1. Build the project:

npm run build
  1. Create or modify your mcp.json file to reference your local build:

{
  "mcpServers": {
    "mssql": {
      "command": "node",
      "args": [
        "/path/to/your/local/mcp-node-mssql/dist/index.js"
      ],
      "env": {
        "DB_HOST": "localhost",
        "DB_PORT": "1433",
        "DB_USERNAME": "<username>",
        "DB_PASSWORD": "<password>",
        "DB_DATABASE": "<database>",
        "CONNECTION_TIMEOUT": 600000,
        "REQUEST_TIMEOUT": 300000
        "DB_ENCRYPT": "false",
        "DB_ENABLE_ARITH_ABORT": "false",
        "DB_TRUST_SERVER_CERTIFICATE": "false",
        "TRUSTED_CONNECTION": "false"
      }
    }
  }
}
  1. Place this mcp.json file in one of the following locations:

    • For Cursor: In your home directory (~/.cursor/mcp.json) or in your project directory (.cursor/mcp.json)

    • For Windsurf: Use the MCP Configuration Panel to add the custom server

  2. Restart your AI assistant (Cursor or Windsurf) to load the new configuration.

This allows you to instantly test changes to the MCP server without having to publish a new version.

Available Tools

8 tools
commit-transactionC

Commit a transaction

NameRequiredDescriptionDefault
transactionIdYesThe ID of the transaction to commit.
get-stored-procedureC

Get a specific stored procedure by name

NameRequiredDescriptionDefault
procedureNameYesThe name of the stored procedure to retrieve
get-stored-proceduresB

Get a list of all stored procedures in the database

NameRequiredDescriptionDefault

No parameters

get-tableC

Get a specific table by name

NameRequiredDescriptionDefault
tableNameYesThe name of the table to retrieve
get-tablesB

Get a list of all tables in the database

NameRequiredDescriptionDefault

No parameters

queryC

Query the database with a SQL statement

NameRequiredDescriptionDefault
queryYesThe SQL query to execute
rollback-transactionC

Rollback a transaction

NameRequiredDescriptionDefault
transactionIdYesThe ID of the transaction to rollback.
start-transactionC

Start a new transaction

NameRequiredDescriptionDefault

No parameters

Tool Schema Changelog

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

  1. 8 tool updatesv1.0.0
    • First observedcommit-transaction
    • First observedget-stored-procedure
    • First observedget-stored-procedures
    • First observedget-table
    • First observedget-tables
    • First observedquery
    • First observedrollback-transaction
    • First observedstart-transaction

TDQS

B3.4/5.0

Scored across 8 tools

Disambiguation5/5

Every tool has a clearly distinct purpose with no ambiguity. Tools are clearly separated by resource type (tables vs stored procedures) and action type (get specific vs get list vs transaction operations vs query). The query tool stands alone as a general-purpose operation.

Naming Consistency5/5

All tools follow a consistent verb-noun pattern with hyphens. Transaction tools use verb-transaction pattern (start-transaction, commit-transaction, rollback-transaction), get operations use get-noun pattern (get-table, get-tables), and query stands alone as a clear single verb. The naming is perfectly predictable throughout.

Tool Count5/5

8 tools is well-scoped for a database server. Each tool earns its place with clear responsibilities: 4 for data/metadata retrieval, 3 for transaction management, and 1 for general querying. This provides comprehensive coverage without bloat.

Completeness4/5

The toolset covers core database operations well with querying, transaction management, and metadata retrieval. Minor gaps exist in write operations beyond transactions (no explicit insert/update/delete tools) and schema modification (no create/alter/drop tools), but the query tool provides a workaround for most of these operations.

Maintenance

ActivityInactive
ResponsivenessNo recent community issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A Model Context Protocol server that enables secure and structured interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries with controlled access.
    60
    MIT
  • A
    license
    B
    quality
    B
    maintenance
    A Model Context Protocol server that enables secure interaction with Microsoft SQL Server databases, allowing AI assistants to list tables, read data, and execute SQL queries through a controlled interface.
    1
    402
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    A Model Context Protocol server that allows Large Language Models like Claude to execute SQL queries, explore database schemas, and maintain persistent connections to SQL Server databases.
    -
  • A
    license
    A
    quality
    C
    maintenance
    A Model Context Protocol server that enables LLMs like Claude to interact with Microsoft SQL Server databases through natural language, supporting queries, data manipulation, and table management.
    8
    2,530 npm
    MIT