MSSQL MCP Server

by fkdevsoft

345 downloads
Not rated
GitHub

Description

# MSSQL MCP Server A Model Context Protocol (MCP) server for connecting to Microsoft SQL Server databases. This server provides tools for executing SQL queries and managing database connections. ## Installation ```bash npm install mssql-mcp-server ``` ## Usage Add the server to…

About

# MSSQL MCP Server A Model Context Protocol (MCP) server for connecting to Microsoft SQL Server databases. This server provides tools for executing SQL queries and managing database connections. ## Installation ```bash npm install mssql-mcp-server ``` ## Usage Add the server to your MCP settings configuration file…

Details

Author
fkdevsoft
Downloads
345
Categories
Database

- Execute SQL queries on Microsoft SQL Server databases
- Support for full connection strings or individual parameters
- Configurable encryption and trust server certificate options
- Default port 1433 and default database master
- Flexible authentication via username/password or connection string

Install via npm (npm install mssql-mcp-server), then add the server to your MCP settings configuration file with either a full connection string or individual parameters (host, port, database, username, password, encrypt, trustServerCertificate). Use the query tool to execute SQL queries, providing either a connectionString or the combination of host, username, and password.

MSSQL MCP Server

A Model Context Protocol (MCP) server for connecting to Microsoft SQL Server databases. This server provides tools for executing SQL queries and managing database connections.

Installation

npm install mssql-mcp-server

Usage

Add the server to your MCP settings configuration file:

{
  "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"
      }
    }
  }
}

Tools

query

Execute a SQL query on a MSSQL database.

Parameters

- connectionString (string, optional): Full connection string (alternative to individual parameters)
- host (string, optional): Database server hostname
- port (number, optional): Database server port (default: 1433)
- database (string, optional): Database name (default: master)
- username (string, optional): Database username
- password (string, optional): Database password
- query (string, required): SQL query to execute
- encrypt (boolean, optional): Enable encryption (default: false)
- trustServerCertificate (boolean, optional): Trust server certificate (default: true)

Either connectionString OR (host + username + password) must be provided.

Example

const result = await use_mcp_tool({
  server_name: 'mssql',
  tool_name: 'query',
  arguments: {
    host: 'localhost',
    username: 'sa',
    password: 'yourpassword',
    query: 'SELECT * FROM Users',
  },
});

Development

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.